diff --git a/gen/adexchangebuyer1d3-cli/Cargo.toml b/gen/adexchangebuyer1d3-cli/Cargo.toml index bfa2b9534f..9d8209d61d 100644 --- a/gen/adexchangebuyer1d3-cli/Cargo.toml +++ b/gen/adexchangebuyer1d3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d3-cli" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-adexchangebuyer1d3] path = "../adexchangebuyer1d3" -version = "1.0.5+20170504" +version = "1.0.6+20170504" diff --git a/gen/adexchangebuyer1d3-cli/README.md b/gen/adexchangebuyer1d3-cli/README.md index 09da728145..5fdd4f1603 100644 --- a/gen/adexchangebuyer1d3-cli/README.md +++ b/gen/adexchangebuyer1d3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Ad Exchange Buyer* API at revision *20170504*. The CLI is at version *1.0.5*. +This documentation was generated from the *Ad Exchange Buyer* API at revision *20170504*. The CLI is at version *1.0.6*. ```bash adexchangebuyer1d3 [options] diff --git a/gen/adexchangebuyer1d3-cli/mkdocs.yml b/gen/adexchangebuyer1d3-cli/mkdocs.yml index 7fc66e7da0..8b4f066b22 100644 --- a/gen/adexchangebuyer1d3-cli/mkdocs.yml +++ b/gen/adexchangebuyer1d3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Buyer v1.0.5+20170504 +site_name: Ad Exchange Buyer v1.0.6+20170504 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli site_description: A complete library to interact with Ad Exchange Buyer (protocol v1.3) diff --git a/gen/adexchangebuyer1d3-cli/src/cmn.rs b/gen/adexchangebuyer1d3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/adexchangebuyer1d3-cli/src/cmn.rs +++ b/gen/adexchangebuyer1d3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/adexchangebuyer1d3-cli/src/main.rs b/gen/adexchangebuyer1d3-cli/src/main.rs index 88e31e9d80..6fb6af4f9b 100644 --- a/gen/adexchangebuyer1d3-cli/src/main.rs +++ b/gen/adexchangebuyer1d3-cli/src/main.rs @@ -2304,7 +2304,7 @@ fn main() { let mut app = App::new("adexchangebuyer1d3") .author("Sebastian Thiel ") - .version("1.0.5+20170504") + .version("1.0.6+20170504") .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") diff --git a/gen/adexchangebuyer1d3/Cargo.toml b/gen/adexchangebuyer1d3/Cargo.toml index 38b1944453..3818372c48 100644 --- a/gen/adexchangebuyer1d3/Cargo.toml +++ b/gen/adexchangebuyer1d3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adexchangebuyer1d3" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" homepage = "https://developers.google.com/ad-exchange/buyer-rest" -documentation = "https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504" +documentation = "https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504" license = "MIT" keywords = ["adexchangebuyer", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/adexchangebuyer1d3/README.md b/gen/adexchangebuyer1d3/README.md index b6dbd68d66..2ba2083ac9 100644 --- a/gen/adexchangebuyer1d3/README.md +++ b/gen/adexchangebuyer1d3/README.md @@ -5,28 +5,28 @@ 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Ad Exchange Buyer* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.AdExchangeBuyer.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.AdExchangeBuyer.html) ... -* [accounts](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.Account.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.AccountListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.AccountUpdateCall.html) -* [billing info](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.BillingInfo.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.BillingInfoGetCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.BillingInfoListCall.html) -* [budget](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.Budget.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.BudgetGetCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.BudgetPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.BudgetUpdateCall.html) -* [creatives](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.Creative.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.CreativeInsertCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.CreativeListCall.html) -* [direct deals](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.DirectDeal.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.DirectDealGetCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.DirectDealListCall.html) -* [performance report](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PerformanceReport.html) - * [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PerformanceReportListCall.html) -* [pretargeting config](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfig.html) - * [*delete*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigDeleteCall.html), [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigUpdateCall.html) +* [accounts](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.Account.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.AccountListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.AccountUpdateCall.html) +* [billing info](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.BillingInfo.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.BillingInfoGetCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.BillingInfoListCall.html) +* [budget](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.Budget.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.BudgetGetCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.BudgetPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.BudgetUpdateCall.html) +* [creatives](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.Creative.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.CreativeInsertCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.CreativeListCall.html) +* [direct deals](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.DirectDeal.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.DirectDealGetCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.DirectDealListCall.html) +* [performance report](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PerformanceReport.html) + * [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PerformanceReportListCall.html) +* [pretargeting config](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfig.html) + * [*delete*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigDeleteCall.html), [*get*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.PretargetingConfigUpdateCall.html) @@ -35,17 +35,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/struct.AdExchangeBuyer.html)** +* **[Hub](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/struct.AdExchangeBuyer.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.Part.html)** + * **[Parts](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -137,17 +137,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/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")`. @@ -157,29 +157,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/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](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/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](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/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](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/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](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/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](https://docs.rs/google-adexchangebuyer1d3/1.0.5+20170504/google_adexchangebuyer1d3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adexchangebuyer1d3/1.0.6+20170504/google_adexchangebuyer1d3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adexchangebuyer1d3/src/lib.rs b/gen/adexchangebuyer1d3/src/lib.rs index 872001e2e5..11fc3a7631 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Ad Exchange Buyer* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -338,7 +338,7 @@ impl<'a, C, A> AdExchangeBuyer AdExchangeBuyer { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/adexchangebuyer/v1.3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -367,7 +367,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/adexchangebuyer1d4-cli/Cargo.toml b/gen/adexchangebuyer1d4-cli/Cargo.toml index 912c706977..e81dd65b05 100644 --- a/gen/adexchangebuyer1d4-cli/Cargo.toml +++ b/gen/adexchangebuyer1d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangebuyer1d4-cli" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-adexchangebuyer1d4] path = "../adexchangebuyer1d4" -version = "1.0.5+20170504" +version = "1.0.6+20170504" diff --git a/gen/adexchangebuyer1d4-cli/README.md b/gen/adexchangebuyer1d4-cli/README.md index 72a06a1d5d..30ac7f2aa0 100644 --- a/gen/adexchangebuyer1d4-cli/README.md +++ b/gen/adexchangebuyer1d4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Ad Exchange Buyer* API at revision *20170504*. The CLI is at version *1.0.5*. +This documentation was generated from the *Ad Exchange Buyer* API at revision *20170504*. The CLI is at version *1.0.6*. ```bash adexchangebuyer1d4 [options] diff --git a/gen/adexchangebuyer1d4-cli/mkdocs.yml b/gen/adexchangebuyer1d4-cli/mkdocs.yml index c304c1ffed..8e8e96f7b0 100644 --- a/gen/adexchangebuyer1d4-cli/mkdocs.yml +++ b/gen/adexchangebuyer1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Buyer v1.0.5+20170504 +site_name: Ad Exchange Buyer v1.0.6+20170504 site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d4-cli site_description: A complete library to interact with Ad Exchange Buyer (protocol v1.4) diff --git a/gen/adexchangebuyer1d4-cli/src/cmn.rs b/gen/adexchangebuyer1d4-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/adexchangebuyer1d4-cli/src/cmn.rs +++ b/gen/adexchangebuyer1d4-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/adexchangebuyer1d4-cli/src/main.rs b/gen/adexchangebuyer1d4-cli/src/main.rs index 6dd13e87a2..7cf84f9087 100644 --- a/gen/adexchangebuyer1d4-cli/src/main.rs +++ b/gen/adexchangebuyer1d4-cli/src/main.rs @@ -4086,7 +4086,7 @@ fn main() { let mut app = App::new("adexchangebuyer1d4") .author("Sebastian Thiel ") - .version("1.0.5+20170504") + .version("1.0.6+20170504") .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") diff --git a/gen/adexchangebuyer1d4/Cargo.toml b/gen/adexchangebuyer1d4/Cargo.toml index d1b5632008..a402ee2173 100644 --- a/gen/adexchangebuyer1d4/Cargo.toml +++ b/gen/adexchangebuyer1d4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adexchangebuyer1d4" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" homepage = "https://developers.google.com/ad-exchange/buyer-rest" -documentation = "https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504" +documentation = "https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504" license = "MIT" keywords = ["adexchangebuyer", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/adexchangebuyer1d4/README.md b/gen/adexchangebuyer1d4/README.md index e7d4ebd2e2..9c194358e4 100644 --- a/gen/adexchangebuyer1d4/README.md +++ b/gen/adexchangebuyer1d4/README.md @@ -5,38 +5,38 @@ 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Ad Exchange Buyer* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.AdExchangeBuyer.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.AdExchangeBuyer.html) ... -* [accounts](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.Account.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.AccountListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.AccountUpdateCall.html) -* [billing info](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.BillingInfo.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.BillingInfoGetCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.BillingInfoListCall.html) -* [budget](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.Budget.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.BudgetGetCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.BudgetPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.BudgetUpdateCall.html) -* [creatives](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.Creative.html) - * [*add deal*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.CreativeAddDealCall.html), [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.CreativeListCall.html), [*list deals*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.CreativeListDealCall.html) and [*remove deal*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.CreativeRemoveDealCall.html) +* [accounts](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.Account.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.AccountListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.AccountUpdateCall.html) +* [billing info](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.BillingInfo.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.BillingInfoGetCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.BillingInfoListCall.html) +* [budget](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.Budget.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.BudgetGetCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.BudgetPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.BudgetUpdateCall.html) +* [creatives](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.Creative.html) + * [*add deal*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.CreativeAddDealCall.html), [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.CreativeListCall.html), [*list deals*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.CreativeListDealCall.html) and [*remove deal*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.CreativeRemoveDealCall.html) * marketplacedeals - * [*delete*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplacedealDeleteCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplacedealInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplacedealListCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplacedealUpdateCall.html) + * [*delete*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplacedealDeleteCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplacedealInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplacedealListCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplacedealUpdateCall.html) * marketplacenotes - * [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplacenoteInsertCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplacenoteListCall.html) + * [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplacenoteInsertCall.html) and [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplacenoteListCall.html) * marketplaceprivateauction - * [*updateproposal*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.MarketplaceprivateauctionUpdateproposalCall.html) -* [performance report](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PerformanceReport.html) - * [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PerformanceReportListCall.html) -* [pretargeting config](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfig.html) - * [*delete*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigDeleteCall.html), [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigUpdateCall.html) -* [products](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.Product.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProductGetCall.html) and [*search*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProductSearchCall.html) -* [proposals](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.Proposal.html) - * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProposalGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProposalInsertCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProposalPatchCall.html), [*search*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProposalSearchCall.html), [*setupcomplete*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProposalSetupcompleteCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.ProposalUpdateCall.html) + * [*updateproposal*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.MarketplaceprivateauctionUpdateproposalCall.html) +* [performance report](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PerformanceReport.html) + * [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PerformanceReportListCall.html) +* [pretargeting config](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfig.html) + * [*delete*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigDeleteCall.html), [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigInsertCall.html), [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigListCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigPatchCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PretargetingConfigUpdateCall.html) +* [products](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.Product.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProductGetCall.html) and [*search*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProductSearchCall.html) +* [proposals](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.Proposal.html) + * [*get*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProposalGetCall.html), [*insert*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProposalInsertCall.html), [*patch*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProposalPatchCall.html), [*search*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProposalSearchCall.html), [*setupcomplete*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProposalSetupcompleteCall.html) and [*update*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.ProposalUpdateCall.html) * pubprofiles - * [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.PubprofileListCall.html) + * [*list*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.PubprofileListCall.html) @@ -45,17 +45,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/struct.AdExchangeBuyer.html)** +* **[Hub](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/struct.AdExchangeBuyer.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.Part.html)** + * **[Parts](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -149,17 +149,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/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")`. @@ -169,29 +169,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/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](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/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](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/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](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/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](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/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](https://docs.rs/google-adexchangebuyer1d4/1.0.5+20170504/google_adexchangebuyer1d4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adexchangebuyer1d4/1.0.6+20170504/google_adexchangebuyer1d4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adexchangebuyer1d4/src/lib.rs b/gen/adexchangebuyer1d4/src/lib.rs index 08af6fb555..d369b65dc9 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Ad Exchange Buyer* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -350,7 +350,7 @@ impl<'a, C, A> AdExchangeBuyer AdExchangeBuyer { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/adexchangebuyer/v1.4/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -394,7 +394,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/adexchangeseller2-cli/Cargo.toml b/gen/adexchangeseller2-cli/Cargo.toml index 2f09cbb915..d4133bdba9 100644 --- a/gen/adexchangeseller2-cli/Cargo.toml +++ b/gen/adexchangeseller2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adexchangeseller2-cli" -version = "1.0.5+20160805" +version = "1.0.6+20160805" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-adexchangeseller2] path = "../adexchangeseller2" -version = "1.0.5+20160805" +version = "1.0.6+20160805" diff --git a/gen/adexchangeseller2-cli/README.md b/gen/adexchangeseller2-cli/README.md index 39bb801c99..a510066641 100644 --- a/gen/adexchangeseller2-cli/README.md +++ b/gen/adexchangeseller2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Ad Exchange Seller* API at revision *20160805*. The CLI is at version *1.0.5*. +This documentation was generated from the *Ad Exchange Seller* API at revision *20160805*. The CLI is at version *1.0.6*. ```bash adexchangeseller2 [options] diff --git a/gen/adexchangeseller2-cli/mkdocs.yml b/gen/adexchangeseller2-cli/mkdocs.yml index 0ba9d4f5cc..f344cbffd8 100644 --- a/gen/adexchangeseller2-cli/mkdocs.yml +++ b/gen/adexchangeseller2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Ad Exchange Seller v1.0.5+20160805 +site_name: Ad Exchange Seller v1.0.6+20160805 site_url: http://byron.github.io/google-apis-rs/google-adexchangeseller2-cli site_description: A complete library to interact with Ad Exchange Seller (protocol v2.0) diff --git a/gen/adexchangeseller2-cli/src/cmn.rs b/gen/adexchangeseller2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/adexchangeseller2-cli/src/cmn.rs +++ b/gen/adexchangeseller2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/adexchangeseller2-cli/src/main.rs b/gen/adexchangeseller2-cli/src/main.rs index 0009f0826a..76f7d246b4 100644 --- a/gen/adexchangeseller2-cli/src/main.rs +++ b/gen/adexchangeseller2-cli/src/main.rs @@ -1348,7 +1348,7 @@ fn main() { let mut app = App::new("adexchangeseller2") .author("Sebastian Thiel ") - .version("1.0.5+20160805") + .version("1.0.6+20160805") .about("Accesses the inventory of Ad Exchange seller users and generates 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") diff --git a/gen/adexchangeseller2/Cargo.toml b/gen/adexchangeseller2/Cargo.toml index 39b719653e..f2ab81fb44 100644 --- a/gen/adexchangeseller2/Cargo.toml +++ b/gen/adexchangeseller2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adexchangeseller2" -version = "1.0.5+20160805" +version = "1.0.6+20160805" 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" homepage = "https://developers.google.com/ad-exchange/seller-rest/" -documentation = "https://docs.rs/google-adexchangeseller2/1.0.5+20160805" +documentation = "https://docs.rs/google-adexchangeseller2/1.0.6+20160805" license = "MIT" keywords = ["adexchangeseller", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/adexchangeseller2/README.md b/gen/adexchangeseller2/README.md index 13a4827f65..7aa267dc99 100644 --- a/gen/adexchangeseller2/README.md +++ b/gen/adexchangeseller2/README.md @@ -5,21 +5,21 @@ 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 *1.0.5+20160805*, where *20160805* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Ad Exchange Seller* crate version *1.0.6+20160805*, where *20160805* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AdExchangeSeller.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AdExchangeSeller.html) ... -* [accounts](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.Account.html) - * [*adclients list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountAdclientListCall.html), [*alerts list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountAlertListCall.html), [*customchannels get*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountCustomchannelGetCall.html), [*customchannels list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountCustomchannelListCall.html), [*get*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountListCall.html), [*metadata dimensions list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountMetadataDimensionListCall.html), [*metadata metrics list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountMetadataMetricListCall.html), [*preferreddeals get*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountPreferreddealGetCall.html), [*preferreddeals list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountPreferreddealListCall.html), [*reports generate*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountReportGenerateCall.html), [*reports saved generate*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountReportSavedGenerateCall.html), [*reports saved list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountReportSavedListCall.html) and [*urlchannels list*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountUrlchannelListCall.html) +* [accounts](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.Account.html) + * [*adclients list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountAdclientListCall.html), [*alerts list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountAlertListCall.html), [*customchannels get*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountCustomchannelGetCall.html), [*customchannels list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountCustomchannelListCall.html), [*get*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountListCall.html), [*metadata dimensions list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountMetadataDimensionListCall.html), [*metadata metrics list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountMetadataMetricListCall.html), [*preferreddeals get*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountPreferreddealGetCall.html), [*preferreddeals list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountPreferreddealListCall.html), [*reports generate*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountReportGenerateCall.html), [*reports saved generate*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountReportSavedGenerateCall.html), [*reports saved list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountReportSavedListCall.html) and [*urlchannels list*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountUrlchannelListCall.html) Download supported by ... -* [*reports generate accounts*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AccountReportGenerateCall.html) +* [*reports generate accounts*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AccountReportGenerateCall.html) @@ -27,17 +27,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/struct.AdExchangeSeller.html)** +* **[Hub](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/struct.AdExchangeSeller.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.Part.html)** + * **[Parts](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -140,17 +140,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/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")`. @@ -160,29 +160,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/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](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/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](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/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](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/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](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/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](https://docs.rs/google-adexchangeseller2/1.0.5+20160805/google_adexchangeseller2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adexchangeseller2/1.0.6+20160805/google_adexchangeseller2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adexchangeseller2/src/lib.rs b/gen/adexchangeseller2/src/lib.rs index e1494ffc1e..682a2b3fc8 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 *1.0.5+20160805*, where *20160805* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Ad Exchange Seller* crate version *1.0.6+20160805*, where *20160805* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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/). @@ -346,7 +346,7 @@ impl<'a, C, A> AdExchangeSeller AdExchangeSeller { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/adexchangeseller/v2.0/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -357,7 +357,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/admin1_directory-cli/Cargo.toml b/gen/admin1_directory-cli/Cargo.toml index d5e95617c4..8aa404da4a 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 = "1.0.5+20170419" +version = "1.0.6+20170419" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-admin1_directory] path = "../admin1_directory" -version = "1.0.5+20170419" +version = "1.0.6+20170419" diff --git a/gen/admin1_directory-cli/README.md b/gen/admin1_directory-cli/README.md index dc7df5ed4c..4038c0d35f 100644 --- a/gen/admin1_directory-cli/README.md +++ b/gen/admin1_directory-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *directory* API at revision *20170419*. The CLI is at version *1.0.5*. +This documentation was generated from the *directory* API at revision *20170419*. The CLI is at version *1.0.6*. ```bash admin1-directory [options] diff --git a/gen/admin1_directory-cli/mkdocs.yml b/gen/admin1_directory-cli/mkdocs.yml index 317030cc7e..17a1e16720 100644 --- a/gen/admin1_directory-cli/mkdocs.yml +++ b/gen/admin1_directory-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: directory v1.0.5+20170419 +site_name: directory v1.0.6+20170419 site_url: http://byron.github.io/google-apis-rs/google-admin1_directory-cli site_description: A complete library to interact with directory (protocol directory_v1) diff --git a/gen/admin1_directory-cli/src/cmn.rs b/gen/admin1_directory-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/admin1_directory-cli/src/cmn.rs +++ b/gen/admin1_directory-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/admin1_directory-cli/src/main.rs b/gen/admin1_directory-cli/src/main.rs index e725bfa8f7..e4877ab75f 100644 --- a/gen/admin1_directory-cli/src/main.rs +++ b/gen/admin1_directory-cli/src/main.rs @@ -9799,7 +9799,7 @@ fn main() { let mut app = App::new("admin1-directory") .author("Sebastian Thiel ") - .version("1.0.5+20170419") + .version("1.0.6+20170419") .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") diff --git a/gen/admin1_directory/Cargo.toml b/gen/admin1_directory/Cargo.toml index 300c9e217c..41c3fc9994 100644 --- a/gen/admin1_directory/Cargo.toml +++ b/gen/admin1_directory/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-admin1_directory" -version = "1.0.5+20170419" +version = "1.0.6+20170419" 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" homepage = "https://developers.google.com/admin-sdk/directory/" -documentation = "https://docs.rs/google-admin1_directory/1.0.5+20170419" +documentation = "https://docs.rs/google-admin1_directory/1.0.6+20170419" license = "MIT" keywords = ["admin", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/admin1_directory/README.md b/gen/admin1_directory/README.md index 14c0cd8164..516f8afe60 100644 --- a/gen/admin1_directory/README.md +++ b/gen/admin1_directory/README.md @@ -5,61 +5,61 @@ 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 *1.0.5+20170419*, where *20170419* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *directory* crate version *1.0.6+20170419*, where *20170419* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *directory* *v1_directory* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/directory/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Directory.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Directory.html) ... -* [asps](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Asp.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.AspDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.AspGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.AspListCall.html) -* [channels](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Channel.html) - * [*stop*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ChannelStopCall.html) +* [asps](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Asp.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.AspDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.AspGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.AspListCall.html) +* [channels](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Channel.html) + * [*stop*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ChannelStopCall.html) * chromeosdevices - * [*action*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ChromeosdeviceActionCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ChromeosdeviceGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ChromeosdeviceListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ChromeosdevicePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ChromeosdeviceUpdateCall.html) -* [customers](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Customer.html) - * [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.CustomerGetCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.CustomerPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.CustomerUpdateCall.html) + * [*action*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ChromeosdeviceActionCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ChromeosdeviceGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ChromeosdeviceListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ChromeosdevicePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ChromeosdeviceUpdateCall.html) +* [customers](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Customer.html) + * [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.CustomerGetCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.CustomerPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.CustomerUpdateCall.html) * domain aliases - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainAliaseDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainAliaseGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainAliaseInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainAliaseListCall.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainAliaseDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainAliaseGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainAliaseInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainAliaseListCall.html) * domains - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.DomainListCall.html) -* [groups](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Group.html) - * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupAliaseListCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupUpdateCall.html) -* [members](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Member.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MemberDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MemberGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MemberInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MemberListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MemberPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MemberUpdateCall.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.DomainListCall.html) +* [groups](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Group.html) + * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupAliaseListCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupUpdateCall.html) +* [members](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Member.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MemberDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MemberGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MemberInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MemberListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MemberPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MemberUpdateCall.html) * mobiledevices - * [*action*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MobiledeviceActionCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MobiledeviceDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MobiledeviceGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.MobiledeviceListCall.html) -* [notifications](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Notification.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.NotificationGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.NotificationListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.NotificationPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.NotificationUpdateCall.html) + * [*action*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MobiledeviceActionCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MobiledeviceDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MobiledeviceGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.MobiledeviceListCall.html) +* [notifications](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Notification.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.NotificationGetCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.NotificationListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.NotificationPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.NotificationUpdateCall.html) * orgunits - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.OrgunitDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.OrgunitGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.OrgunitInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.OrgunitListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.OrgunitPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.OrgunitUpdateCall.html) -* [privileges](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Privilege.html) - * [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.PrivilegeListCall.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.OrgunitDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.OrgunitGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.OrgunitInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.OrgunitListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.OrgunitPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.OrgunitUpdateCall.html) +* [privileges](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Privilege.html) + * [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.PrivilegeListCall.html) * resources - * [*calendars delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ResourceCalendarDeleteCall.html), [*calendars get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ResourceCalendarGetCall.html), [*calendars insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ResourceCalendarInsertCall.html), [*calendars list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ResourceCalendarListCall.html), [*calendars patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ResourceCalendarPatchCall.html) and [*calendars update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.ResourceCalendarUpdateCall.html) -* [role assignments](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleAssignment.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleAssignmentDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleAssignmentGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleAssignmentInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleAssignmentListCall.html) -* [roles](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Role.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RolePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.RoleUpdateCall.html) -* [schemas](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Schema.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.SchemaDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.SchemaGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.SchemaInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.SchemaListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.SchemaPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.SchemaUpdateCall.html) -* [tokens](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Token.html) - * [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.TokenDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.TokenGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.TokenListCall.html) -* [users](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.User.html) - * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserAliaseListCall.html), [*aliases watch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserAliaseWatchCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserListCall.html), [*make admin*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserMakeAdminCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserPatchCall.html), [*photos delete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserPhotoDeleteCall.html), [*photos get*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserPhotoGetCall.html), [*photos patch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserPhotoPatchCall.html), [*photos update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserPhotoUpdateCall.html), [*undelete*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserUndeleteCall.html), [*update*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserUpdateCall.html) and [*watch*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserWatchCall.html) -* [verification codes](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.VerificationCode.html) - * [*generate*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.VerificationCodeGenerateCall.html), [*invalidate*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.VerificationCodeInvalidateCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.VerificationCodeListCall.html) + * [*calendars delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ResourceCalendarDeleteCall.html), [*calendars get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ResourceCalendarGetCall.html), [*calendars insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ResourceCalendarInsertCall.html), [*calendars list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ResourceCalendarListCall.html), [*calendars patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ResourceCalendarPatchCall.html) and [*calendars update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.ResourceCalendarUpdateCall.html) +* [role assignments](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleAssignment.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleAssignmentDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleAssignmentGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleAssignmentInsertCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleAssignmentListCall.html) +* [roles](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Role.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RolePatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.RoleUpdateCall.html) +* [schemas](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Schema.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.SchemaDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.SchemaGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.SchemaInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.SchemaListCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.SchemaPatchCall.html) and [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.SchemaUpdateCall.html) +* [tokens](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Token.html) + * [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.TokenDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.TokenGetCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.TokenListCall.html) +* [users](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.User.html) + * [*aliases delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserAliaseDeleteCall.html), [*aliases insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserAliaseInsertCall.html), [*aliases list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserAliaseListCall.html), [*aliases watch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserAliaseWatchCall.html), [*delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserDeleteCall.html), [*get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserGetCall.html), [*insert*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserInsertCall.html), [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserListCall.html), [*make admin*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserMakeAdminCall.html), [*patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserPatchCall.html), [*photos delete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserPhotoDeleteCall.html), [*photos get*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserPhotoGetCall.html), [*photos patch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserPhotoPatchCall.html), [*photos update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserPhotoUpdateCall.html), [*undelete*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserUndeleteCall.html), [*update*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserUpdateCall.html) and [*watch*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserWatchCall.html) +* [verification codes](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.VerificationCode.html) + * [*generate*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.VerificationCodeGenerateCall.html), [*invalidate*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.VerificationCodeInvalidateCall.html) and [*list*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.VerificationCodeListCall.html) Subscription supported by ... -* [*list users*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserListCall.html) -* [*watch users*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserWatchCall.html) -* [*aliases watch users*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserAliaseWatchCall.html) -* [*aliases list users*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.UserAliaseListCall.html) -* [*aliases list groups*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.GroupAliaseListCall.html) +* [*list users*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserListCall.html) +* [*watch users*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserWatchCall.html) +* [*aliases watch users*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserAliaseWatchCall.html) +* [*aliases list users*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.UserAliaseListCall.html) +* [*aliases list groups*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.GroupAliaseListCall.html) @@ -67,17 +67,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/struct.Directory.html)** +* **[Hub](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/struct.Directory.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.Part.html)** + * **[Parts](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -194,17 +194,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/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")`. @@ -214,29 +214,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/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](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/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](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.RequestValue.html) and -[decodable](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/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](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.RequestValue.html) and +[decodable](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/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](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/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](https://docs.rs/google-admin1_directory/1.0.5+20170419/google_admin1_directory/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-admin1_directory/1.0.6+20170419/google_admin1_directory/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/admin1_directory/src/lib.rs b/gen/admin1_directory/src/lib.rs index 13f186ebbb..019d2e4d46 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 *1.0.5+20170419*, where *20170419* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *directory* crate version *1.0.6+20170419*, where *20170419* is the exact revision of the *admin:directory_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *directory* *v1_directory* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/directory/). @@ -511,7 +511,7 @@ impl<'a, C, A> Directory Directory { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/admin/directory/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -576,7 +576,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/admin1_reports-cli/Cargo.toml b/gen/admin1_reports-cli/Cargo.toml index fbbd2f81f4..d00d720337 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 = "1.0.5+20170320" +version = "1.0.6+20170320" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-admin1_reports] path = "../admin1_reports" -version = "1.0.5+20170320" +version = "1.0.6+20170320" diff --git a/gen/admin1_reports-cli/README.md b/gen/admin1_reports-cli/README.md index dff3b52ae2..e96320608f 100644 --- a/gen/admin1_reports-cli/README.md +++ b/gen/admin1_reports-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *reports* API at revision *20170320*. The CLI is at version *1.0.5*. +This documentation was generated from the *reports* API at revision *20170320*. The CLI is at version *1.0.6*. ```bash admin1-reports [options] diff --git a/gen/admin1_reports-cli/mkdocs.yml b/gen/admin1_reports-cli/mkdocs.yml index 7e6c13a383..4c3f6e89dc 100644 --- a/gen/admin1_reports-cli/mkdocs.yml +++ b/gen/admin1_reports-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: reports v1.0.5+20170320 +site_name: reports v1.0.6+20170320 site_url: http://byron.github.io/google-apis-rs/google-admin1_reports-cli site_description: A complete library to interact with reports (protocol reports_v1) diff --git a/gen/admin1_reports-cli/src/cmn.rs b/gen/admin1_reports-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/admin1_reports-cli/src/cmn.rs +++ b/gen/admin1_reports-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/admin1_reports-cli/src/main.rs b/gen/admin1_reports-cli/src/main.rs index 06008df718..6837696403 100644 --- a/gen/admin1_reports-cli/src/main.rs +++ b/gen/admin1_reports-cli/src/main.rs @@ -736,7 +736,7 @@ fn main() { let mut app = App::new("admin1-reports") .author("Sebastian Thiel ") - .version("1.0.5+20170320") + .version("1.0.6+20170320") .about("Fetches reports for the administrators of G Suite customers 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") diff --git a/gen/admin1_reports/Cargo.toml b/gen/admin1_reports/Cargo.toml index 2c00505995..8ec55d76d1 100644 --- a/gen/admin1_reports/Cargo.toml +++ b/gen/admin1_reports/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-admin1_reports" -version = "1.0.5+20170320" +version = "1.0.6+20170320" 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" homepage = "https://developers.google.com/admin-sdk/reports/" -documentation = "https://docs.rs/google-admin1_reports/1.0.5+20170320" +documentation = "https://docs.rs/google-admin1_reports/1.0.6+20170320" license = "MIT" keywords = ["admin", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/admin1_reports/README.md b/gen/admin1_reports/README.md index 61ca5132ad..5804027228 100644 --- a/gen/admin1_reports/README.md +++ b/gen/admin1_reports/README.md @@ -5,28 +5,28 @@ 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 *1.0.5+20170320*, where *20170320* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *reports* crate version *1.0.6+20170320*, where *20170320* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *reports* *v1_reports* API can be found at the [official documentation site](https://developers.google.com/admin-sdk/reports/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.Reports.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.Reports.html) ... -* [activities](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.Activity.html) - * [*list*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.ActivityListCall.html) and [*watch*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.ActivityWatchCall.html) -* [channels](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.Channel.html) - * [*stop*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.ChannelStopCall.html) +* [activities](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.Activity.html) + * [*list*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.ActivityListCall.html) and [*watch*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.ActivityWatchCall.html) +* [channels](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.Channel.html) + * [*stop*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.ChannelStopCall.html) * customer usage reports - * [*get*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.CustomerUsageReportGetCall.html) + * [*get*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.CustomerUsageReportGetCall.html) * user usage report - * [*get*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.UserUsageReportGetCall.html) + * [*get*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.UserUsageReportGetCall.html) Subscription supported by ... -* [*watch activities*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.ActivityWatchCall.html) -* [*list activities*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.ActivityListCall.html) +* [*watch activities*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.ActivityWatchCall.html) +* [*list activities*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.ActivityListCall.html) @@ -34,17 +34,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/struct.Reports.html)** +* **[Hub](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/struct.Reports.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.Part.html)** + * **[Parts](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -142,17 +142,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/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")`. @@ -162,29 +162,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/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](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/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](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.RequestValue.html) and -[decodable](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/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](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.RequestValue.html) and +[decodable](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/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](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/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](https://docs.rs/google-admin1_reports/1.0.5+20170320/google_admin1_reports/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-admin1_reports/1.0.6+20170320/google_admin1_reports/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/admin1_reports/src/lib.rs b/gen/admin1_reports/src/lib.rs index f4e144e994..68dc717038 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 *1.0.5+20170320*, where *20170320* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *reports* crate version *1.0.6+20170320*, where *20170320* is the exact revision of the *admin:reports_v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *reports* *v1_reports* API can be found at the //! [official documentation site](https://developers.google.com/admin-sdk/reports/). @@ -355,7 +355,7 @@ impl<'a, C, A> Reports Reports { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/admin/reports/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -375,7 +375,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/adsense1d4-cli/Cargo.toml b/gen/adsense1d4-cli/Cargo.toml index 903b5c6102..ef59e0de44 100644 --- a/gen/adsense1d4-cli/Cargo.toml +++ b/gen/adsense1d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsense1d4-cli" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-adsense1d4] path = "../adsense1d4" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/adsense1d4-cli/README.md b/gen/adsense1d4-cli/README.md index 05cc30ae3e..f8bb738945 100644 --- a/gen/adsense1d4-cli/README.md +++ b/gen/adsense1d4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdSense* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *AdSense* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash adsense1d4 [options] diff --git a/gen/adsense1d4-cli/mkdocs.yml b/gen/adsense1d4-cli/mkdocs.yml index 4a7863c8d6..d41e124a60 100644 --- a/gen/adsense1d4-cli/mkdocs.yml +++ b/gen/adsense1d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense v1.0.5+20170517 +site_name: AdSense v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-adsense1d4-cli site_description: A complete library to interact with AdSense (protocol v1.4) diff --git a/gen/adsense1d4-cli/src/cmn.rs b/gen/adsense1d4-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/adsense1d4-cli/src/cmn.rs +++ b/gen/adsense1d4-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/adsense1d4-cli/src/main.rs b/gen/adsense1d4-cli/src/main.rs index 8aaba0166a..4f9c0c7c12 100644 --- a/gen/adsense1d4-cli/src/main.rs +++ b/gen/adsense1d4-cli/src/main.rs @@ -3481,7 +3481,7 @@ fn main() { let mut app = App::new("adsense1d4") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .about("Accesses AdSense publishers' inventory and generates performance 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") diff --git a/gen/adsense1d4/Cargo.toml b/gen/adsense1d4/Cargo.toml index 998c7629c1..751cb4d84e 100644 --- a/gen/adsense1d4/Cargo.toml +++ b/gen/adsense1d4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adsense1d4" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" homepage = "https://developers.google.com/adsense/management/" -documentation = "https://docs.rs/google-adsense1d4/1.0.5+20170517" +documentation = "https://docs.rs/google-adsense1d4/1.0.6+20170517" license = "MIT" keywords = ["adsense", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/adsense1d4/README.md b/gen/adsense1d4/README.md index bc7ec93947..f4781e9035 100644 --- a/gen/adsense1d4/README.md +++ b/gen/adsense1d4/README.md @@ -5,40 +5,40 @@ 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *AdSense* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *AdSense* *v1d4* API can be found at the [official documentation site](https://developers.google.com/adsense/management/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdSense.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdSense.html) ... -* [accounts](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.Account.html) - * [*adclients list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAdclientListCall.html), [*adunits customchannels list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAdunitCustomchannelListCall.html), [*adunits get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAdunitGetAdCodeCall.html), [*adunits list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAdunitListCall.html), [*alerts delete*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAlertDeleteCall.html), [*alerts list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountAlertListCall.html), [*customchannels adunits list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountCustomchannelAdunitListCall.html), [*customchannels get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountCustomchannelGetCall.html), [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountListCall.html), [*payments list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountPaymentListCall.html), [*reports generate*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountReportGenerateCall.html), [*reports saved generate*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountReportSavedGenerateCall.html), [*reports saved list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountReportSavedListCall.html), [*savedadstyles get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountSavedadstyleGetCall.html), [*savedadstyles list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountSavedadstyleListCall.html) and [*urlchannels list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountUrlchannelListCall.html) +* [accounts](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.Account.html) + * [*adclients list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAdclientListCall.html), [*adunits customchannels list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAdunitCustomchannelListCall.html), [*adunits get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAdunitGetAdCodeCall.html), [*adunits list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAdunitListCall.html), [*alerts delete*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAlertDeleteCall.html), [*alerts list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountAlertListCall.html), [*customchannels adunits list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountCustomchannelAdunitListCall.html), [*customchannels get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountCustomchannelGetCall.html), [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountListCall.html), [*payments list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountPaymentListCall.html), [*reports generate*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountReportGenerateCall.html), [*reports saved generate*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountReportSavedGenerateCall.html), [*reports saved list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountReportSavedListCall.html), [*savedadstyles get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountSavedadstyleGetCall.html), [*savedadstyles list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountSavedadstyleListCall.html) and [*urlchannels list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountUrlchannelListCall.html) * adclients - * [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdclientListCall.html) + * [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdclientListCall.html) * adunits - * [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdunitCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdunitGetCall.html), [*get ad code*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdunitGetAdCodeCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdunitListCall.html) -* [alerts](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.Alert.html) - * [*delete*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AlertDeleteCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AlertListCall.html) + * [*customchannels list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdunitCustomchannelListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdunitGetCall.html), [*get ad code*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdunitGetAdCodeCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdunitListCall.html) +* [alerts](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.Alert.html) + * [*delete*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AlertDeleteCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AlertListCall.html) * customchannels - * [*adunits list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.CustomchannelAdunitListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.CustomchannelGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.CustomchannelListCall.html) -* [metadata](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.Metadata.html) - * [*dimensions list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.MetadataDimensionListCall.html) and [*metrics list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.MetadataMetricListCall.html) -* [payments](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.Payment.html) - * [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.PaymentListCall.html) + * [*adunits list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.CustomchannelAdunitListCall.html), [*get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.CustomchannelGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.CustomchannelListCall.html) +* [metadata](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.Metadata.html) + * [*dimensions list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.MetadataDimensionListCall.html) and [*metrics list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.MetadataMetricListCall.html) +* [payments](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.Payment.html) + * [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.PaymentListCall.html) * reports - * [*generate*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.ReportGenerateCall.html), [*saved generate*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.ReportSavedGenerateCall.html) and [*saved list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.ReportSavedListCall.html) + * [*generate*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.ReportGenerateCall.html), [*saved generate*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.ReportSavedGenerateCall.html) and [*saved list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.ReportSavedListCall.html) * savedadstyles - * [*get*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.SavedadstyleGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.SavedadstyleListCall.html) + * [*get*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.SavedadstyleGetCall.html) and [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.SavedadstyleListCall.html) * urlchannels - * [*list*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.UrlchannelListCall.html) + * [*list*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.UrlchannelListCall.html) Download supported by ... -* [*generate reports*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.ReportGenerateCall.html) -* [*reports generate accounts*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AccountReportGenerateCall.html) +* [*generate reports*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.ReportGenerateCall.html) +* [*reports generate accounts*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AccountReportGenerateCall.html) @@ -46,17 +46,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/struct.AdSense.html)** +* **[Hub](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/struct.AdSense.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.Part.html)** + * **[Parts](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -166,17 +166,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/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")`. @@ -186,29 +186,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/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](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/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](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/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](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/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](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/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](https://docs.rs/google-adsense1d4/1.0.5+20170517/google_adsense1d4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adsense1d4/1.0.6+20170517/google_adsense1d4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adsense1d4/src/lib.rs b/gen/adsense1d4/src/lib.rs index b60a9556b3..3708477361 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *AdSense* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *adsense:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *AdSense* *v1d4* API can be found at the //! [official documentation site](https://developers.google.com/adsense/management/). @@ -374,7 +374,7 @@ impl<'a, C, A> AdSense AdSense { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/adsense/v1.4/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -412,7 +412,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/adsensehost4d1-cli/Cargo.toml b/gen/adsensehost4d1-cli/Cargo.toml index dfcdfd5457..355c943173 100644 --- a/gen/adsensehost4d1-cli/Cargo.toml +++ b/gen/adsensehost4d1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-adsensehost4d1-cli" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-adsensehost4d1] path = "../adsensehost4d1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/adsensehost4d1-cli/README.md b/gen/adsensehost4d1-cli/README.md index 7e2cd1f51d..a5e8e94cac 100644 --- a/gen/adsensehost4d1-cli/README.md +++ b/gen/adsensehost4d1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *AdSense Host* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *AdSense Host* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash adsensehost4d1 [options] diff --git a/gen/adsensehost4d1-cli/mkdocs.yml b/gen/adsensehost4d1-cli/mkdocs.yml index 6e47493912..0c52912517 100644 --- a/gen/adsensehost4d1-cli/mkdocs.yml +++ b/gen/adsensehost4d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: AdSense Host v1.0.5+20170517 +site_name: AdSense Host v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-adsensehost4d1-cli site_description: A complete library to interact with AdSense Host (protocol v4.1) diff --git a/gen/adsensehost4d1-cli/src/cmn.rs b/gen/adsensehost4d1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/adsensehost4d1-cli/src/cmn.rs +++ b/gen/adsensehost4d1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/adsensehost4d1-cli/src/main.rs b/gen/adsensehost4d1-cli/src/main.rs index 2856a0d522..b30e18b503 100644 --- a/gen/adsensehost4d1-cli/src/main.rs +++ b/gen/adsensehost4d1-cli/src/main.rs @@ -2762,7 +2762,7 @@ fn main() { let mut app = App::new("adsensehost4d1") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .about("Generates performance reports, generates ad codes, and provides publisher management capabilities for AdSense Hosts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adsensehost4d1_cli") .arg(Arg::with_name("url") diff --git a/gen/adsensehost4d1/Cargo.toml b/gen/adsensehost4d1/Cargo.toml index ef43cb83ce..ac0d2da11d 100644 --- a/gen/adsensehost4d1/Cargo.toml +++ b/gen/adsensehost4d1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-adsensehost4d1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" homepage = "https://developers.google.com/adsense/host/" -documentation = "https://docs.rs/google-adsensehost4d1/1.0.5+20170517" +documentation = "https://docs.rs/google-adsensehost4d1/1.0.6+20170517" license = "MIT" keywords = ["adsensehost", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/adsensehost4d1/README.md b/gen/adsensehost4d1/README.md index 17f23eb207..d05a732156 100644 --- a/gen/adsensehost4d1/README.md +++ b/gen/adsensehost4d1/README.md @@ -5,26 +5,26 @@ 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *AdSense Host* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *AdSense Host* *v4d1* API can be found at the [official documentation site](https://developers.google.com/adsense/host/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AdSenseHost.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AdSenseHost.html) ... -* [accounts](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.Account.html) - * [*adclients get*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdclientGetCall.html), [*adclients list*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdclientListCall.html), [*adunits delete*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitDeleteCall.html), [*adunits get*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitGetAdCodeCall.html), [*adunits insert*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitInsertCall.html), [*adunits list*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitListCall.html), [*adunits patch*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitPatchCall.html), [*adunits update*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountAdunitUpdateCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountListCall.html) and [*reports generate*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AccountReportGenerateCall.html) +* [accounts](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.Account.html) + * [*adclients get*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdclientGetCall.html), [*adclients list*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdclientListCall.html), [*adunits delete*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitDeleteCall.html), [*adunits get*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitGetCall.html), [*adunits get ad code*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitGetAdCodeCall.html), [*adunits insert*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitInsertCall.html), [*adunits list*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitListCall.html), [*adunits patch*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitPatchCall.html), [*adunits update*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountAdunitUpdateCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountListCall.html) and [*reports generate*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AccountReportGenerateCall.html) * adclients - * [*get*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AdclientGetCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AdclientListCall.html) + * [*get*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AdclientGetCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AdclientListCall.html) * associationsessions - * [*start*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AssociationsessionStartCall.html) and [*verify*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AssociationsessionVerifyCall.html) + * [*start*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AssociationsessionStartCall.html) and [*verify*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AssociationsessionVerifyCall.html) * customchannels - * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.CustomchannelDeleteCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.CustomchannelGetCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.CustomchannelInsertCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.CustomchannelListCall.html), [*patch*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.CustomchannelPatchCall.html) and [*update*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.CustomchannelUpdateCall.html) -* [reports](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.Report.html) - * [*generate*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.ReportGenerateCall.html) + * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.CustomchannelDeleteCall.html), [*get*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.CustomchannelGetCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.CustomchannelInsertCall.html), [*list*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.CustomchannelListCall.html), [*patch*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.CustomchannelPatchCall.html) and [*update*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.CustomchannelUpdateCall.html) +* [reports](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.Report.html) + * [*generate*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.ReportGenerateCall.html) * urlchannels - * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.UrlchannelDeleteCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.UrlchannelInsertCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.UrlchannelListCall.html) + * [*delete*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.UrlchannelDeleteCall.html), [*insert*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.UrlchannelInsertCall.html) and [*list*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.UrlchannelListCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/struct.AdSenseHost.html)** +* **[Hub](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/struct.AdSenseHost.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.Part.html)** + * **[Parts](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -144,17 +144,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/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")`. @@ -164,29 +164,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/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](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/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](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/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](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/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](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/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](https://docs.rs/google-adsensehost4d1/1.0.5+20170517/google_adsensehost4d1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-adsensehost4d1/1.0.6+20170517/google_adsensehost4d1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/adsensehost4d1/src/lib.rs b/gen/adsensehost4d1/src/lib.rs index 1443b2dfc9..f7da075098 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *AdSense Host* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *adsensehost:v4.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *AdSense Host* *v4d1* API can be found at the //! [official documentation site](https://developers.google.com/adsense/host/). @@ -346,7 +346,7 @@ impl<'a, C, A> AdSenseHost AdSenseHost { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/adsensehost/v4.1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -372,7 +372,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/analytics3-cli/Cargo.toml b/gen/analytics3-cli/Cargo.toml index c6c7e06e9c..283399d8ca 100644 --- a/gen/analytics3-cli/Cargo.toml +++ b/gen/analytics3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-analytics3-cli" -version = "1.0.5+20170321" +version = "1.0.6+20170321" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-analytics3] path = "../analytics3" -version = "1.0.5+20170321" +version = "1.0.6+20170321" diff --git a/gen/analytics3-cli/README.md b/gen/analytics3-cli/README.md index 8f5b8ccb3f..ab8effe83c 100644 --- a/gen/analytics3-cli/README.md +++ b/gen/analytics3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *analytics* API at revision *20170321*. The CLI is at version *1.0.5*. +This documentation was generated from the *analytics* API at revision *20170321*. The CLI is at version *1.0.6*. ```bash analytics3 [options] diff --git a/gen/analytics3-cli/mkdocs.yml b/gen/analytics3-cli/mkdocs.yml index a051621116..d8abc1dee1 100644 --- a/gen/analytics3-cli/mkdocs.yml +++ b/gen/analytics3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: analytics v1.0.5+20170321 +site_name: analytics v1.0.6+20170321 site_url: http://byron.github.io/google-apis-rs/google-analytics3-cli site_description: A complete library to interact with analytics (protocol v3) diff --git a/gen/analytics3-cli/src/cmn.rs b/gen/analytics3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/analytics3-cli/src/cmn.rs +++ b/gen/analytics3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/analytics3-cli/src/main.rs b/gen/analytics3-cli/src/main.rs index 7d73c9b980..9dc68823ab 100644 --- a/gen/analytics3-cli/src/main.rs +++ b/gen/analytics3-cli/src/main.rs @@ -10022,7 +10022,7 @@ fn main() { let mut app = App::new("analytics3") .author("Sebastian Thiel ") - .version("1.0.5+20170321") + .version("1.0.6+20170321") .about("Views and manages 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") diff --git a/gen/analytics3/Cargo.toml b/gen/analytics3/Cargo.toml index 7d66feedc6..6061abb568 100644 --- a/gen/analytics3/Cargo.toml +++ b/gen/analytics3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-analytics3" -version = "1.0.5+20170321" +version = "1.0.6+20170321" 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" homepage = "https://developers.google.com/analytics/" -documentation = "https://docs.rs/google-analytics3/1.0.5+20170321" +documentation = "https://docs.rs/google-analytics3/1.0.6+20170321" license = "MIT" keywords = ["analytics", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/analytics3/README.md b/gen/analytics3/README.md index baae4a1f17..293c8ddd30 100644 --- a/gen/analytics3/README.md +++ b/gen/analytics3/README.md @@ -5,27 +5,27 @@ 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 *1.0.5+20170321*, where *20170321* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *analytics* crate version *1.0.6+20170321*, where *20170321* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *analytics* *v3* API can be found at the [official documentation site](https://developers.google.com/analytics/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.Analytics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.Analytics.html) ... * data - * [*ga get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.DataGaGetCall.html), [*mcf get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.DataMcfGetCall.html) and [*realtime get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.DataRealtimeGetCall.html) + * [*ga get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.DataGaGetCall.html), [*mcf get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.DataMcfGetCall.html) and [*realtime get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.DataRealtimeGetCall.html) * management - * [*account summaries list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementAccountSummaryListCall.html), [*account user links delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementAccountUserLinkListCall.html), [*account user links update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementAccountListCall.html), [*custom data sources list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementExperimentDeleteCall.html), [*experiments get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementExperimentGetCall.html), [*experiments insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementExperimentInsertCall.html), [*experiments list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementExperimentListCall.html), [*experiments patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementExperimentPatchCall.html), [*experiments update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementExperimentUpdateCall.html), [*filters delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementFilterDeleteCall.html), [*filters get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementFilterGetCall.html), [*filters insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementFilterInsertCall.html), [*filters list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementFilterListCall.html), [*filters patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementFilterPatchCall.html), [*filters update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementFilterUpdateCall.html), [*goals get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementGoalGetCall.html), [*goals insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementGoalInsertCall.html), [*goals list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementGoalListCall.html), [*goals patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementGoalPatchCall.html), [*goals update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileDeleteCall.html), [*profiles get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileGetCall.html), [*profiles insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileInsertCall.html), [*profiles list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileListCall.html), [*profiles patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfilePatchCall.html), [*profiles update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementProfileUpdateCall.html), [*remarketing audience delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementRemarketingAudienceDeleteCall.html), [*remarketing audience get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementRemarketingAudienceGetCall.html), [*remarketing audience insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementRemarketingAudienceInsertCall.html), [*remarketing audience list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementRemarketingAudienceListCall.html), [*remarketing audience patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementRemarketingAudiencePatchCall.html), [*remarketing audience update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementRemarketingAudienceUpdateCall.html), [*segments list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementSegmentListCall.html), [*unsampled reports delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUnsampledReportDeleteCall.html), [*unsampled reports get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUploadGetCall.html), [*uploads list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUploadListCall.html), [*uploads upload data*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyListCall.html), [*webproperties patch*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkUpdateCall.html) + * [*account summaries list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementAccountSummaryListCall.html), [*account user links delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementAccountUserLinkDeleteCall.html), [*account user links insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementAccountUserLinkInsertCall.html), [*account user links list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementAccountUserLinkListCall.html), [*account user links update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementAccountUserLinkUpdateCall.html), [*accounts list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementAccountListCall.html), [*custom data sources list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomDataSourceListCall.html), [*custom dimensions get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomDimensionGetCall.html), [*custom dimensions insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomDimensionInsertCall.html), [*custom dimensions list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomDimensionListCall.html), [*custom dimensions patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomDimensionPatchCall.html), [*custom dimensions update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomDimensionUpdateCall.html), [*custom metrics get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomMetricGetCall.html), [*custom metrics insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomMetricInsertCall.html), [*custom metrics list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomMetricListCall.html), [*custom metrics patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomMetricPatchCall.html), [*custom metrics update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementCustomMetricUpdateCall.html), [*experiments delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementExperimentDeleteCall.html), [*experiments get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementExperimentGetCall.html), [*experiments insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementExperimentInsertCall.html), [*experiments list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementExperimentListCall.html), [*experiments patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementExperimentPatchCall.html), [*experiments update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementExperimentUpdateCall.html), [*filters delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementFilterDeleteCall.html), [*filters get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementFilterGetCall.html), [*filters insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementFilterInsertCall.html), [*filters list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementFilterListCall.html), [*filters patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementFilterPatchCall.html), [*filters update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementFilterUpdateCall.html), [*goals get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementGoalGetCall.html), [*goals insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementGoalInsertCall.html), [*goals list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementGoalListCall.html), [*goals patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementGoalPatchCall.html), [*goals update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementGoalUpdateCall.html), [*profile filter links delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileFilterLinkDeleteCall.html), [*profile filter links get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileFilterLinkGetCall.html), [*profile filter links insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileFilterLinkInsertCall.html), [*profile filter links list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileFilterLinkListCall.html), [*profile filter links patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileFilterLinkPatchCall.html), [*profile filter links update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileFilterLinkUpdateCall.html), [*profile user links delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileUserLinkDeleteCall.html), [*profile user links insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileUserLinkInsertCall.html), [*profile user links list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileUserLinkListCall.html), [*profile user links update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileUserLinkUpdateCall.html), [*profiles delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileDeleteCall.html), [*profiles get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileGetCall.html), [*profiles insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileInsertCall.html), [*profiles list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileListCall.html), [*profiles patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfilePatchCall.html), [*profiles update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementProfileUpdateCall.html), [*remarketing audience delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementRemarketingAudienceDeleteCall.html), [*remarketing audience get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementRemarketingAudienceGetCall.html), [*remarketing audience insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementRemarketingAudienceInsertCall.html), [*remarketing audience list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementRemarketingAudienceListCall.html), [*remarketing audience patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementRemarketingAudiencePatchCall.html), [*remarketing audience update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementRemarketingAudienceUpdateCall.html), [*segments list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementSegmentListCall.html), [*unsampled reports delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUnsampledReportDeleteCall.html), [*unsampled reports get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUnsampledReportGetCall.html), [*unsampled reports insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUnsampledReportInsertCall.html), [*unsampled reports list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUnsampledReportListCall.html), [*uploads delete upload data*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUploadDeleteUploadDataCall.html), [*uploads get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUploadGetCall.html), [*uploads list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUploadListCall.html), [*uploads upload data*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUploadUploadDataCall.html), [*web property ad words links delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkDeleteCall.html), [*web property ad words links get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkGetCall.html), [*web property ad words links insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkInsertCall.html), [*web property ad words links list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkListCall.html), [*web property ad words links patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkPatchCall.html), [*web property ad words links update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebPropertyAdWordsLinkUpdateCall.html), [*webproperties get*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyGetCall.html), [*webproperties insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyInsertCall.html), [*webproperties list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyListCall.html), [*webproperties patch*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyPatchCall.html), [*webproperties update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyUpdateCall.html), [*webproperty user links delete*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkDeleteCall.html), [*webproperty user links insert*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkInsertCall.html), [*webproperty user links list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkListCall.html) and [*webproperty user links update*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementWebpropertyUserLinkUpdateCall.html) * metadata - * [*columns list*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.MetadataColumnListCall.html) + * [*columns list*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.MetadataColumnListCall.html) * provisioning - * [*create account ticket*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ProvisioningCreateAccountTicketCall.html) + * [*create account ticket*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ProvisioningCreateAccountTicketCall.html) Upload supported by ... -* [*uploads upload data management*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.ManagementUploadUploadDataCall.html) +* [*uploads upload data management*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.ManagementUploadUploadDataCall.html) @@ -33,17 +33,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/struct.Analytics.html)** +* **[Hub](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/struct.Analytics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.Part.html)** + * **[Parts](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -137,17 +137,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/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")`. @@ -157,29 +157,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/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](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/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](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/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](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/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](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/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](https://docs.rs/google-analytics3/1.0.5+20170321/google_analytics3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-analytics3/1.0.6+20170321/google_analytics3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/analytics3/src/lib.rs b/gen/analytics3/src/lib.rs index e283a80d1d..e0bd0ecedd 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 *1.0.5+20170321*, where *20170321* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *analytics* crate version *1.0.6+20170321*, where *20170321* is the exact revision of the *analytics:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *analytics* *v3* API can be found at the //! [official documentation site](https://developers.google.com/analytics/). @@ -358,7 +358,7 @@ impl<'a, C, A> Analytics Analytics { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/analytics/v3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -378,7 +378,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/androidenterprise1-cli/Cargo.toml b/gen/androidenterprise1-cli/Cargo.toml index 778bc18446..eefd19c320 100644 --- a/gen/androidenterprise1-cli/Cargo.toml +++ b/gen/androidenterprise1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidenterprise1-cli" -version = "1.0.5+20170516" +version = "1.0.6+20170516" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-androidenterprise1] path = "../androidenterprise1" -version = "1.0.5+20170516" +version = "1.0.6+20170516" diff --git a/gen/androidenterprise1-cli/README.md b/gen/androidenterprise1-cli/README.md index 299e689e12..0304dd2c85 100644 --- a/gen/androidenterprise1-cli/README.md +++ b/gen/androidenterprise1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Enterprise* API at revision *20170516*. The CLI is at version *1.0.5*. +This documentation was generated from the *Android Enterprise* API at revision *20170516*. The CLI is at version *1.0.6*. ```bash androidenterprise1 [options] diff --git a/gen/androidenterprise1-cli/mkdocs.yml b/gen/androidenterprise1-cli/mkdocs.yml index 48523142b2..fa71eec977 100644 --- a/gen/androidenterprise1-cli/mkdocs.yml +++ b/gen/androidenterprise1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Enterprise v1.0.5+20170516 +site_name: Android Enterprise v1.0.6+20170516 site_url: http://byron.github.io/google-apis-rs/google-androidenterprise1-cli site_description: A complete library to interact with Android Enterprise (protocol v1) diff --git a/gen/androidenterprise1-cli/src/cmn.rs b/gen/androidenterprise1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/androidenterprise1-cli/src/cmn.rs +++ b/gen/androidenterprise1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/androidenterprise1-cli/src/main.rs b/gen/androidenterprise1-cli/src/main.rs index bbaad277c8..c74d36e3df 100644 --- a/gen/androidenterprise1-cli/src/main.rs +++ b/gen/androidenterprise1-cli/src/main.rs @@ -7687,7 +7687,7 @@ fn main() { let mut app = App::new("androidenterprise1") .author("Sebastian Thiel ") - .version("1.0.5+20170516") + .version("1.0.6+20170516") .about("Manages 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") diff --git a/gen/androidenterprise1/Cargo.toml b/gen/androidenterprise1/Cargo.toml index e57b824dd8..47bdb67820 100644 --- a/gen/androidenterprise1/Cargo.toml +++ b/gen/androidenterprise1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androidenterprise1" -version = "1.0.5+20170516" +version = "1.0.6+20170516" 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/android/work/play/emm-api" -documentation = "https://docs.rs/google-androidenterprise1/1.0.5+20170516" +documentation = "https://docs.rs/google-androidenterprise1/1.0.6+20170516" license = "MIT" keywords = ["androidenterprise", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/androidenterprise1/README.md b/gen/androidenterprise1/README.md index 174d916fde..93e078ee1b 100644 --- a/gen/androidenterprise1/README.md +++ b/gen/androidenterprise1/README.md @@ -5,42 +5,42 @@ 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 *1.0.5+20170516*, where *20170516* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Android Enterprise* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Android Enterprise* *v1* API can be found at the [official documentation site](https://developers.google.com/android/work/play/emm-api). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.AndroidEnterprise.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.AndroidEnterprise.html) ... -* [devices](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.Device.html) - * [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.DeviceGetCall.html), [*get state*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.DeviceGetStateCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.DeviceListCall.html) and [*set state*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.DeviceSetStateCall.html) -* [enterprises](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.Enterprise.html) - * [*acknowledge notification set*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseCompleteSignupCall.html), [*create web token*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseCreateWebTokenCall.html), [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseDeleteCall.html), [*enroll*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*generate signup url*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseGenerateSignupUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get service account*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseListCall.html), [*pull notification set*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set store layout*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) -* [entitlements](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.Entitlement.html) - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EntitlementDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EntitlementGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EntitlementListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EntitlementPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.EntitlementUpdateCall.html) +* [devices](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.Device.html) + * [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.DeviceGetCall.html), [*get state*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.DeviceGetStateCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.DeviceListCall.html) and [*set state*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.DeviceSetStateCall.html) +* [enterprises](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.Enterprise.html) + * [*acknowledge notification set*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseAcknowledgeNotificationSetCall.html), [*complete signup*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseCompleteSignupCall.html), [*create web token*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseCreateWebTokenCall.html), [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseDeleteCall.html), [*enroll*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseEnrollCall.html), [*generate signup url*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseGenerateSignupUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseGetCall.html), [*get service account*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseGetServiceAccountCall.html), [*get store layout*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseGetStoreLayoutCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseListCall.html), [*pull notification set*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterprisePullNotificationSetCall.html), [*send test push notification*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseSendTestPushNotificationCall.html), [*set account*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseSetAccountCall.html), [*set store layout*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseSetStoreLayoutCall.html) and [*unenroll*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EnterpriseUnenrollCall.html) +* [entitlements](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.Entitlement.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EntitlementDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EntitlementGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EntitlementListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EntitlementPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.EntitlementUpdateCall.html) * grouplicenses - * [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.GrouplicenseGetCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.GrouplicenseListCall.html) + * [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.GrouplicenseGetCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.GrouplicenseListCall.html) * grouplicenseusers - * [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.GrouplicenseuserListCall.html) -* [installs](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.Install.html) - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.InstallDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.InstallGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.InstallListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.InstallPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.InstallUpdateCall.html) + * [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.GrouplicenseuserListCall.html) +* [installs](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.Install.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.InstallDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.InstallGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.InstallListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.InstallPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.InstallUpdateCall.html) * managedconfigurationsfordevice - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordevicePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordevicePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsfordeviceUpdateCall.html) * managedconfigurationsforuser - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserUpdateCall.html) -* [permissions](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.Permission.html) - * [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.PermissionGetCall.html) -* [products](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.Product.html) - * [*approve*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductApproveCall.html), [*generate approval url*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductGenerateApprovalUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductGetCall.html), [*get app restrictions schema*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductGetAppRestrictionsSchemaCall.html), [*get permissions*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductGetPermissionCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductListCall.html) and [*unapprove*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ProductUnapproveCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserGetCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ManagedconfigurationsforuserUpdateCall.html) +* [permissions](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.Permission.html) + * [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.PermissionGetCall.html) +* [products](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.Product.html) + * [*approve*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductApproveCall.html), [*generate approval url*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductGenerateApprovalUrlCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductGetCall.html), [*get app restrictions schema*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductGetAppRestrictionsSchemaCall.html), [*get permissions*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductGetPermissionCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductListCall.html) and [*unapprove*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ProductUnapproveCall.html) * serviceaccountkeys - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ServiceaccountkeyDeleteCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ServiceaccountkeyInsertCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.ServiceaccountkeyListCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ServiceaccountkeyDeleteCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ServiceaccountkeyInsertCall.html) and [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.ServiceaccountkeyListCall.html) * storelayoutclusters - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutclusterDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutclusterGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutclusterInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutclusterListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutclusterPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutclusterUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutclusterDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutclusterGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutclusterInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutclusterListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutclusterPatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutclusterUpdateCall.html) * storelayoutpages - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutpageDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutpageGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutpageInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutpageListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutpagePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.StorelayoutpageUpdateCall.html) -* [users](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.User.html) - * [*delete*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserDeleteCall.html), [*generate authentication token*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserGenerateAuthenticationTokenCall.html), [*generate token*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserGenerateTokenCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserGetCall.html), [*get available product set*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserGetAvailableProductSetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserPatchCall.html), [*revoke token*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserRevokeTokenCall.html), [*set available product set*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserSetAvailableProductSetCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.UserUpdateCall.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutpageDeleteCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutpageGetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutpageInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutpageListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutpagePatchCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.StorelayoutpageUpdateCall.html) +* [users](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.User.html) + * [*delete*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserDeleteCall.html), [*generate authentication token*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserGenerateAuthenticationTokenCall.html), [*generate token*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserGenerateTokenCall.html), [*get*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserGetCall.html), [*get available product set*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserGetAvailableProductSetCall.html), [*insert*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserInsertCall.html), [*list*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserListCall.html), [*patch*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserPatchCall.html), [*revoke token*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserRevokeTokenCall.html), [*set available product set*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserSetAvailableProductSetCall.html) and [*update*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.UserUpdateCall.html) @@ -49,17 +49,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/struct.AndroidEnterprise.html)** +* **[Hub](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/struct.AndroidEnterprise.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.Part.html)** + * **[Parts](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -158,17 +158,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/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")`. @@ -178,29 +178,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/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](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/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](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/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](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/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](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/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](https://docs.rs/google-androidenterprise1/1.0.5+20170516/google_androidenterprise1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androidenterprise1/1.0.6+20170516/google_androidenterprise1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androidenterprise1/src/lib.rs b/gen/androidenterprise1/src/lib.rs index 3a36661766..7079c3ca5e 100644 --- a/gen/androidenterprise1/src/lib.rs +++ b/gen/androidenterprise1/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 Enterprise* crate version *1.0.5+20170516*, where *20170516* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Android Enterprise* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *androidenterprise:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Android Enterprise* *v1* API can be found at the //! [official documentation site](https://developers.google.com/android/work/play/emm-api). @@ -354,7 +354,7 @@ impl<'a, C, A> AndroidEnterprise AndroidEnterprise { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/androidenterprise/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -404,7 +404,7 @@ impl<'a, C, A> AndroidEnterprise } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/androidpublisher2-cli/Cargo.toml b/gen/androidpublisher2-cli/Cargo.toml index e402ddb401..5df07a26fc 100644 --- a/gen/androidpublisher2-cli/Cargo.toml +++ b/gen/androidpublisher2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-androidpublisher2-cli" -version = "1.0.5+20170425" +version = "1.0.6+20170425" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-androidpublisher2] path = "../androidpublisher2" -version = "1.0.5+20170425" +version = "1.0.6+20170425" diff --git a/gen/androidpublisher2-cli/README.md b/gen/androidpublisher2-cli/README.md index c83f9a61c7..a314ce8d57 100644 --- a/gen/androidpublisher2-cli/README.md +++ b/gen/androidpublisher2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Android Publisher* API at revision *20170425*. The CLI is at version *1.0.5*. +This documentation was generated from the *Android Publisher* API at revision *20170425*. The CLI is at version *1.0.6*. ```bash androidpublisher2 [options] diff --git a/gen/androidpublisher2-cli/mkdocs.yml b/gen/androidpublisher2-cli/mkdocs.yml index a35ac25c7b..ce2a4d41c1 100644 --- a/gen/androidpublisher2-cli/mkdocs.yml +++ b/gen/androidpublisher2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Android Publisher v1.0.5+20170425 +site_name: Android Publisher v1.0.6+20170425 site_url: http://byron.github.io/google-apis-rs/google-androidpublisher2-cli site_description: A complete library to interact with Android Publisher (protocol v2) diff --git a/gen/androidpublisher2-cli/src/cmn.rs b/gen/androidpublisher2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/androidpublisher2-cli/src/cmn.rs +++ b/gen/androidpublisher2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/androidpublisher2-cli/src/main.rs b/gen/androidpublisher2-cli/src/main.rs index a8db807a85..e34ac3a65d 100644 --- a/gen/androidpublisher2-cli/src/main.rs +++ b/gen/androidpublisher2-cli/src/main.rs @@ -5976,7 +5976,7 @@ fn main() { let mut app = App::new("androidpublisher2") .author("Sebastian Thiel ") - .version("1.0.5+20170425") + .version("1.0.6+20170425") .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") diff --git a/gen/androidpublisher2/Cargo.toml b/gen/androidpublisher2/Cargo.toml index 2370c572cd..875d680974 100644 --- a/gen/androidpublisher2/Cargo.toml +++ b/gen/androidpublisher2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-androidpublisher2" -version = "1.0.5+20170425" +version = "1.0.6+20170425" 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" homepage = "https://developers.google.com/android-publisher" -documentation = "https://docs.rs/google-androidpublisher2/1.0.5+20170425" +documentation = "https://docs.rs/google-androidpublisher2/1.0.6+20170425" license = "MIT" keywords = ["androidpublisher", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/androidpublisher2/README.md b/gen/androidpublisher2/README.md index 00cabb2878..432285521c 100644 --- a/gen/androidpublisher2/README.md +++ b/gen/androidpublisher2/README.md @@ -5,32 +5,32 @@ 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 *1.0.5+20170425*, where *20170425* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Android Publisher* crate version *1.0.6+20170425*, where *20170425* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Android Publisher* *v2* API can be found at the [official documentation site](https://developers.google.com/android-publisher). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.AndroidPublisher.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.AndroidPublisher.html) ... * edits - * [*apklistings delete*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApklistingDeleteallCall.html), [*apklistings get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApklistingGetCall.html), [*apklistings list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApklistingListCall.html), [*apklistings patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApklistingPatchCall.html), [*apklistings update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApkAddexternallyhostedCall.html), [*apks list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApkListCall.html), [*apks upload*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApkUploadCall.html), [*commit*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditCommitCall.html), [*delete*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html), [*details get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditDetailGetCall.html), [*details patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditDetailPatchCall.html), [*details update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditDetailUpdateCall.html), [*expansionfiles get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditExpansionfileUploadCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditGetCall.html), [*images delete*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditImageDeleteCall.html), [*images deleteall*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditImageDeleteallCall.html), [*images list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditImageListCall.html), [*images upload*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditImageUploadCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditInsertCall.html), [*listings delete*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditListingDeleteCall.html), [*listings deleteall*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditListingDeleteallCall.html), [*listings get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditListingGetCall.html), [*listings list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditListingListCall.html), [*listings patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditListingPatchCall.html), [*listings update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditListingUpdateCall.html), [*testers get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTesterGetCall.html), [*testers patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTesterPatchCall.html), [*testers update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTesterUpdateCall.html), [*tracks get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTrackGetCall.html), [*tracks list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTrackListCall.html), [*tracks patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTrackPatchCall.html), [*tracks update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditTrackUpdateCall.html) and [*validate*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditValidateCall.html) -* [entitlements](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.Entitlement.html) - * [*list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EntitlementListCall.html) + * [*apklistings delete*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApklistingDeleteCall.html), [*apklistings deleteall*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApklistingDeleteallCall.html), [*apklistings get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApklistingGetCall.html), [*apklistings list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApklistingListCall.html), [*apklistings patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApklistingPatchCall.html), [*apklistings update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApklistingUpdateCall.html), [*apks addexternallyhosted*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApkAddexternallyhostedCall.html), [*apks list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApkListCall.html), [*apks upload*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApkUploadCall.html), [*commit*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditCommitCall.html), [*delete*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditDeleteCall.html), [*deobfuscationfiles upload*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html), [*details get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditDetailGetCall.html), [*details patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditDetailPatchCall.html), [*details update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditDetailUpdateCall.html), [*expansionfiles get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditExpansionfileGetCall.html), [*expansionfiles patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditExpansionfilePatchCall.html), [*expansionfiles update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditExpansionfileUpdateCall.html), [*expansionfiles upload*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditExpansionfileUploadCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditGetCall.html), [*images delete*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditImageDeleteCall.html), [*images deleteall*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditImageDeleteallCall.html), [*images list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditImageListCall.html), [*images upload*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditImageUploadCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditInsertCall.html), [*listings delete*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditListingDeleteCall.html), [*listings deleteall*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditListingDeleteallCall.html), [*listings get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditListingGetCall.html), [*listings list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditListingListCall.html), [*listings patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditListingPatchCall.html), [*listings update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditListingUpdateCall.html), [*testers get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTesterGetCall.html), [*testers patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTesterPatchCall.html), [*testers update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTesterUpdateCall.html), [*tracks get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTrackGetCall.html), [*tracks list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTrackListCall.html), [*tracks patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTrackPatchCall.html), [*tracks update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditTrackUpdateCall.html) and [*validate*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditValidateCall.html) +* [entitlements](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.Entitlement.html) + * [*list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EntitlementListCall.html) * inappproducts - * [*batch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductBatchCall.html), [*delete*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductDeleteCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductGetCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductInsertCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductListCall.html), [*patch*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductPatchCall.html) and [*update*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.InappproductUpdateCall.html) + * [*batch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductBatchCall.html), [*delete*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductDeleteCall.html), [*get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductGetCall.html), [*insert*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductInsertCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductListCall.html), [*patch*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductPatchCall.html) and [*update*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.InappproductUpdateCall.html) * purchases - * [*products get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.PurchaseVoidedpurchaseListCall.html) -* [reviews](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.Review.html) - * [*get*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.ReviewGetCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.ReviewListCall.html) and [*reply*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.ReviewReplyCall.html) + * [*products get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseProductGetCall.html), [*subscriptions cancel*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseSubscriptionCancelCall.html), [*subscriptions defer*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseSubscriptionDeferCall.html), [*subscriptions get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseSubscriptionGetCall.html), [*subscriptions refund*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseSubscriptionRefundCall.html), [*subscriptions revoke*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseSubscriptionRevokeCall.html) and [*voidedpurchases list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.PurchaseVoidedpurchaseListCall.html) +* [reviews](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.Review.html) + * [*get*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.ReviewGetCall.html), [*list*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.ReviewListCall.html) and [*reply*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.ReviewReplyCall.html) Upload supported by ... -* [*deobfuscationfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html) -* [*images upload edits*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditImageUploadCall.html) -* [*expansionfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditExpansionfileUploadCall.html) -* [*apks upload edits*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.EditApkUploadCall.html) +* [*deobfuscationfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditDeobfuscationfileUploadCall.html) +* [*images upload edits*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditImageUploadCall.html) +* [*expansionfiles upload edits*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditExpansionfileUploadCall.html) +* [*apks upload edits*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.EditApkUploadCall.html) @@ -38,17 +38,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/struct.AndroidPublisher.html)** +* **[Hub](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/struct.AndroidPublisher.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.Part.html)** + * **[Parts](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -141,17 +141,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/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")`. @@ -161,29 +161,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/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](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/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](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/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](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/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](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/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](https://docs.rs/google-androidpublisher2/1.0.5+20170425/google_androidpublisher2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-androidpublisher2/1.0.6+20170425/google_androidpublisher2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/androidpublisher2/src/lib.rs b/gen/androidpublisher2/src/lib.rs index e717cd04e8..68e369c4d9 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 *1.0.5+20170425*, where *20170425* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Android Publisher* crate version *1.0.6+20170425*, where *20170425* is the exact revision of the *androidpublisher:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Android Publisher* *v2* API can be found at the //! [official documentation site](https://developers.google.com/android-publisher). @@ -343,7 +343,7 @@ impl<'a, C, A> AndroidPublisher AndroidPublisher { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/androidpublisher/v2/applications/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -366,7 +366,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/appengine1-cli/Cargo.toml b/gen/appengine1-cli/Cargo.toml index 302ac28263..6205e73977 100644 --- a/gen/appengine1-cli/Cargo.toml +++ b/gen/appengine1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1-cli" -version = "1.0.5+20170522" +version = "1.0.6+20170522" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-appengine1] path = "../appengine1" -version = "1.0.5+20170522" +version = "1.0.6+20170522" diff --git a/gen/appengine1-cli/README.md b/gen/appengine1-cli/README.md index 807c94c842..3d706ded47 100644 --- a/gen/appengine1-cli/README.md +++ b/gen/appengine1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20170522*. The CLI is at version *1.0.5*. +This documentation was generated from the *appengine* API at revision *20170522*. The CLI is at version *1.0.6*. ```bash appengine1 [options] diff --git a/gen/appengine1-cli/mkdocs.yml b/gen/appengine1-cli/mkdocs.yml index b50ae30efd..d62679c054 100644 --- a/gen/appengine1-cli/mkdocs.yml +++ b/gen/appengine1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.5+20170522 +site_name: appengine v1.0.6+20170522 site_url: http://byron.github.io/google-apis-rs/google-appengine1-cli site_description: A complete library to interact with appengine (protocol v1) diff --git a/gen/appengine1-cli/src/cmn.rs b/gen/appengine1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/appengine1-cli/src/cmn.rs +++ b/gen/appengine1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/appengine1-cli/src/main.rs b/gen/appengine1-cli/src/main.rs index 02bb129fc6..9fda567b76 100644 --- a/gen/appengine1-cli/src/main.rs +++ b/gen/appengine1-cli/src/main.rs @@ -2431,7 +2431,7 @@ fn main() { let mut app = App::new("appengine1") .author("Sebastian Thiel ") - .version("1.0.5+20170522") + .version("1.0.6+20170522") .about("The 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_cli") .arg(Arg::with_name("url") diff --git a/gen/appengine1/Cargo.toml b/gen/appengine1/Cargo.toml index 20747ae9fb..9b0655731c 100644 --- a/gen/appengine1/Cargo.toml +++ b/gen/appengine1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appengine1" -version = "1.0.5+20170522" +version = "1.0.6+20170522" authors = ["Sebastian Thiel "] description = "A complete library to interact with appengine (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/appengine1" homepage = "https://cloud.google.com/appengine/docs/admin-api/" -documentation = "https://docs.rs/google-appengine1/1.0.5+20170522" +documentation = "https://docs.rs/google-appengine1/1.0.6+20170522" license = "MIT" keywords = ["appengine", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/appengine1/README.md b/gen/appengine1/README.md index 285b9ea9bc..610b458c19 100644 --- a/gen/appengine1/README.md +++ b/gen/appengine1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-appengine1` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *1.0.5+20170522*, where *20170522* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *appengine* crate version *1.0.6+20170522*, where *20170522* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *appengine* *v1* 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](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.Appengine.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.Appengine.html) ... * apps - * [*create*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppCreateCall.html), [*get*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppLocationListCall.html), [*operations get*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppOperationListCall.html), [*patch*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppPatchCall.html), [*repair*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppRepairCall.html), [*services delete*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceDeleteCall.html), [*services get*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceGetCall.html), [*services list*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceListCall.html), [*services patch*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServicePatchCall.html), [*services versions create*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionCreateCall.html), [*services versions delete*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionDeleteCall.html), [*services versions get*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionListCall.html) and [*services versions patch*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.AppServiceVersionPatchCall.html) + * [*create*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppCreateCall.html), [*get*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppLocationListCall.html), [*operations get*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppOperationListCall.html), [*patch*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppPatchCall.html), [*repair*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppRepairCall.html), [*services delete*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceDeleteCall.html), [*services get*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceGetCall.html), [*services list*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceListCall.html), [*services patch*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServicePatchCall.html), [*services versions create*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionCreateCall.html), [*services versions delete*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionDeleteCall.html), [*services versions get*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionListCall.html) and [*services versions patch*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.AppServiceVersionPatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/struct.Appengine.html)** +* **[Hub](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/struct.Appengine.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.Part.html)** + * **[Parts](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/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")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/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](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/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](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/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](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/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](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/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](https://docs.rs/google-appengine1/1.0.5+20170522/google_appengine1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appengine1/1.0.6+20170522/google_appengine1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appengine1/src/lib.rs b/gen/appengine1/src/lib.rs index 7e13a2df9a..491f6d80e4 100644 --- a/gen/appengine1/src/lib.rs +++ b/gen/appengine1/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 *appengine* crate version *1.0.5+20170522*, where *20170522* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *appengine* crate version *1.0.6+20170522*, where *20170522* is the exact revision of the *appengine:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *appengine* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -341,7 +341,7 @@ impl<'a, C, A> Appengine Appengine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://appengine.googleapis.com/".to_string(), _root_url: "https://appengine.googleapis.com/".to_string(), } @@ -352,7 +352,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/appengine1_beta4-cli/Cargo.toml b/gen/appengine1_beta4-cli/Cargo.toml index 3f773f6449..afa0ddf60d 100644 --- a/gen/appengine1_beta4-cli/Cargo.toml +++ b/gen/appengine1_beta4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1_beta4-cli" -version = "1.0.5+20170522" +version = "1.0.6+20170522" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-appengine1_beta4] path = "../appengine1_beta4" -version = "1.0.5+20170522" +version = "1.0.6+20170522" diff --git a/gen/appengine1_beta4-cli/README.md b/gen/appengine1_beta4-cli/README.md index 3e58e31650..e0383f24ae 100644 --- a/gen/appengine1_beta4-cli/README.md +++ b/gen/appengine1_beta4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20170522*. The CLI is at version *1.0.5*. +This documentation was generated from the *appengine* API at revision *20170522*. The CLI is at version *1.0.6*. ```bash appengine1-beta4 [options] diff --git a/gen/appengine1_beta4-cli/mkdocs.yml b/gen/appengine1_beta4-cli/mkdocs.yml index f682ae7c24..344c16b6ec 100644 --- a/gen/appengine1_beta4-cli/mkdocs.yml +++ b/gen/appengine1_beta4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.5+20170522 +site_name: appengine v1.0.6+20170522 site_url: http://byron.github.io/google-apis-rs/google-appengine1_beta4-cli site_description: A complete library to interact with appengine (protocol v1beta4) diff --git a/gen/appengine1_beta4-cli/src/cmn.rs b/gen/appengine1_beta4-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/appengine1_beta4-cli/src/cmn.rs +++ b/gen/appengine1_beta4-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/appengine1_beta4-cli/src/main.rs b/gen/appengine1_beta4-cli/src/main.rs index e563d0d4e7..679ee8fb4e 100644 --- a/gen/appengine1_beta4-cli/src/main.rs +++ b/gen/appengine1_beta4-cli/src/main.rs @@ -2276,7 +2276,7 @@ fn main() { let mut app = App::new("appengine1-beta4") .author("Sebastian Thiel ") - .version("1.0.5+20170522") + .version("1.0.6+20170522") .about("The 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") diff --git a/gen/appengine1_beta4/Cargo.toml b/gen/appengine1_beta4/Cargo.toml index bd0dd48c49..36a2775c16 100644 --- a/gen/appengine1_beta4/Cargo.toml +++ b/gen/appengine1_beta4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appengine1_beta4" -version = "1.0.5+20170522" +version = "1.0.6+20170522" 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://cloud.google.com/appengine/docs/admin-api/" -documentation = "https://docs.rs/google-appengine1_beta4/1.0.5+20170522" +documentation = "https://docs.rs/google-appengine1_beta4/1.0.6+20170522" license = "MIT" keywords = ["appengine", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/appengine1_beta4/README.md b/gen/appengine1_beta4/README.md index cee0b6e557..1280055d35 100644 --- a/gen/appengine1_beta4/README.md +++ b/gen/appengine1_beta4/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170522*, where *20170522* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *appengine* crate version *1.0.6+20170522*, where *20170522* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *appengine* *v1_beta4* 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](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.Appengine.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.Appengine.html) ... * apps - * [*create*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppCreateCall.html), [*get*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppLocationListCall.html), [*modules delete*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleDeleteCall.html), [*modules get*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleGetCall.html), [*modules list*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleListCall.html), [*modules patch*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModulePatchCall.html), [*modules versions create*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionCreateCall.html), [*modules versions delete*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionDeleteCall.html), [*modules versions get*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionGetCall.html), [*modules versions instances debug*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceDebugCall.html), [*modules versions instances delete*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceDeleteCall.html), [*modules versions instances get*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceGetCall.html), [*modules versions instances list*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceListCall.html), [*modules versions list*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionListCall.html), [*modules versions patch*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppModuleVersionPatchCall.html), [*operations get*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppOperationListCall.html) and [*patch*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.AppPatchCall.html) + * [*create*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppCreateCall.html), [*get*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppLocationListCall.html), [*modules delete*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleDeleteCall.html), [*modules get*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleGetCall.html), [*modules list*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleListCall.html), [*modules patch*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModulePatchCall.html), [*modules versions create*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionCreateCall.html), [*modules versions delete*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionDeleteCall.html), [*modules versions get*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionGetCall.html), [*modules versions instances debug*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceDebugCall.html), [*modules versions instances delete*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceDeleteCall.html), [*modules versions instances get*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceGetCall.html), [*modules versions instances list*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionInstanceListCall.html), [*modules versions list*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionListCall.html), [*modules versions patch*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppModuleVersionPatchCall.html), [*operations get*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppOperationListCall.html) and [*patch*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.AppPatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/struct.Appengine.html)** +* **[Hub](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/struct.Appengine.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.Part.html)** + * **[Parts](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -133,17 +133,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/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")`. @@ -153,29 +153,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/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](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/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](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/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](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/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](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/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](https://docs.rs/google-appengine1_beta4/1.0.5+20170522/google_appengine1_beta4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appengine1_beta4/1.0.6+20170522/google_appengine1_beta4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appengine1_beta4/src/lib.rs b/gen/appengine1_beta4/src/lib.rs index 3711749583..d169649058 100644 --- a/gen/appengine1_beta4/src/lib.rs +++ b/gen/appengine1_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 *appengine* crate version *1.0.5+20170522*, where *20170522* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *appengine* crate version *1.0.6+20170522*, where *20170522* is the exact revision of the *appengine:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *appengine* *v1_beta4* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -344,7 +344,7 @@ impl<'a, C, A> Appengine Appengine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://appengine.googleapis.com/".to_string(), _root_url: "https://appengine.googleapis.com/".to_string(), } @@ -355,7 +355,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/appengine1_beta5-cli/Cargo.toml b/gen/appengine1_beta5-cli/Cargo.toml index 0722b13c09..a2983fa735 100644 --- a/gen/appengine1_beta5-cli/Cargo.toml +++ b/gen/appengine1_beta5-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appengine1_beta5-cli" -version = "1.0.5+20170522" +version = "1.0.6+20170522" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-appengine1_beta5] path = "../appengine1_beta5" -version = "1.0.5+20170522" +version = "1.0.6+20170522" diff --git a/gen/appengine1_beta5-cli/README.md b/gen/appengine1_beta5-cli/README.md index 0c63a688f8..3a08b3ae59 100644 --- a/gen/appengine1_beta5-cli/README.md +++ b/gen/appengine1_beta5-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appengine* API at revision *20170522*. The CLI is at version *1.0.5*. +This documentation was generated from the *appengine* API at revision *20170522*. The CLI is at version *1.0.6*. ```bash appengine1-beta5 [options] diff --git a/gen/appengine1_beta5-cli/mkdocs.yml b/gen/appengine1_beta5-cli/mkdocs.yml index e372f7964a..e0a64443f6 100644 --- a/gen/appengine1_beta5-cli/mkdocs.yml +++ b/gen/appengine1_beta5-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appengine v1.0.5+20170522 +site_name: appengine v1.0.6+20170522 site_url: http://byron.github.io/google-apis-rs/google-appengine1_beta5-cli site_description: A complete library to interact with appengine (protocol v1beta5) diff --git a/gen/appengine1_beta5-cli/src/cmn.rs b/gen/appengine1_beta5-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/appengine1_beta5-cli/src/cmn.rs +++ b/gen/appengine1_beta5-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/appengine1_beta5-cli/src/main.rs b/gen/appengine1_beta5-cli/src/main.rs index aee807ee50..e73353e8da 100644 --- a/gen/appengine1_beta5-cli/src/main.rs +++ b/gen/appengine1_beta5-cli/src/main.rs @@ -2284,7 +2284,7 @@ fn main() { let mut app = App::new("appengine1-beta5") .author("Sebastian Thiel ") - .version("1.0.5+20170522") + .version("1.0.6+20170522") .about("The 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") diff --git a/gen/appengine1_beta5/Cargo.toml b/gen/appengine1_beta5/Cargo.toml index 87097efd8f..b9191def93 100644 --- a/gen/appengine1_beta5/Cargo.toml +++ b/gen/appengine1_beta5/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appengine1_beta5" -version = "1.0.5+20170522" +version = "1.0.6+20170522" 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 = "https://docs.rs/google-appengine1_beta5/1.0.5+20170522" +documentation = "https://docs.rs/google-appengine1_beta5/1.0.6+20170522" license = "MIT" keywords = ["appengine", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/appengine1_beta5/README.md b/gen/appengine1_beta5/README.md index 689ba537b0..07b51ff2de 100644 --- a/gen/appengine1_beta5/README.md +++ b/gen/appengine1_beta5/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-appengine1_beta5` library allows access to all features of the *Google appengine* service. -This documentation was generated from *appengine* crate version *1.0.5+20170522*, where *20170522* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *appengine* crate version *1.0.6+20170522*, where *20170522* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.Appengine.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.Appengine.html) ... * apps - * [*create*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppCreateCall.html), [*get*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppLocationListCall.html), [*operations get*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppOperationListCall.html), [*patch*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppPatchCall.html), [*services delete*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceDeleteCall.html), [*services get*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceGetCall.html), [*services list*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceListCall.html), [*services patch*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServicePatchCall.html), [*services versions create*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionCreateCall.html), [*services versions delete*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionDeleteCall.html), [*services versions get*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionListCall.html) and [*services versions patch*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.AppServiceVersionPatchCall.html) + * [*create*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppCreateCall.html), [*get*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppGetCall.html), [*locations get*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppLocationGetCall.html), [*locations list*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppLocationListCall.html), [*operations get*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppOperationGetCall.html), [*operations list*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppOperationListCall.html), [*patch*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppPatchCall.html), [*services delete*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceDeleteCall.html), [*services get*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceGetCall.html), [*services list*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceListCall.html), [*services patch*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServicePatchCall.html), [*services versions create*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionCreateCall.html), [*services versions delete*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionDeleteCall.html), [*services versions get*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionGetCall.html), [*services versions instances debug*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceDebugCall.html), [*services versions instances delete*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceDeleteCall.html), [*services versions instances get*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceGetCall.html), [*services versions instances list*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionInstanceListCall.html), [*services versions list*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionListCall.html) and [*services versions patch*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.AppServiceVersionPatchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/struct.Appengine.html)** +* **[Hub](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/struct.Appengine.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.Part.html)** + * **[Parts](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/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](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/google_appengine1_beta5/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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](https://docs.rs/google-appengine1_beta5/1.0.5+20170522/google_appengine1_beta5/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appengine1_beta5/1.0.6+20170522/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. diff --git a/gen/appengine1_beta5/src/lib.rs b/gen/appengine1_beta5/src/lib.rs index 4db5b43a11..cb19228546 100644 --- a/gen/appengine1_beta5/src/lib.rs +++ b/gen/appengine1_beta5/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 *appengine* crate version *1.0.5+20170522*, where *20170522* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *appengine* crate version *1.0.6+20170522*, where *20170522* is the exact revision of the *appengine:v1beta5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *appengine* *v1_beta5* API can be found at the //! [official documentation site](https://cloud.google.com/appengine/docs/admin-api/). @@ -340,7 +340,7 @@ impl<'a, C, A> Appengine Appengine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://appengine.googleapis.com/".to_string(), _root_url: "https://appengine.googleapis.com/".to_string(), } @@ -351,7 +351,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/appsactivity1-cli/Cargo.toml b/gen/appsactivity1-cli/Cargo.toml index 3cb5458b31..78b2e9a834 100644 --- a/gen/appsactivity1-cli/Cargo.toml +++ b/gen/appsactivity1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appsactivity1-cli" -version = "1.0.5+20170215" +version = "1.0.6+20170215" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-appsactivity1] path = "../appsactivity1" -version = "1.0.5+20170215" +version = "1.0.6+20170215" diff --git a/gen/appsactivity1-cli/README.md b/gen/appsactivity1-cli/README.md index 41da2a57e9..a2eab43507 100644 --- a/gen/appsactivity1-cli/README.md +++ b/gen/appsactivity1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *appsactivity* API at revision *20170215*. The CLI is at version *1.0.5*. +This documentation was generated from the *appsactivity* API at revision *20170215*. The CLI is at version *1.0.6*. ```bash appsactivity1 [options] diff --git a/gen/appsactivity1-cli/mkdocs.yml b/gen/appsactivity1-cli/mkdocs.yml index 96fda15839..a677b1d2e0 100644 --- a/gen/appsactivity1-cli/mkdocs.yml +++ b/gen/appsactivity1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: appsactivity v1.0.5+20170215 +site_name: appsactivity v1.0.6+20170215 site_url: http://byron.github.io/google-apis-rs/google-appsactivity1-cli site_description: A complete library to interact with appsactivity (protocol v1) diff --git a/gen/appsactivity1-cli/src/cmn.rs b/gen/appsactivity1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/appsactivity1-cli/src/cmn.rs +++ b/gen/appsactivity1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/appsactivity1-cli/src/main.rs b/gen/appsactivity1-cli/src/main.rs index b03cec6bd5..75bf79eaa4 100644 --- a/gen/appsactivity1-cli/src/main.rs +++ b/gen/appsactivity1-cli/src/main.rs @@ -241,7 +241,7 @@ fn main() { let mut app = App::new("appsactivity1") .author("Sebastian Thiel ") - .version("1.0.5+20170215") + .version("1.0.6+20170215") .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") diff --git a/gen/appsactivity1/Cargo.toml b/gen/appsactivity1/Cargo.toml index ccb18d73ae..28fbfad9b6 100644 --- a/gen/appsactivity1/Cargo.toml +++ b/gen/appsactivity1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appsactivity1" -version = "1.0.5+20170215" +version = "1.0.6+20170215" 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" homepage = "https://developers.google.com/google-apps/activity/" -documentation = "https://docs.rs/google-appsactivity1/1.0.5+20170215" +documentation = "https://docs.rs/google-appsactivity1/1.0.6+20170215" license = "MIT" keywords = ["appsactivity", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/appsactivity1/README.md b/gen/appsactivity1/README.md index 754c1765dd..deab1a04d3 100644 --- a/gen/appsactivity1/README.md +++ b/gen/appsactivity1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170215*, where *20170215* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *appsactivity* crate version *1.0.6+20170215*, where *20170215* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *appsactivity* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/activity/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/struct.Appsactivity.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/struct.Appsactivity.html) ... -* [activities](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/struct.Activity.html) - * [*list*](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/struct.ActivityListCall.html) +* [activities](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/struct.Activity.html) + * [*list*](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/struct.ActivityListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/struct.Appsactivity.html)** +* **[Hub](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/struct.Appsactivity.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.Part.html)** + * **[Parts](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -123,17 +123,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/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")`. @@ -143,29 +143,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/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](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/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](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/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](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/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](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/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](https://docs.rs/google-appsactivity1/1.0.5+20170215/google_appsactivity1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appsactivity1/1.0.6+20170215/google_appsactivity1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appsactivity1/src/lib.rs b/gen/appsactivity1/src/lib.rs index e2c489fc65..0771fd0bac 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 *1.0.5+20170215*, where *20170215* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *appsactivity* crate version *1.0.6+20170215*, where *20170215* is the exact revision of the *appsactivity:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *appsactivity* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/activity/). @@ -341,7 +341,7 @@ impl<'a, C, A> Appsactivity Appsactivity { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/appsactivity/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -352,7 +352,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/appstate1-cli/Cargo.toml b/gen/appstate1-cli/Cargo.toml index 9dca4caeb0..38d7d9cf78 100644 --- a/gen/appstate1-cli/Cargo.toml +++ b/gen/appstate1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-appstate1-cli" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-appstate1] path = "../appstate1" -version = "1.0.5+20170511" +version = "1.0.6+20170511" diff --git a/gen/appstate1-cli/README.md b/gen/appstate1-cli/README.md index 2336494557..52a641e5a5 100644 --- a/gen/appstate1-cli/README.md +++ b/gen/appstate1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *App State* API at revision *20170511*. The CLI is at version *1.0.5*. +This documentation was generated from the *App State* API at revision *20170511*. The CLI is at version *1.0.6*. ```bash appstate1 [options] diff --git a/gen/appstate1-cli/mkdocs.yml b/gen/appstate1-cli/mkdocs.yml index f48aeba659..40bfdd897b 100644 --- a/gen/appstate1-cli/mkdocs.yml +++ b/gen/appstate1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: App State v1.0.5+20170511 +site_name: App State v1.0.6+20170511 site_url: http://byron.github.io/google-apis-rs/google-appstate1-cli site_description: A complete library to interact with App State (protocol v1) diff --git a/gen/appstate1-cli/src/cmn.rs b/gen/appstate1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/appstate1-cli/src/cmn.rs +++ b/gen/appstate1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/appstate1-cli/src/main.rs b/gen/appstate1-cli/src/main.rs index aea4691ad3..155458b44a 100644 --- a/gen/appstate1-cli/src/main.rs +++ b/gen/appstate1-cli/src/main.rs @@ -569,7 +569,7 @@ fn main() { let mut app = App::new("appstate1") .author("Sebastian Thiel ") - .version("1.0.5+20170511") + .version("1.0.6+20170511") .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") diff --git a/gen/appstate1/Cargo.toml b/gen/appstate1/Cargo.toml index 7f33ca46a2..ac28ea4801 100644 --- a/gen/appstate1/Cargo.toml +++ b/gen/appstate1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-appstate1" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" homepage = "https://developers.google.com/games/services/web/api/states" -documentation = "https://docs.rs/google-appstate1/1.0.5+20170511" +documentation = "https://docs.rs/google-appstate1/1.0.6+20170511" license = "MIT" keywords = ["appstate", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/appstate1/README.md b/gen/appstate1/README.md index 5ab8140315..819e165279 100644 --- a/gen/appstate1/README.md +++ b/gen/appstate1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *App State* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.AppState.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.AppState.html) ... * states - * [*clear*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.StateClearCall.html), [*delete*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.StateDeleteCall.html), [*get*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.StateGetCall.html), [*list*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.StateListCall.html) and [*update*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.StateUpdateCall.html) + * [*clear*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.StateClearCall.html), [*delete*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.StateDeleteCall.html), [*get*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.StateGetCall.html), [*list*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.StateListCall.html) and [*update*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.StateUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/struct.AppState.html)** +* **[Hub](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/struct.AppState.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.Part.html)** + * **[Parts](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -124,17 +124,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/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")`. @@ -144,29 +144,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/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](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/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](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/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](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/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](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/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](https://docs.rs/google-appstate1/1.0.5+20170511/google_appstate1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-appstate1/1.0.6+20170511/google_appstate1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/appstate1/src/lib.rs b/gen/appstate1/src/lib.rs index 5d456f8e35..4d8ba8dd2e 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *App State* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *appstate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -326,7 +326,7 @@ impl<'a, C, A> AppState AppState { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/appstate/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -337,7 +337,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/autoscaler1_beta2-cli/Cargo.toml b/gen/autoscaler1_beta2-cli/Cargo.toml index 4296fa28cb..db6aaff2ab 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 = "1.0.5+20150629" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-autoscaler1_beta2] path = "../autoscaler1_beta2" -version = "1.0.5+20150629" +version = "1.0.6+20150629" diff --git a/gen/autoscaler1_beta2-cli/README.md b/gen/autoscaler1_beta2-cli/README.md index 00b1840c24..1c515329b9 100644 --- a/gen/autoscaler1_beta2-cli/README.md +++ b/gen/autoscaler1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *autoscaler* API at revision *20150629*. The CLI is at version *1.0.5*. +This documentation was generated from the *autoscaler* API at revision *20150629*. The CLI is at version *1.0.6*. ```bash autoscaler1-beta2 [options] diff --git a/gen/autoscaler1_beta2-cli/mkdocs.yml b/gen/autoscaler1_beta2-cli/mkdocs.yml index b1c0fd20a5..e6ecba2f57 100644 --- a/gen/autoscaler1_beta2-cli/mkdocs.yml +++ b/gen/autoscaler1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: autoscaler v1.0.5+20150629 +site_name: autoscaler v1.0.6+20150629 site_url: http://byron.github.io/google-apis-rs/google-autoscaler1_beta2-cli site_description: A complete library to interact with autoscaler (protocol v1beta2) diff --git a/gen/autoscaler1_beta2-cli/src/cmn.rs b/gen/autoscaler1_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/autoscaler1_beta2-cli/src/cmn.rs +++ b/gen/autoscaler1_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/autoscaler1_beta2-cli/src/main.rs b/gen/autoscaler1_beta2-cli/src/main.rs index 2d63619020..b90d8daa33 100644 --- a/gen/autoscaler1_beta2-cli/src/main.rs +++ b/gen/autoscaler1_beta2-cli/src/main.rs @@ -1196,7 +1196,7 @@ fn main() { let mut app = App::new("autoscaler1-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20150629") + .version("1.0.6+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") diff --git a/gen/autoscaler1_beta2/Cargo.toml b/gen/autoscaler1_beta2/Cargo.toml index e34d2d6a83..5c0f5c0dd3 100644 --- a/gen/autoscaler1_beta2/Cargo.toml +++ b/gen/autoscaler1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-autoscaler1_beta2" -version = "1.0.5+20150629" +version = "1.0.6+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" homepage = "http://developers.google.com/compute/docs/autoscaler" -documentation = "https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629" +documentation = "https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629" license = "MIT" keywords = ["autoscaler", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/autoscaler1_beta2/README.md b/gen/autoscaler1_beta2/README.md index 75c0ef6b92..f55cbf752a 100644 --- a/gen/autoscaler1_beta2/README.md +++ b/gen/autoscaler1_beta2/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *autoscaler* crate version *1.0.6+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *autoscaler* *v1_beta2* API can be found at the [official documentation site](http://developers.google.com/compute/docs/autoscaler). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerHub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerHub.html) ... -* [autoscalers](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.Autoscaler.html) - * [*delete*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerDeleteCall.html), [*get*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerGetCall.html), [*insert*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerInsertCall.html), [*list*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerListCall.html), [*patch*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerPatchCall.html) and [*update*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerUpdateCall.html) +* [autoscalers](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.Autoscaler.html) + * [*delete*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerDeleteCall.html), [*get*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerGetCall.html), [*insert*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerInsertCall.html), [*list*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerListCall.html), [*patch*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerPatchCall.html) and [*update*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerUpdateCall.html) * zone operations - * [*delete*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.ZoneOperationDeleteCall.html), [*get*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.ZoneOperationListCall.html) -* [zones](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.Zone.html) - * [*list*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.ZoneListCall.html) + * [*delete*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.ZoneOperationDeleteCall.html), [*get*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.ZoneOperationListCall.html) +* [zones](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.Zone.html) + * [*list*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.ZoneListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/struct.AutoscalerHub.html)** +* **[Hub](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/struct.AutoscalerHub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -128,17 +128,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_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")`. @@ -148,29 +148,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_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](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_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](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/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](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_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](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_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](https://docs.rs/google-autoscaler1_beta2/1.0.5+20150629/google_autoscaler1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-autoscaler1_beta2/1.0.6+20150629/google_autoscaler1_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. diff --git a/gen/autoscaler1_beta2/src/lib.rs b/gen/autoscaler1_beta2/src/lib.rs index 6ec70e8700..509958b12c 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 *1.0.5+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *autoscaler* crate version *1.0.6+20150629*, where *20150629* is the exact revision of the *autoscaler:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *autoscaler* *v1_beta2* API can be found at the //! [official documentation site](http://developers.google.com/compute/docs/autoscaler). @@ -330,7 +330,7 @@ impl<'a, C, A> AutoscalerHub AutoscalerHub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/autoscaler/v1beta2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -347,7 +347,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/bigquery2-cli/Cargo.toml b/gen/bigquery2-cli/Cargo.toml index 6d0ab87a00..f190ba5143 100644 --- a/gen/bigquery2-cli/Cargo.toml +++ b/gen/bigquery2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-bigquery2-cli" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-bigquery2] path = "../bigquery2" -version = "1.0.5+20170511" +version = "1.0.6+20170511" diff --git a/gen/bigquery2-cli/README.md b/gen/bigquery2-cli/README.md index f2022dd144..93f3dea420 100644 --- a/gen/bigquery2-cli/README.md +++ b/gen/bigquery2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *bigquery* API at revision *20170511*. The CLI is at version *1.0.5*. +This documentation was generated from the *bigquery* API at revision *20170511*. The CLI is at version *1.0.6*. ```bash bigquery2 [options] diff --git a/gen/bigquery2-cli/mkdocs.yml b/gen/bigquery2-cli/mkdocs.yml index efffeb0fff..a2c73c3ff8 100644 --- a/gen/bigquery2-cli/mkdocs.yml +++ b/gen/bigquery2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: bigquery v1.0.5+20170511 +site_name: bigquery v1.0.6+20170511 site_url: http://byron.github.io/google-apis-rs/google-bigquery2-cli site_description: A complete library to interact with bigquery (protocol v2) diff --git a/gen/bigquery2-cli/src/cmn.rs b/gen/bigquery2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/bigquery2-cli/src/cmn.rs +++ b/gen/bigquery2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/bigquery2-cli/src/main.rs b/gen/bigquery2-cli/src/main.rs index 1d3b54a4f1..210bdda012 100644 --- a/gen/bigquery2-cli/src/main.rs +++ b/gen/bigquery2-cli/src/main.rs @@ -2590,7 +2590,7 @@ fn main() { let mut app = App::new("bigquery2") .author("Sebastian Thiel ") - .version("1.0.5+20170511") + .version("1.0.6+20170511") .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") diff --git a/gen/bigquery2/Cargo.toml b/gen/bigquery2/Cargo.toml index 2fc7bc3682..712e96e6e5 100644 --- a/gen/bigquery2/Cargo.toml +++ b/gen/bigquery2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-bigquery2" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" homepage = "https://cloud.google.com/bigquery/" -documentation = "https://docs.rs/google-bigquery2/1.0.5+20170511" +documentation = "https://docs.rs/google-bigquery2/1.0.6+20170511" license = "MIT" keywords = ["bigquery", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/bigquery2/README.md b/gen/bigquery2/README.md index 4328fbd9b7..29dbf5d300 100644 --- a/gen/bigquery2/README.md +++ b/gen/bigquery2/README.md @@ -5,29 +5,29 @@ 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *bigquery* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *bigquery* *v2* API can be found at the [official documentation site](https://cloud.google.com/bigquery/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.Bigquery.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.Bigquery.html) ... -* [datasets](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.Dataset.html) - * [*delete*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.DatasetGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.DatasetInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.DatasetPatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.DatasetUpdateCall.html) -* [jobs](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.Job.html) - * [*cancel*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobCancelCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobGetCall.html), [*get query results*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobGetQueryResultCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobListCall.html) and [*query*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobQueryCall.html) +* [datasets](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.Dataset.html) + * [*delete*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.DatasetGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.DatasetInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.DatasetPatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.DatasetUpdateCall.html) +* [jobs](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.Job.html) + * [*cancel*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobCancelCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobGetCall.html), [*get query results*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobGetQueryResultCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobListCall.html) and [*query*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobQueryCall.html) * projects - * [*list*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.ProjectListCall.html) + * [*list*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.ProjectListCall.html) * tabledata - * [*insert all*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TabledataInsertAllCall.html) and [*list*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TabledataListCall.html) -* [tables](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.Table.html) - * [*delete*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TableDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TableGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TableInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TableListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TablePatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.TableUpdateCall.html) + * [*insert all*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TabledataInsertAllCall.html) and [*list*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TabledataListCall.html) +* [tables](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.Table.html) + * [*delete*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TableDeleteCall.html), [*get*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TableGetCall.html), [*insert*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TableInsertCall.html), [*list*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TableListCall.html), [*patch*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TablePatchCall.html) and [*update*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.TableUpdateCall.html) Upload supported by ... -* [*insert jobs*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.JobInsertCall.html) +* [*insert jobs*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.JobInsertCall.html) @@ -35,17 +35,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/struct.Bigquery.html)** +* **[Hub](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/struct.Bigquery.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.Part.html)** + * **[Parts](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/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")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/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](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/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](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/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](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/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](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/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](https://docs.rs/google-bigquery2/1.0.5+20170511/google_bigquery2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-bigquery2/1.0.6+20170511/google_bigquery2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/bigquery2/src/lib.rs b/gen/bigquery2/src/lib.rs index 56aacb8cbd..d7c6efcad0 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *bigquery* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *bigquery:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *bigquery* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/bigquery/). @@ -364,7 +364,7 @@ impl<'a, C, A> Bigquery Bigquery { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/bigquery/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -387,7 +387,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/blogger3-cli/Cargo.toml b/gen/blogger3-cli/Cargo.toml index 348a74c4ea..28db597fe0 100644 --- a/gen/blogger3-cli/Cargo.toml +++ b/gen/blogger3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-blogger3-cli" -version = "1.0.5+20150422" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-blogger3] path = "../blogger3" -version = "1.0.5+20150422" +version = "1.0.6+20150422" diff --git a/gen/blogger3-cli/README.md b/gen/blogger3-cli/README.md index 24fecad33f..5844691a67 100644 --- a/gen/blogger3-cli/README.md +++ b/gen/blogger3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *blogger* API at revision *20150422*. The CLI is at version *1.0.5*. +This documentation was generated from the *blogger* API at revision *20150422*. The CLI is at version *1.0.6*. ```bash blogger3 [options] diff --git a/gen/blogger3-cli/mkdocs.yml b/gen/blogger3-cli/mkdocs.yml index 4ad4fed30f..68dae49f27 100644 --- a/gen/blogger3-cli/mkdocs.yml +++ b/gen/blogger3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: blogger v1.0.5+20150422 +site_name: blogger v1.0.6+20150422 site_url: http://byron.github.io/google-apis-rs/google-blogger3-cli site_description: A complete library to interact with blogger (protocol v3) diff --git a/gen/blogger3-cli/src/cmn.rs b/gen/blogger3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/blogger3-cli/src/cmn.rs +++ b/gen/blogger3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/blogger3-cli/src/main.rs b/gen/blogger3-cli/src/main.rs index ff8917f6ad..9963a76848 100644 --- a/gen/blogger3-cli/src/main.rs +++ b/gen/blogger3-cli/src/main.rs @@ -3497,7 +3497,7 @@ fn main() { let mut app = App::new("blogger3") .author("Sebastian Thiel ") - .version("1.0.5+20150422") + .version("1.0.6+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") diff --git a/gen/blogger3/Cargo.toml b/gen/blogger3/Cargo.toml index 66999a98b4..52d012b898 100644 --- a/gen/blogger3/Cargo.toml +++ b/gen/blogger3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-blogger3" -version = "1.0.5+20150422" +version = "1.0.6+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" homepage = "https://developers.google.com/blogger/docs/3.0/getting_started" -documentation = "https://docs.rs/google-blogger3/1.0.5+20150422" +documentation = "https://docs.rs/google-blogger3/1.0.6+20150422" license = "MIT" keywords = ["blogger", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/blogger3/README.md b/gen/blogger3/README.md index ced2db5dcb..a20c4d2fc8 100644 --- a/gen/blogger3/README.md +++ b/gen/blogger3/README.md @@ -5,30 +5,30 @@ 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 *1.0.5+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *blogger* crate version *1.0.6+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.Blogger.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.Blogger.html) ... -* [blog user infos](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.BlogUserInfo.html) - * [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.BlogUserInfoGetCall.html) -* [blogs](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.Blog.html) - * [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.BlogGetCall.html), [*get by url*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.BlogGetByUrlCall.html) and [*list by user*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.BlogListByUserCall.html) -* [comments](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.Comment.html) - * [*approve*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentApproveCall.html), [*delete*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentGetCall.html), [*list*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentListCall.html), [*list by blog*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentListByBlogCall.html), [*mark as spam*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentMarkAsSpamCall.html) and [*remove content*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.CommentRemoveContentCall.html) +* [blog user infos](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.BlogUserInfo.html) + * [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.BlogUserInfoGetCall.html) +* [blogs](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.Blog.html) + * [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.BlogGetCall.html), [*get by url*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.BlogGetByUrlCall.html) and [*list by user*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.BlogListByUserCall.html) +* [comments](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.Comment.html) + * [*approve*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentApproveCall.html), [*delete*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentGetCall.html), [*list*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentListCall.html), [*list by blog*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentListByBlogCall.html), [*mark as spam*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentMarkAsSpamCall.html) and [*remove content*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.CommentRemoveContentCall.html) * page views - * [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageViewGetCall.html) -* [pages](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.Page.html) - * [*delete*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageDeleteCall.html), [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageGetCall.html), [*insert*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageInsertCall.html), [*list*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageListCall.html), [*patch*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PagePatchCall.html), [*publish*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PagePublishCall.html), [*revert*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageRevertCall.html) and [*update*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PageUpdateCall.html) -* [post user infos](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostUserInfo.html) - * [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostUserInfoGetCall.html) and [*list*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostUserInfoListCall.html) -* [posts](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.Post.html) - * [*delete*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostDeleteCall.html), [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostGetCall.html), [*get by path*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostGetByPathCall.html), [*insert*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostInsertCall.html), [*list*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostListCall.html), [*patch*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostPatchCall.html), [*publish*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostPublishCall.html), [*revert*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostRevertCall.html), [*search*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostSearchCall.html) and [*update*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.PostUpdateCall.html) -* [users](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.User.html) - * [*get*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.UserGetCall.html) + * [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageViewGetCall.html) +* [pages](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.Page.html) + * [*delete*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageDeleteCall.html), [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageGetCall.html), [*insert*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageInsertCall.html), [*list*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageListCall.html), [*patch*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PagePatchCall.html), [*publish*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PagePublishCall.html), [*revert*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageRevertCall.html) and [*update*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PageUpdateCall.html) +* [post user infos](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostUserInfo.html) + * [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostUserInfoGetCall.html) and [*list*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostUserInfoListCall.html) +* [posts](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.Post.html) + * [*delete*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostDeleteCall.html), [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostGetCall.html), [*get by path*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostGetByPathCall.html), [*insert*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostInsertCall.html), [*list*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostListCall.html), [*patch*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostPatchCall.html), [*publish*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostPublishCall.html), [*revert*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostRevertCall.html), [*search*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostSearchCall.html) and [*update*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.PostUpdateCall.html) +* [users](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.User.html) + * [*get*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.UserGetCall.html) @@ -37,17 +37,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/struct.Blogger.html)** +* **[Hub](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/struct.Blogger.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.Part.html)** + * **[Parts](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -149,17 +149,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/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")`. @@ -169,29 +169,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/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](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/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](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/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](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/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](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/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](https://docs.rs/google-blogger3/1.0.5+20150422/google_blogger3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-blogger3/1.0.6+20150422/google_blogger3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/blogger3/src/lib.rs b/gen/blogger3/src/lib.rs index 70f8dd7f42..0ef1dfec39 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 *1.0.5+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *blogger* crate version *1.0.6+20150422*, where *20150422* is the exact revision of the *blogger:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -358,7 +358,7 @@ impl<'a, C, A> Blogger Blogger { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/blogger/v3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -390,7 +390,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/books1-cli/Cargo.toml b/gen/books1-cli/Cargo.toml index da42f87da7..c51d7d499b 100644 --- a/gen/books1-cli/Cargo.toml +++ b/gen/books1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-books1-cli" -version = "1.0.5+20170313" +version = "1.0.6+20170313" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-books1] path = "../books1" -version = "1.0.5+20170313" +version = "1.0.6+20170313" diff --git a/gen/books1-cli/README.md b/gen/books1-cli/README.md index 039957f3a5..e069c84f24 100644 --- a/gen/books1-cli/README.md +++ b/gen/books1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *books* API at revision *20170313*. The CLI is at version *1.0.5*. +This documentation was generated from the *books* API at revision *20170313*. The CLI is at version *1.0.6*. ```bash books1 [options] diff --git a/gen/books1-cli/mkdocs.yml b/gen/books1-cli/mkdocs.yml index 8d64705d38..b72df7a6c8 100644 --- a/gen/books1-cli/mkdocs.yml +++ b/gen/books1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: books v1.0.5+20170313 +site_name: books v1.0.6+20170313 site_url: http://byron.github.io/google-apis-rs/google-books1-cli site_description: A complete library to interact with books (protocol v1) diff --git a/gen/books1-cli/src/cmn.rs b/gen/books1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/books1-cli/src/cmn.rs +++ b/gen/books1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/books1-cli/src/main.rs b/gen/books1-cli/src/main.rs index 5ad8716bb1..3a5ec73607 100644 --- a/gen/books1-cli/src/main.rs +++ b/gen/books1-cli/src/main.rs @@ -4706,7 +4706,7 @@ fn main() { let mut app = App::new("books1") .author("Sebastian Thiel ") - .version("1.0.5+20170313") + .version("1.0.6+20170313") .about("Searches for books and manages 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") diff --git a/gen/books1/Cargo.toml b/gen/books1/Cargo.toml index 825df35d36..970864de77 100644 --- a/gen/books1/Cargo.toml +++ b/gen/books1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-books1" -version = "1.0.5+20170313" +version = "1.0.6+20170313" 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" homepage = "https://developers.google.com/books/docs/v1/getting_started" -documentation = "https://docs.rs/google-books1/1.0.5+20170313" +documentation = "https://docs.rs/google-books1/1.0.6+20170313" license = "MIT" keywords = ["books", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/books1/README.md b/gen/books1/README.md index 1442c6f91d..24f5c2b520 100644 --- a/gen/books1/README.md +++ b/gen/books1/README.md @@ -5,38 +5,38 @@ 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 *1.0.5+20170313*, where *20170313* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *books* crate version *1.0.6+20170313*, where *20170313* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *books* *v1* API can be found at the [official documentation site](https://developers.google.com/books/docs/v1/getting_started). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.Books.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.Books.html) ... * bookshelves - * [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.BookshelveGetCall.html), [*list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.BookshelveListCall.html) and [*volumes list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.BookshelveVolumeListCall.html) + * [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.BookshelveGetCall.html), [*list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.BookshelveListCall.html) and [*volumes list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.BookshelveVolumeListCall.html) * cloudloading - * [*add book*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.CloudloadingAddBookCall.html), [*delete book*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.CloudloadingDeleteBookCall.html) and [*update book*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.CloudloadingUpdateBookCall.html) + * [*add book*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.CloudloadingAddBookCall.html), [*delete book*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.CloudloadingDeleteBookCall.html) and [*update book*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.CloudloadingUpdateBookCall.html) * dictionary - * [*list offline metadata*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.DictionaryListOfflineMetadataCall.html) + * [*list offline metadata*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.DictionaryListOfflineMetadataCall.html) * layers - * [*annotation data get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.LayerAnnotationDataGetCall.html), [*annotation data list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.LayerAnnotationDataListCall.html), [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.LayerGetCall.html), [*list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.LayerListCall.html), [*volume annotations get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.LayerVolumeAnnotationGetCall.html) and [*volume annotations list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.LayerVolumeAnnotationListCall.html) + * [*annotation data get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.LayerAnnotationDataGetCall.html), [*annotation data list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.LayerAnnotationDataListCall.html), [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.LayerGetCall.html), [*list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.LayerListCall.html), [*volume annotations get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.LayerVolumeAnnotationGetCall.html) and [*volume annotations list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.LayerVolumeAnnotationListCall.html) * myconfig - * [*get user settings*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MyconfigGetUserSettingCall.html), [*release download access*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MyconfigReleaseDownloadAccesCall.html), [*request access*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MyconfigRequestAccesCall.html), [*sync volume licenses*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MyconfigSyncVolumeLicenseCall.html) and [*update user settings*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MyconfigUpdateUserSettingCall.html) + * [*get user settings*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MyconfigGetUserSettingCall.html), [*release download access*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MyconfigReleaseDownloadAccesCall.html), [*request access*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MyconfigRequestAccesCall.html), [*sync volume licenses*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MyconfigSyncVolumeLicenseCall.html) and [*update user settings*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MyconfigUpdateUserSettingCall.html) * mylibrary - * [*annotations delete*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryAnnotationDeleteCall.html), [*annotations insert*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryAnnotationInsertCall.html), [*annotations list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryAnnotationListCall.html), [*annotations summary*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryAnnotationSummaryCall.html), [*annotations update*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryAnnotationUpdateCall.html), [*bookshelves add volume*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveAddVolumeCall.html), [*bookshelves clear volumes*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveClearVolumeCall.html), [*bookshelves get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveGetCall.html), [*bookshelves list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveListCall.html), [*bookshelves move volume*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveMoveVolumeCall.html), [*bookshelves remove volume*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveRemoveVolumeCall.html), [*bookshelves volumes list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryBookshelveVolumeListCall.html), [*readingpositions get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryReadingpositionGetCall.html) and [*readingpositions set position*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.MylibraryReadingpositionSetPositionCall.html) -* [notification](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.Notification.html) - * [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.NotificationGetCall.html) + * [*annotations delete*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryAnnotationDeleteCall.html), [*annotations insert*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryAnnotationInsertCall.html), [*annotations list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryAnnotationListCall.html), [*annotations summary*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryAnnotationSummaryCall.html), [*annotations update*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryAnnotationUpdateCall.html), [*bookshelves add volume*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveAddVolumeCall.html), [*bookshelves clear volumes*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveClearVolumeCall.html), [*bookshelves get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveGetCall.html), [*bookshelves list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveListCall.html), [*bookshelves move volume*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveMoveVolumeCall.html), [*bookshelves remove volume*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveRemoveVolumeCall.html), [*bookshelves volumes list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryBookshelveVolumeListCall.html), [*readingpositions get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryReadingpositionGetCall.html) and [*readingpositions set position*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.MylibraryReadingpositionSetPositionCall.html) +* [notification](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.Notification.html) + * [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.NotificationGetCall.html) * onboarding - * [*list categories*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.OnboardingListCategoryCall.html) and [*list category volumes*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.OnboardingListCategoryVolumeCall.html) + * [*list categories*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.OnboardingListCategoryCall.html) and [*list category volumes*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.OnboardingListCategoryVolumeCall.html) * personalizedstream - * [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.PersonalizedstreamGetCall.html) + * [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.PersonalizedstreamGetCall.html) * promooffer - * [*accept*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.PromoofferAcceptCall.html), [*dismiss*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.PromoofferDismisCall.html) and [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.PromoofferGetCall.html) + * [*accept*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.PromoofferAcceptCall.html), [*dismiss*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.PromoofferDismisCall.html) and [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.PromoofferGetCall.html) * series - * [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.SeryGetCall.html) and [*membership get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.SeryMembershipGetCall.html) -* [volumes](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.Volume.html) - * [*associated list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeAssociatedListCall.html), [*get*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeGetCall.html), [*list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeListCall.html), [*mybooks list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeMybookListCall.html), [*recommended list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeRecommendedListCall.html), [*recommended rate*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeRecommendedRateCall.html) and [*useruploaded list*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.VolumeUseruploadedListCall.html) + * [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.SeryGetCall.html) and [*membership get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.SeryMembershipGetCall.html) +* [volumes](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.Volume.html) + * [*associated list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeAssociatedListCall.html), [*get*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeGetCall.html), [*list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeListCall.html), [*mybooks list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeMybookListCall.html), [*recommended list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeRecommendedListCall.html), [*recommended rate*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeRecommendedRateCall.html) and [*useruploaded list*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.VolumeUseruploadedListCall.html) @@ -45,17 +45,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-books1/1.0.5+20170313/google_books1/struct.Books.html)** +* **[Hub](https://docs.rs/google-books1/1.0.6+20170313/google_books1/struct.Books.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.Part.html)** + * **[Parts](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -158,17 +158,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-books1/1.0.5+20170313/google_books1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-books1/1.0.6+20170313/google_books1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-books1/1.0.5+20170313/google_books1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-books1/1.0.6+20170313/google_books1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-books1/1.0.6+20170313/google_books1/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")`. @@ -178,29 +178,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-books1/1.0.6+20170313/google_books1/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](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-books1/1.0.6+20170313/google_books1/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](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-books1/1.0.5+20170313/google_books1/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](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-books1/1.0.6+20170313/google_books1/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](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-books1/1.0.6+20170313/google_books1/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](https://docs.rs/google-books1/1.0.5+20170313/google_books1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-books1/1.0.6+20170313/google_books1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/books1/src/lib.rs b/gen/books1/src/lib.rs index 4ec82984de..c5eb58d376 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 *1.0.5+20170313*, where *20170313* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *books* crate version *1.0.6+20170313*, where *20170313* is the exact revision of the *books:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *books* *v1* API can be found at the //! [official documentation site](https://developers.google.com/books/docs/v1/getting_started). @@ -366,7 +366,7 @@ impl<'a, C, A> Books Books { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/books/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -410,7 +410,7 @@ impl<'a, C, A> Books } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/calendar3-cli/Cargo.toml b/gen/calendar3-cli/Cargo.toml index 53498e6fe7..657714dad6 100644 --- a/gen/calendar3-cli/Cargo.toml +++ b/gen/calendar3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-calendar3-cli" -version = "1.0.5+20170514" +version = "1.0.6+20170514" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-calendar3] path = "../calendar3" -version = "1.0.5+20170514" +version = "1.0.6+20170514" diff --git a/gen/calendar3-cli/README.md b/gen/calendar3-cli/README.md index e58543d84c..fb080dfee6 100644 --- a/gen/calendar3-cli/README.md +++ b/gen/calendar3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *calendar* API at revision *20170514*. The CLI is at version *1.0.5*. +This documentation was generated from the *calendar* API at revision *20170514*. The CLI is at version *1.0.6*. ```bash calendar3 [options] diff --git a/gen/calendar3-cli/mkdocs.yml b/gen/calendar3-cli/mkdocs.yml index 6420e60308..0f43aa4d92 100644 --- a/gen/calendar3-cli/mkdocs.yml +++ b/gen/calendar3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: calendar v1.0.5+20170514 +site_name: calendar v1.0.6+20170514 site_url: http://byron.github.io/google-apis-rs/google-calendar3-cli site_description: A complete library to interact with calendar (protocol v3) diff --git a/gen/calendar3-cli/src/cmn.rs b/gen/calendar3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/calendar3-cli/src/cmn.rs +++ b/gen/calendar3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/calendar3-cli/src/main.rs b/gen/calendar3-cli/src/main.rs index 6d832d4d80..2d42e70925 100644 --- a/gen/calendar3-cli/src/main.rs +++ b/gen/calendar3-cli/src/main.rs @@ -4386,7 +4386,7 @@ fn main() { let mut app = App::new("calendar3") .author("Sebastian Thiel ") - .version("1.0.5+20170514") + .version("1.0.6+20170514") .about("Manipulates 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") diff --git a/gen/calendar3/Cargo.toml b/gen/calendar3/Cargo.toml index 873bcaaa84..57d937ed23 100644 --- a/gen/calendar3/Cargo.toml +++ b/gen/calendar3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-calendar3" -version = "1.0.5+20170514" +version = "1.0.6+20170514" 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" homepage = "https://developers.google.com/google-apps/calendar/firstapp" -documentation = "https://docs.rs/google-calendar3/1.0.5+20170514" +documentation = "https://docs.rs/google-calendar3/1.0.6+20170514" license = "MIT" keywords = ["calendar", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/calendar3/README.md b/gen/calendar3/README.md index 18f9970cc3..fa017c1afd 100644 --- a/gen/calendar3/README.md +++ b/gen/calendar3/README.md @@ -5,43 +5,43 @@ 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 *1.0.5+20170514*, where *20170514* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *calendar* crate version *1.0.6+20170514*, where *20170514* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *calendar* *v3* API can be found at the [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarHub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarHub.html) ... -* [acl](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.Acl.html) - * [*delete*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclWatchCall.html) -* [calendar list](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarList.html) - * [*delete*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListWatchCall.html) -* [calendars](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.Calendar.html) - * [*clear*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarClearCall.html), [*delete*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarInsertCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarPatchCall.html) and [*update*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarUpdateCall.html) -* [channels](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.Channel.html) - * [*stop*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.ChannelStopCall.html) +* [acl](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.Acl.html) + * [*delete*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclWatchCall.html) +* [calendar list](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarList.html) + * [*delete*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListInsertCall.html), [*list*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListListCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListPatchCall.html), [*update*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListWatchCall.html) +* [calendars](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.Calendar.html) + * [*clear*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarClearCall.html), [*delete*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarGetCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarInsertCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarPatchCall.html) and [*update*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarUpdateCall.html) +* [channels](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.Channel.html) + * [*stop*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.ChannelStopCall.html) * colors - * [*get*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.ColorGetCall.html) -* [events](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.Event.html) - * [*delete*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventGetCall.html), [*import*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventImportCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventInsertCall.html), [*instances*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventInstanceCall.html), [*list*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventListCall.html), [*move*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventMoveCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventPatchCall.html), [*quick add*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventQuickAddCall.html), [*update*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventWatchCall.html) + * [*get*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.ColorGetCall.html) +* [events](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.Event.html) + * [*delete*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventDeleteCall.html), [*get*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventGetCall.html), [*import*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventImportCall.html), [*insert*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventInsertCall.html), [*instances*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventInstanceCall.html), [*list*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventListCall.html), [*move*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventMoveCall.html), [*patch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventPatchCall.html), [*quick add*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventQuickAddCall.html), [*update*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventUpdateCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventWatchCall.html) * freebusy - * [*query*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.FreebusyQueryCall.html) -* [settings](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.Setting.html) - * [*get*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.SettingGetCall.html), [*list*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.SettingListCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.SettingWatchCall.html) + * [*query*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.FreebusyQueryCall.html) +* [settings](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.Setting.html) + * [*get*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.SettingGetCall.html), [*list*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.SettingListCall.html) and [*watch*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.SettingWatchCall.html) Subscription supported by ... -* [*list settings*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.SettingListCall.html) -* [*list events*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventListCall.html) -* [*list calendar list*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListListCall.html) -* [*watch events*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventWatchCall.html) -* [*instances events*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.EventInstanceCall.html) -* [*watch settings*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.SettingWatchCall.html) -* [*watch acl*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclWatchCall.html) -* [*list acl*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.AclListCall.html) -* [*watch calendar list*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarListWatchCall.html) +* [*list settings*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.SettingListCall.html) +* [*list events*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventListCall.html) +* [*list calendar list*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListListCall.html) +* [*watch events*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventWatchCall.html) +* [*instances events*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.EventInstanceCall.html) +* [*watch settings*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.SettingWatchCall.html) +* [*watch acl*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclWatchCall.html) +* [*list acl*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.AclListCall.html) +* [*watch calendar list*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarListWatchCall.html) @@ -49,17 +49,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/struct.CalendarHub.html)** +* **[Hub](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/struct.CalendarHub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.Part.html)** + * **[Parts](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -175,17 +175,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/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")`. @@ -195,29 +195,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/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](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/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](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/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](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/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](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/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](https://docs.rs/google-calendar3/1.0.5+20170514/google_calendar3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-calendar3/1.0.6+20170514/google_calendar3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/calendar3/src/lib.rs b/gen/calendar3/src/lib.rs index 3a456a4d82..eeacb1cdaf 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 *1.0.5+20170514*, where *20170514* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *calendar* crate version *1.0.6+20170514*, where *20170514* is the exact revision of the *calendar:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *calendar* *v3* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/calendar/firstapp). @@ -397,7 +397,7 @@ impl<'a, C, A> CalendarHub CalendarHub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/calendar/v3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -429,7 +429,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/classroom1-cli/Cargo.toml b/gen/classroom1-cli/Cargo.toml index 80fd0f5481..a9e39e5695 100644 --- a/gen/classroom1-cli/Cargo.toml +++ b/gen/classroom1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-classroom1-cli" -version = "1.0.5+20170510" +version = "1.0.6+20170510" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-classroom1] path = "../classroom1" -version = "1.0.5+20170510" +version = "1.0.6+20170510" diff --git a/gen/classroom1-cli/README.md b/gen/classroom1-cli/README.md index b7bd84eb5b..ec1b62481e 100644 --- a/gen/classroom1-cli/README.md +++ b/gen/classroom1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *classroom* API at revision *20170510*. The CLI is at version *1.0.5*. +This documentation was generated from the *classroom* API at revision *20170510*. The CLI is at version *1.0.6*. ```bash classroom1 [options] diff --git a/gen/classroom1-cli/mkdocs.yml b/gen/classroom1-cli/mkdocs.yml index 59d913953e..36e86e2f0f 100644 --- a/gen/classroom1-cli/mkdocs.yml +++ b/gen/classroom1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: classroom v1.0.5+20170510 +site_name: classroom v1.0.6+20170510 site_url: http://byron.github.io/google-apis-rs/google-classroom1-cli site_description: A complete library to interact with classroom (protocol v1) diff --git a/gen/classroom1-cli/src/cmn.rs b/gen/classroom1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/classroom1-cli/src/cmn.rs +++ b/gen/classroom1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/classroom1-cli/src/main.rs b/gen/classroom1-cli/src/main.rs index dc7e835d60..fe05437596 100644 --- a/gen/classroom1-cli/src/main.rs +++ b/gen/classroom1-cli/src/main.rs @@ -4997,7 +4997,7 @@ fn main() { let mut app = App::new("classroom1") .author("Sebastian Thiel ") - .version("1.0.5+20170510") + .version("1.0.6+20170510") .about("Manages classes, rosters, and invitations in Google Classroom.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_classroom1_cli") .arg(Arg::with_name("url") diff --git a/gen/classroom1/Cargo.toml b/gen/classroom1/Cargo.toml index 3e539b4cf9..0453b61fee 100644 --- a/gen/classroom1/Cargo.toml +++ b/gen/classroom1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-classroom1" -version = "1.0.5+20170510" +version = "1.0.6+20170510" 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" homepage = "https://developers.google.com/classroom/" -documentation = "https://docs.rs/google-classroom1/1.0.5+20170510" +documentation = "https://docs.rs/google-classroom1/1.0.6+20170510" license = "MIT" keywords = ["classroom", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/classroom1/README.md b/gen/classroom1/README.md index 1413692291..beb166a4de 100644 --- a/gen/classroom1/README.md +++ b/gen/classroom1/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20170510*, where *20170510* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *classroom* crate version *1.0.6+20170510*, where *20170510* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *classroom* *v1* API can be found at the [official documentation site](https://developers.google.com/classroom/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.Classroom.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.Classroom.html) ... -* [courses](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.Course.html) - * [*aliases create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseAliaseCreateCall.html), [*aliases delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseAliaseDeleteCall.html), [*aliases list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseAliaseListCall.html), [*course work create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkCreateCall.html), [*course work delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkDeleteCall.html), [*course work get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkGetCall.html), [*course work list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkListCall.html), [*course work patch*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkPatchCall.html), [*course work student submissions get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionGetCall.html), [*course work student submissions list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionListCall.html), [*course work student submissions modify attachments*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html), [*course work student submissions patch*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionPatchCall.html), [*course work student submissions reclaim*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionReclaimCall.html), [*course work student submissions return*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionReturnCall.html), [*course work student submissions turn in*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionTurnInCall.html), [*create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseGetCall.html), [*list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseListCall.html), [*patch*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CoursePatchCall.html), [*students create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseStudentCreateCall.html), [*students delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseStudentDeleteCall.html), [*students get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseStudentGetCall.html), [*students list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseStudentListCall.html), [*teachers create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseTeacherCreateCall.html), [*teachers delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseTeacherDeleteCall.html), [*teachers get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseTeacherGetCall.html), [*teachers list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseTeacherListCall.html) and [*update*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.CourseUpdateCall.html) -* [invitations](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.Invitation.html) - * [*accept*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.InvitationAcceptCall.html), [*create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.InvitationCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.InvitationDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.InvitationGetCall.html) and [*list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.InvitationListCall.html) -* [user profiles](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfile.html) - * [*get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGetCall.html), [*guardian invitations create*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianInvitationCreateCall.html), [*guardian invitations get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianInvitationGetCall.html), [*guardian invitations list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianInvitationListCall.html), [*guardian invitations patch*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianInvitationPatchCall.html), [*guardians delete*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianDeleteCall.html), [*guardians get*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianGetCall.html) and [*guardians list*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.UserProfileGuardianListCall.html) +* [courses](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.Course.html) + * [*aliases create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseAliaseCreateCall.html), [*aliases delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseAliaseDeleteCall.html), [*aliases list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseAliaseListCall.html), [*course work create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkCreateCall.html), [*course work delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkDeleteCall.html), [*course work get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkGetCall.html), [*course work list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkListCall.html), [*course work patch*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkPatchCall.html), [*course work student submissions get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionGetCall.html), [*course work student submissions list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionListCall.html), [*course work student submissions modify attachments*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionModifyAttachmentCall.html), [*course work student submissions patch*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionPatchCall.html), [*course work student submissions reclaim*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionReclaimCall.html), [*course work student submissions return*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionReturnCall.html), [*course work student submissions turn in*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCourseWorkStudentSubmissionTurnInCall.html), [*create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseGetCall.html), [*list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseListCall.html), [*patch*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CoursePatchCall.html), [*students create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseStudentCreateCall.html), [*students delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseStudentDeleteCall.html), [*students get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseStudentGetCall.html), [*students list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseStudentListCall.html), [*teachers create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseTeacherCreateCall.html), [*teachers delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseTeacherDeleteCall.html), [*teachers get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseTeacherGetCall.html), [*teachers list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseTeacherListCall.html) and [*update*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.CourseUpdateCall.html) +* [invitations](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.Invitation.html) + * [*accept*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.InvitationAcceptCall.html), [*create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.InvitationCreateCall.html), [*delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.InvitationDeleteCall.html), [*get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.InvitationGetCall.html) and [*list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.InvitationListCall.html) +* [user profiles](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfile.html) + * [*get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGetCall.html), [*guardian invitations create*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianInvitationCreateCall.html), [*guardian invitations get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianInvitationGetCall.html), [*guardian invitations list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianInvitationListCall.html), [*guardian invitations patch*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianInvitationPatchCall.html), [*guardians delete*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianDeleteCall.html), [*guardians get*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianGetCall.html) and [*guardians list*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.UserProfileGuardianListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/struct.Classroom.html)** +* **[Hub](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/struct.Classroom.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.Part.html)** + * **[Parts](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -153,17 +153,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/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")`. @@ -173,29 +173,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/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](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/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](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/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](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/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](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/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](https://docs.rs/google-classroom1/1.0.5+20170510/google_classroom1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-classroom1/1.0.6+20170510/google_classroom1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/classroom1/src/lib.rs b/gen/classroom1/src/lib.rs index 4422c79e2d..ee85511906 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 *1.0.5+20170510*, where *20170510* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *classroom* crate version *1.0.6+20170510*, where *20170510* is the exact revision of the *classroom:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *classroom* *v1* API can be found at the //! [official documentation site](https://developers.google.com/classroom/). @@ -397,7 +397,7 @@ impl<'a, C, A> Classroom Classroom { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://classroom.googleapis.com/".to_string(), _root_url: "https://classroom.googleapis.com/".to_string(), } @@ -414,7 +414,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/cloudbilling1-cli/Cargo.toml b/gen/cloudbilling1-cli/Cargo.toml index 57555b3fcf..f891776d63 100644 --- a/gen/cloudbilling1-cli/Cargo.toml +++ b/gen/cloudbilling1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudbilling1-cli" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-cloudbilling1] path = "../cloudbilling1" -version = "1.0.5+20170504" +version = "1.0.6+20170504" diff --git a/gen/cloudbilling1-cli/README.md b/gen/cloudbilling1-cli/README.md index 92b9b1f666..fa2e229c0f 100644 --- a/gen/cloudbilling1-cli/README.md +++ b/gen/cloudbilling1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *cloudbilling* API at revision *20170504*. The CLI is at version *1.0.5*. +This documentation was generated from the *cloudbilling* API at revision *20170504*. The CLI is at version *1.0.6*. ```bash cloudbilling1 [options] diff --git a/gen/cloudbilling1-cli/mkdocs.yml b/gen/cloudbilling1-cli/mkdocs.yml index 20c36b215a..c51a493b23 100644 --- a/gen/cloudbilling1-cli/mkdocs.yml +++ b/gen/cloudbilling1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: cloudbilling v1.0.5+20170504 +site_name: cloudbilling v1.0.6+20170504 site_url: http://byron.github.io/google-apis-rs/google-cloudbilling1-cli site_description: A complete library to interact with cloudbilling (protocol v1) diff --git a/gen/cloudbilling1-cli/src/cmn.rs b/gen/cloudbilling1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/cloudbilling1-cli/src/cmn.rs +++ b/gen/cloudbilling1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/cloudbilling1-cli/src/main.rs b/gen/cloudbilling1-cli/src/main.rs index 392b0d64bc..52ff996edd 100644 --- a/gen/cloudbilling1-cli/src/main.rs +++ b/gen/cloudbilling1-cli/src/main.rs @@ -640,7 +640,7 @@ fn main() { let mut app = App::new("cloudbilling1") .author("Sebastian Thiel ") - .version("1.0.5+20170504") + .version("1.0.6+20170504") .about("Allows developers to manage billing for their Google Cloud Platform projects programmatically.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudbilling1_cli") diff --git a/gen/cloudbilling1/Cargo.toml b/gen/cloudbilling1/Cargo.toml index 4425887b46..677e2e76b9 100644 --- a/gen/cloudbilling1/Cargo.toml +++ b/gen/cloudbilling1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudbilling1" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" homepage = "https://cloud.google.com/billing/" -documentation = "https://docs.rs/google-cloudbilling1/1.0.5+20170504" +documentation = "https://docs.rs/google-cloudbilling1/1.0.6+20170504" license = "MIT" keywords = ["cloudbilling", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/cloudbilling1/README.md b/gen/cloudbilling1/README.md index 012b3f558a..0a77749b70 100644 --- a/gen/cloudbilling1/README.md +++ b/gen/cloudbilling1/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *cloudbilling* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *cloudbilling* *v1* API can be found at the [official documentation site](https://cloud.google.com/billing/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.Cloudbilling.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.Cloudbilling.html) ... -* [billing accounts](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.BillingAccount.html) - * [*get*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.BillingAccountGetCall.html), [*list*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.BillingAccountListCall.html) and [*projects list*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.BillingAccountProjectListCall.html) +* [billing accounts](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.BillingAccount.html) + * [*get*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.BillingAccountGetCall.html), [*list*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.BillingAccountListCall.html) and [*projects list*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.BillingAccountProjectListCall.html) * projects - * [*get billing info*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.ProjectGetBillingInfoCall.html) and [*update billing info*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.ProjectUpdateBillingInfoCall.html) + * [*get billing info*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.ProjectGetBillingInfoCall.html) and [*update billing info*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.ProjectUpdateBillingInfoCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/struct.Cloudbilling.html)** +* **[Hub](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/struct.Cloudbilling.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -122,17 +122,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/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")`. @@ -142,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](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/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](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/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](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/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](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/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](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/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](https://docs.rs/google-cloudbilling1/1.0.5+20170504/google_cloudbilling1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudbilling1/1.0.6+20170504/google_cloudbilling1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudbilling1/src/lib.rs b/gen/cloudbilling1/src/lib.rs index 99ae586c36..5ec73dbec8 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *cloudbilling* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *cloudbilling:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *cloudbilling* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/billing/). @@ -319,7 +319,7 @@ impl<'a, C, A> Cloudbilling Cloudbilling { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://cloudbilling.googleapis.com/".to_string(), _root_url: "https://cloudbilling.googleapis.com/".to_string(), } @@ -333,7 +333,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/clouddebugger2-cli/Cargo.toml b/gen/clouddebugger2-cli/Cargo.toml index cc1d4c64f8..4065954449 100644 --- a/gen/clouddebugger2-cli/Cargo.toml +++ b/gen/clouddebugger2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-clouddebugger2-cli" -version = "1.0.5+20170413" +version = "1.0.6+20170413" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Debugger (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-clouddebugger2] path = "../clouddebugger2" -version = "1.0.5+20170413" +version = "1.0.6+20170413" diff --git a/gen/clouddebugger2-cli/README.md b/gen/clouddebugger2-cli/README.md index 99822901a0..034c7e95d7 100644 --- a/gen/clouddebugger2-cli/README.md +++ b/gen/clouddebugger2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Debugger* API at revision *20170413*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud Debugger* API at revision *20170413*. The CLI is at version *1.0.6*. ```bash clouddebugger2 [options] diff --git a/gen/clouddebugger2-cli/mkdocs.yml b/gen/clouddebugger2-cli/mkdocs.yml index da3558c8c5..5d6e0dbe07 100644 --- a/gen/clouddebugger2-cli/mkdocs.yml +++ b/gen/clouddebugger2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Debugger v1.0.5+20170413 +site_name: Cloud Debugger v1.0.6+20170413 site_url: http://byron.github.io/google-apis-rs/google-clouddebugger2-cli site_description: A complete library to interact with Cloud Debugger (protocol v2) diff --git a/gen/clouddebugger2-cli/src/cmn.rs b/gen/clouddebugger2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/clouddebugger2-cli/src/cmn.rs +++ b/gen/clouddebugger2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/clouddebugger2-cli/src/main.rs b/gen/clouddebugger2-cli/src/main.rs index 56e7b8c2cb..b7b8a22a90 100644 --- a/gen/clouddebugger2-cli/src/main.rs +++ b/gen/clouddebugger2-cli/src/main.rs @@ -1022,7 +1022,7 @@ fn main() { let mut app = App::new("clouddebugger2") .author("Sebastian Thiel ") - .version("1.0.5+20170413") + .version("1.0.6+20170413") .about("Examines the call stack and variables of a 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") diff --git a/gen/clouddebugger2/Cargo.toml b/gen/clouddebugger2/Cargo.toml index cef27d889f..876adf62cf 100644 --- a/gen/clouddebugger2/Cargo.toml +++ b/gen/clouddebugger2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-clouddebugger2" -version = "1.0.5+20170413" +version = "1.0.6+20170413" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Debugger (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/clouddebugger2" homepage = "http://cloud.google.com/debugger" -documentation = "https://docs.rs/google-clouddebugger2/1.0.5+20170413" +documentation = "https://docs.rs/google-clouddebugger2/1.0.6+20170413" license = "MIT" keywords = ["clouddebugger", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/clouddebugger2/README.md b/gen/clouddebugger2/README.md index f9e0c2b917..4ae8bd7576 100644 --- a/gen/clouddebugger2/README.md +++ b/gen/clouddebugger2/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-clouddebugger2` library allows access to all features of the *Google Cloud Debugger* service. -This documentation was generated from *Cloud Debugger* crate version *1.0.5+20170413*, where *20170413* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud Debugger* crate version *1.0.6+20170413*, where *20170413* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Cloud Debugger* *v2* API can be found at the [official documentation site](http://cloud.google.com/debugger). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.CloudDebugger.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.CloudDebugger.html) ... * controller - * [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.ControllerDebuggeeBreakpointListCall.html), [*debuggees breakpoints update*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.ControllerDebuggeeBreakpointUpdateCall.html) and [*debuggees register*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.ControllerDebuggeeRegisterCall.html) + * [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.ControllerDebuggeeBreakpointListCall.html), [*debuggees breakpoints update*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.ControllerDebuggeeBreakpointUpdateCall.html) and [*debuggees register*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.ControllerDebuggeeRegisterCall.html) * debugger - * [*debuggees breakpoints delete*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointDeleteCall.html), [*debuggees breakpoints get*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointGetCall.html), [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointListCall.html), [*debuggees breakpoints set*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointSetCall.html) and [*debuggees list*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.DebuggerDebuggeeListCall.html) + * [*debuggees breakpoints delete*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointDeleteCall.html), [*debuggees breakpoints get*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointGetCall.html), [*debuggees breakpoints list*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointListCall.html), [*debuggees breakpoints set*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.DebuggerDebuggeeBreakpointSetCall.html) and [*debuggees list*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.DebuggerDebuggeeListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/struct.CloudDebugger.html)** +* **[Hub](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/struct.CloudDebugger.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.Part.html)** + * **[Parts](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -125,17 +125,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/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")`. @@ -145,29 +145,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/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](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/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](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/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](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/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](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/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](https://docs.rs/google-clouddebugger2/1.0.5+20170413/google_clouddebugger2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-clouddebugger2/1.0.6+20170413/google_clouddebugger2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/clouddebugger2/src/lib.rs b/gen/clouddebugger2/src/lib.rs index a8e25d5cd6..aa384657ff 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 *Cloud Debugger* crate version *1.0.5+20170413*, where *20170413* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud Debugger* crate version *1.0.6+20170413*, where *20170413* is the exact revision of the *clouddebugger:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Cloud Debugger* *v2* API can be found at the //! [official documentation site](http://cloud.google.com/debugger). @@ -331,7 +331,7 @@ impl<'a, C, A> CloudDebugger CloudDebugger { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://clouddebugger.googleapis.com/".to_string(), _root_url: "https://clouddebugger.googleapis.com/".to_string(), } @@ -345,7 +345,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/cloudkms1_beta1-cli/Cargo.toml b/gen/cloudkms1_beta1-cli/Cargo.toml index 9ea9852514..88a4aae2a5 100644 --- a/gen/cloudkms1_beta1-cli/Cargo.toml +++ b/gen/cloudkms1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudkms1_beta1-cli" -version = "1.0.5+20170515" +version = "1.0.6+20170515" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud KMS (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudkms1_beta1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-cloudkms1_beta1] path = "../cloudkms1_beta1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" diff --git a/gen/cloudkms1_beta1-cli/README.md b/gen/cloudkms1_beta1-cli/README.md index 8a144b218d..5e0c7f0cd0 100644 --- a/gen/cloudkms1_beta1-cli/README.md +++ b/gen/cloudkms1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud KMS* API at revision *20170515*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud KMS* API at revision *20170515*. The CLI is at version *1.0.6*. ```bash cloudkms1-beta1 [options] diff --git a/gen/cloudkms1_beta1-cli/mkdocs.yml b/gen/cloudkms1_beta1-cli/mkdocs.yml index 732f8695cd..329eac3768 100644 --- a/gen/cloudkms1_beta1-cli/mkdocs.yml +++ b/gen/cloudkms1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud KMS v1.0.5+20170515 +site_name: Cloud KMS v1.0.6+20170515 site_url: http://byron.github.io/google-apis-rs/google-cloudkms1_beta1-cli site_description: A complete library to interact with Cloud KMS (protocol v1beta1) diff --git a/gen/cloudkms1_beta1-cli/src/cmn.rs b/gen/cloudkms1_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/cloudkms1_beta1-cli/src/cmn.rs +++ b/gen/cloudkms1_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/cloudkms1_beta1-cli/src/main.rs b/gen/cloudkms1_beta1-cli/src/main.rs index d24e341f60..dfb5c283f2 100644 --- a/gen/cloudkms1_beta1-cli/src/main.rs +++ b/gen/cloudkms1_beta1-cli/src/main.rs @@ -2693,7 +2693,7 @@ fn main() { let mut app = App::new("cloudkms1-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20170515") + .version("1.0.6+20170515") .about("Manages encryption for your cloud services the same way you do on-premise. You can generate, use, rotate, and destroy AES256 encryption keys.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_cloudkms1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudkms1_beta1/Cargo.toml b/gen/cloudkms1_beta1/Cargo.toml index 8a7430197d..ba9e8befbb 100644 --- a/gen/cloudkms1_beta1/Cargo.toml +++ b/gen/cloudkms1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudkms1_beta1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud KMS (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudkms1_beta1" homepage = "https://cloud.google.com/kms/" -documentation = "https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515" +documentation = "https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515" license = "MIT" keywords = ["cloudkms", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/cloudkms1_beta1/README.md b/gen/cloudkms1_beta1/README.md index ce8f576ccc..1dcebd07fc 100644 --- a/gen/cloudkms1_beta1/README.md +++ b/gen/cloudkms1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-cloudkms1_beta1` library allows access to all features of the *Google Cloud KMS* service. -This documentation was generated from *Cloud KMS* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *cloudkms:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud KMS* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *cloudkms:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Cloud KMS* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/kms/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.CloudKMS.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.CloudKMS.html) ... * projects - * [*locations get*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationGetCall.html), [*locations key rings create*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCreateCall.html), [*locations key rings crypto keys create*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCreateCall.html), [*locations key rings crypto keys crypto key versions create*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall.html), [*locations key rings crypto keys crypto key versions destroy*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall.html), [*locations key rings crypto keys crypto key versions get*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall.html), [*locations key rings crypto keys crypto key versions list*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall.html), [*locations key rings crypto keys crypto key versions patch*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall.html), [*locations key rings crypto keys crypto key versions restore*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall.html), [*locations key rings crypto keys decrypt*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyDecryptCall.html), [*locations key rings crypto keys encrypt*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyEncryptCall.html), [*locations key rings crypto keys get*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyGetCall.html), [*locations key rings crypto keys get iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html), [*locations key rings crypto keys list*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyListCall.html), [*locations key rings crypto keys patch*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyPatchCall.html), [*locations key rings crypto keys set iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html), [*locations key rings crypto keys test iam permissions*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html), [*locations key rings crypto keys update primary version*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall.html), [*locations key rings get*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingGetCall.html), [*locations key rings get iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingGetIamPolicyCall.html), [*locations key rings list*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingListCall.html), [*locations key rings set iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingSetIamPolicyCall.html), [*locations key rings test iam permissions*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingTestIamPermissionCall.html) and [*locations list*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.ProjectLocationListCall.html) + * [*locations get*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationGetCall.html), [*locations key rings create*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCreateCall.html), [*locations key rings crypto keys create*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCreateCall.html), [*locations key rings crypto keys crypto key versions create*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionCreateCall.html), [*locations key rings crypto keys crypto key versions destroy*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionDestroyCall.html), [*locations key rings crypto keys crypto key versions get*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionGetCall.html), [*locations key rings crypto keys crypto key versions list*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionListCall.html), [*locations key rings crypto keys crypto key versions patch*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionPatchCall.html), [*locations key rings crypto keys crypto key versions restore*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyCryptoKeyVersionRestoreCall.html), [*locations key rings crypto keys decrypt*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyDecryptCall.html), [*locations key rings crypto keys encrypt*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyEncryptCall.html), [*locations key rings crypto keys get*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyGetCall.html), [*locations key rings crypto keys get iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyGetIamPolicyCall.html), [*locations key rings crypto keys list*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyListCall.html), [*locations key rings crypto keys patch*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyPatchCall.html), [*locations key rings crypto keys set iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeySetIamPolicyCall.html), [*locations key rings crypto keys test iam permissions*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyTestIamPermissionCall.html), [*locations key rings crypto keys update primary version*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingCryptoKeyUpdatePrimaryVersionCall.html), [*locations key rings get*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingGetCall.html), [*locations key rings get iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingGetIamPolicyCall.html), [*locations key rings list*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingListCall.html), [*locations key rings set iam policy*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingSetIamPolicyCall.html), [*locations key rings test iam permissions*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationKeyRingTestIamPermissionCall.html) and [*locations list*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.ProjectLocationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/struct.CloudKMS.html)** +* **[Hub](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/struct.CloudKMS.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/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")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/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](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/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](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_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](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/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](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/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](https://docs.rs/google-cloudkms1_beta1/1.0.5+20170515/google_cloudkms1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudkms1_beta1/1.0.6+20170515/google_cloudkms1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudkms1_beta1/src/lib.rs b/gen/cloudkms1_beta1/src/lib.rs index 67c2caec5e..30b3cad4fd 100644 --- a/gen/cloudkms1_beta1/src/lib.rs +++ b/gen/cloudkms1_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 *Cloud KMS* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *cloudkms:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud KMS* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *cloudkms:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Cloud KMS* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/kms/). @@ -329,7 +329,7 @@ impl<'a, C, A> CloudKMS CloudKMS { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://cloudkms.googleapis.com/".to_string(), _root_url: "https://cloudkms.googleapis.com/".to_string(), } @@ -340,7 +340,7 @@ impl<'a, C, A> CloudKMS } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/cloudlatencytest2-cli/Cargo.toml b/gen/cloudlatencytest2-cli/Cargo.toml index a6732c0020..56522094e1 100644 --- a/gen/cloudlatencytest2-cli/Cargo.toml +++ b/gen/cloudlatencytest2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudlatencytest2-cli" -version = "1.0.5+20160309" +version = "1.0.6+20160309" 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" @@ -21,9 +21,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -36,4 +36,4 @@ clap = "^2.0" [dependencies.google-cloudlatencytest2] path = "../cloudlatencytest2" -version = "1.0.5+20160309" +version = "1.0.6+20160309" diff --git a/gen/cloudlatencytest2-cli/README.md b/gen/cloudlatencytest2-cli/README.md index 9db449a83c..c35f94117e 100644 --- a/gen/cloudlatencytest2-cli/README.md +++ b/gen/cloudlatencytest2-cli/README.md @@ -22,7 +22,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *cloudlatencytest* API at revision *20160309*. The CLI is at version *1.0.5*. +This documentation was generated from the *cloudlatencytest* API at revision *20160309*. The CLI is at version *1.0.6*. ```bash cloudlatencytest2 [options] diff --git a/gen/cloudlatencytest2-cli/mkdocs.yml b/gen/cloudlatencytest2-cli/mkdocs.yml index 5b28622b78..eb383775ca 100644 --- a/gen/cloudlatencytest2-cli/mkdocs.yml +++ b/gen/cloudlatencytest2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: cloudlatencytest v1.0.5+20160309 +site_name: cloudlatencytest v1.0.6+20160309 site_url: http://byron.github.io/google-apis-rs/google-cloudlatencytest2-cli site_description: A complete library to interact with cloudlatencytest (protocol v2) diff --git a/gen/cloudlatencytest2-cli/src/cmn.rs b/gen/cloudlatencytest2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/cloudlatencytest2-cli/src/cmn.rs +++ b/gen/cloudlatencytest2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/cloudlatencytest2-cli/src/main.rs b/gen/cloudlatencytest2-cli/src/main.rs index 66f427734f..c0bc5fbbc3 100644 --- a/gen/cloudlatencytest2-cli/src/main.rs +++ b/gen/cloudlatencytest2-cli/src/main.rs @@ -367,7 +367,7 @@ fn main() { let mut app = App::new("cloudlatencytest2") .author("Sebastian Thiel ") - .version("1.0.5+20160309") + .version("1.0.6+20160309") .about("Reports 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") diff --git a/gen/cloudlatencytest2/Cargo.toml b/gen/cloudlatencytest2/Cargo.toml index 19fbb9a1d5..f9dcc269ed 100644 --- a/gen/cloudlatencytest2/Cargo.toml +++ b/gen/cloudlatencytest2/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-cloudlatencytest2" -version = "1.0.5+20160309" +version = "1.0.6+20160309" 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" -documentation = "https://docs.rs/google-cloudlatencytest2/1.0.5+20160309" +documentation = "https://docs.rs/google-cloudlatencytest2/1.0.6+20160309" license = "MIT" keywords = ["cloudlatencytest", "google", "protocol", "web", "api"] @@ -19,9 +19,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/cloudlatencytest2/README.md b/gen/cloudlatencytest2/README.md index a470834b7e..3f9d249524 100644 --- a/gen/cloudlatencytest2/README.md +++ b/gen/cloudlatencytest2/README.md @@ -5,13 +5,13 @@ 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 *1.0.5+20160309*, where *20160309* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *cloudlatencytest* crate version *1.0.6+20160309*, where *20160309* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/struct.Cloudlatencytest.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/struct.Cloudlatencytest.html) ... * statscollection - * [*updateaggregatedstats*](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/struct.StatscollectionUpdateaggregatedstatCall.html) and [*updatestats*](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/struct.StatscollectionUpdatestatCall.html) + * [*updateaggregatedstats*](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/struct.StatscollectionUpdateaggregatedstatCall.html) and [*updatestats*](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/struct.StatscollectionUpdatestatCall.html) @@ -20,17 +20,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/struct.Cloudlatencytest.html)** +* **[Hub](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/struct.Cloudlatencytest.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -119,17 +119,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/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")`. @@ -139,29 +139,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/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](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/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](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/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](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/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](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/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](https://docs.rs/google-cloudlatencytest2/1.0.5+20160309/google_cloudlatencytest2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudlatencytest2/1.0.6+20160309/google_cloudlatencytest2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudlatencytest2/src/lib.rs b/gen/cloudlatencytest2/src/lib.rs index 8ca4877e13..3548be4551 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 *1.0.5+20160309*, where *20160309* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *cloudlatencytest* crate version *1.0.6+20160309*, where *20160309* is the exact revision of the *cloudlatencytest:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/cloudlatencytest2). //! # Features //! @@ -320,7 +320,7 @@ impl<'a, C, A> Cloudlatencytest Cloudlatencytest { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://cloudlatencytest-pa.googleapis.com/v2/statscollection/".to_string(), _root_url: "https://cloudlatencytest-pa.googleapis.com/".to_string(), } @@ -331,7 +331,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/cloudmonitoring2_beta2-cli/Cargo.toml b/gen/cloudmonitoring2_beta2-cli/Cargo.toml index 35e0b5ed8a..db4220c362 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 = "1.0.5+20170501" +version = "1.0.6+20170501" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-cloudmonitoring2_beta2] path = "../cloudmonitoring2_beta2" -version = "1.0.5+20170501" +version = "1.0.6+20170501" diff --git a/gen/cloudmonitoring2_beta2-cli/README.md b/gen/cloudmonitoring2_beta2-cli/README.md index a514ac2bbc..eecf2d679f 100644 --- a/gen/cloudmonitoring2_beta2-cli/README.md +++ b/gen/cloudmonitoring2_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Monitoring* API at revision *20170501*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud Monitoring* API at revision *20170501*. The CLI is at version *1.0.6*. ```bash cloudmonitoring2-beta2 [options] diff --git a/gen/cloudmonitoring2_beta2-cli/mkdocs.yml b/gen/cloudmonitoring2_beta2-cli/mkdocs.yml index fcfc6ae58e..464994209f 100644 --- a/gen/cloudmonitoring2_beta2-cli/mkdocs.yml +++ b/gen/cloudmonitoring2_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Monitoring v1.0.5+20170501 +site_name: Cloud Monitoring v1.0.6+20170501 site_url: http://byron.github.io/google-apis-rs/google-cloudmonitoring2_beta2-cli site_description: A complete library to interact with Cloud Monitoring (protocol v2beta2) diff --git a/gen/cloudmonitoring2_beta2-cli/src/cmn.rs b/gen/cloudmonitoring2_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/cloudmonitoring2_beta2-cli/src/cmn.rs +++ b/gen/cloudmonitoring2_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/cloudmonitoring2_beta2-cli/src/main.rs b/gen/cloudmonitoring2_beta2-cli/src/main.rs index 44cc17ccaf..75caa0958d 100644 --- a/gen/cloudmonitoring2_beta2-cli/src/main.rs +++ b/gen/cloudmonitoring2_beta2-cli/src/main.rs @@ -915,7 +915,7 @@ fn main() { let mut app = App::new("cloudmonitoring2-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20170501") + .version("1.0.6+20170501") .about("Accesses Google Cloud 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") diff --git a/gen/cloudmonitoring2_beta2/Cargo.toml b/gen/cloudmonitoring2_beta2/Cargo.toml index f666efed62..ec6bd5935a 100644 --- a/gen/cloudmonitoring2_beta2/Cargo.toml +++ b/gen/cloudmonitoring2_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudmonitoring2_beta2" -version = "1.0.5+20170501" +version = "1.0.6+20170501" 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" homepage = "https://cloud.google.com/monitoring/v2beta2/" -documentation = "https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501" +documentation = "https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501" license = "MIT" keywords = ["cloudmonitoring", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/cloudmonitoring2_beta2/README.md b/gen/cloudmonitoring2_beta2/README.md index e44c3a92c8..6b3783eb52 100644 --- a/gen/cloudmonitoring2_beta2/README.md +++ b/gen/cloudmonitoring2_beta2/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20170501*, where *20170501* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud Monitoring* crate version *1.0.6+20170501*, where *20170501* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Cloud Monitoring* *v2_beta2* API can be found at the [official documentation site](https://cloud.google.com/monitoring/v2beta2/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.CloudMonitoring.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.CloudMonitoring.html) ... -* [metric descriptors](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptor.html) - * [*create*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptorCreateCall.html), [*delete*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptorDeleteCall.html) and [*list*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptorListCall.html) +* [metric descriptors](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptor.html) + * [*create*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptorCreateCall.html), [*delete*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptorDeleteCall.html) and [*list*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.MetricDescriptorListCall.html) * timeseries - * [*list*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.TimeseryListCall.html) and [*write*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.TimeseryWriteCall.html) -* [timeseries descriptors](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.TimeseriesDescriptor.html) - * [*list*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.TimeseriesDescriptorListCall.html) + * [*list*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.TimeseryListCall.html) and [*write*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.TimeseryWriteCall.html) +* [timeseries descriptors](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.TimeseriesDescriptor.html) + * [*list*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.TimeseriesDescriptorListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/struct.CloudMonitoring.html)** +* **[Hub](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/struct.CloudMonitoring.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_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")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_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](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_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](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/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](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_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](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_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](https://docs.rs/google-cloudmonitoring2_beta2/1.0.5+20170501/google_cloudmonitoring2_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudmonitoring2_beta2/1.0.6+20170501/google_cloudmonitoring2_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. diff --git a/gen/cloudmonitoring2_beta2/src/lib.rs b/gen/cloudmonitoring2_beta2/src/lib.rs index b53b782fb9..1ac857607e 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 *1.0.5+20170501*, where *20170501* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud Monitoring* crate version *1.0.6+20170501*, where *20170501* is the exact revision of the *cloudmonitoring:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Cloud Monitoring* *v2_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/monitoring/v2beta2/). @@ -339,7 +339,7 @@ impl<'a, C, A> CloudMonitoring CloudMonitoring { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/cloudmonitoring/v2beta2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -356,7 +356,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/cloudresourcemanager1-cli/Cargo.toml b/gen/cloudresourcemanager1-cli/Cargo.toml index 41cea6b0e3..9cbdbf2bb4 100644 --- a/gen/cloudresourcemanager1-cli/Cargo.toml +++ b/gen/cloudresourcemanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-cloudresourcemanager1-cli" -version = "1.0.5+20170517" +version = "1.0.6+20170517" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-cloudresourcemanager1] path = "../cloudresourcemanager1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/cloudresourcemanager1-cli/README.md b/gen/cloudresourcemanager1-cli/README.md index 6f373deb11..f8b0e90ecb 100644 --- a/gen/cloudresourcemanager1-cli/README.md +++ b/gen/cloudresourcemanager1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash cloudresourcemanager1 [options] diff --git a/gen/cloudresourcemanager1-cli/mkdocs.yml b/gen/cloudresourcemanager1-cli/mkdocs.yml index f37b2fbc44..7a77e64f19 100644 --- a/gen/cloudresourcemanager1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.5+20170517 +site_name: Cloud Resource Manager v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1-cli site_description: A complete library to interact with Cloud Resource Manager (protocol v1) diff --git a/gen/cloudresourcemanager1-cli/src/cmn.rs b/gen/cloudresourcemanager1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/cloudresourcemanager1-cli/src/cmn.rs +++ b/gen/cloudresourcemanager1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/cloudresourcemanager1-cli/src/main.rs b/gen/cloudresourcemanager1-cli/src/main.rs index 12fdcbf226..adb3e67f1d 100644 --- a/gen/cloudresourcemanager1-cli/src/main.rs +++ b/gen/cloudresourcemanager1-cli/src/main.rs @@ -4421,7 +4421,7 @@ fn main() { let mut app = App::new("cloudresourcemanager1") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .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_cli") .arg(Arg::with_name("url") diff --git a/gen/cloudresourcemanager1/Cargo.toml b/gen/cloudresourcemanager1/Cargo.toml index 4debae07f0..26c28527ab 100644 --- a/gen/cloudresourcemanager1/Cargo.toml +++ b/gen/cloudresourcemanager1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudresourcemanager1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1" homepage = "https://cloud.google.com/resource-manager" -documentation = "https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517" +documentation = "https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517" license = "MIT" keywords = ["cloudresourcemanager", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/cloudresourcemanager1/README.md b/gen/cloudresourcemanager1/README.md index 8f4b55fae4..a15ac01654 100644 --- a/gen/cloudresourcemanager1/README.md +++ b/gen/cloudresourcemanager1/README.md @@ -5,24 +5,24 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.5+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Cloud Resource Manager* *v1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.CloudResourceManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.CloudResourceManager.html) ... * folders - * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.FolderClearOrgPolicyCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.FolderGetEffectiveOrgPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.FolderGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.FolderListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.FolderListOrgPolicyCall.html) and [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.FolderSetOrgPolicyCall.html) -* [liens](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.Lien.html) - * [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.LienCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.LienDeleteCall.html) and [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.LienListCall.html) -* [operations](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.Operation.html) - * [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OperationGetCall.html) -* [organizations](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.Organization.html) - * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationClearOrgPolicyCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationGetCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationListOrgPolicyCall.html), [*search*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationSearchCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationSetOrgPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.OrganizationTestIamPermissionCall.html) -* [projects](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.Project.html) - * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectClearOrgPolicyCall.html), [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectGetAncestryCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectGetOrgPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectListCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectListOrgPolicyCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectSetOrgPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.ProjectUpdateCall.html) + * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.FolderClearOrgPolicyCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.FolderGetEffectiveOrgPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.FolderGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.FolderListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.FolderListOrgPolicyCall.html) and [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.FolderSetOrgPolicyCall.html) +* [liens](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.Lien.html) + * [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.LienCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.LienDeleteCall.html) and [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.LienListCall.html) +* [operations](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.Operation.html) + * [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OperationGetCall.html) +* [organizations](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.Organization.html) + * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationClearOrgPolicyCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationGetCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationGetOrgPolicyCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationListOrgPolicyCall.html), [*search*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationSearchCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationSetOrgPolicyCall.html) and [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.OrganizationTestIamPermissionCall.html) +* [projects](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.Project.html) + * [*clear org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectClearOrgPolicyCall.html), [*create*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectGetAncestryCall.html), [*get effective org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectGetEffectiveOrgPolicyCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectGetIamPolicyCall.html), [*get org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectGetOrgPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectListCall.html), [*list available org policy constraints*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectListAvailableOrgPolicyConstraintCall.html), [*list org policies*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectListOrgPolicyCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectSetIamPolicyCall.html), [*set org policy*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectSetOrgPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.ProjectUpdateCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/struct.CloudResourceManager.html)** +* **[Hub](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/struct.CloudResourceManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -142,17 +142,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/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")`. @@ -162,29 +162,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/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](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/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](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/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](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/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](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/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](https://docs.rs/google-cloudresourcemanager1/1.0.5+20170517/google_cloudresourcemanager1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudresourcemanager1/1.0.6+20170517/google_cloudresourcemanager1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudresourcemanager1/src/lib.rs b/gen/cloudresourcemanager1/src/lib.rs index 23c96bc8f5..929c98be51 100644 --- a/gen/cloudresourcemanager1/src/lib.rs +++ b/gen/cloudresourcemanager1/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 Resource Manager* crate version *1.0.5+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Cloud Resource Manager* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -344,7 +344,7 @@ impl<'a, C, A> CloudResourceManager CloudResourceManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://cloudresourcemanager.googleapis.com/".to_string(), _root_url: "https://cloudresourcemanager.googleapis.com/".to_string(), } @@ -367,7 +367,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/cloudresourcemanager1_beta1-cli/Cargo.toml b/gen/cloudresourcemanager1_beta1-cli/Cargo.toml index b98b75483d..a1e70a67bd 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 = "1.0.5+20170517" +version = "1.0.6+20170517" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-cloudresourcemanager1_beta1] path = "../cloudresourcemanager1_beta1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/cloudresourcemanager1_beta1-cli/README.md b/gen/cloudresourcemanager1_beta1-cli/README.md index d425489953..ad6153b301 100644 --- a/gen/cloudresourcemanager1_beta1-cli/README.md +++ b/gen/cloudresourcemanager1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Resource Manager* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud Resource Manager* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash cloudresourcemanager1-beta1 [options] diff --git a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml index 011293ab15..aee1f6ecb0 100644 --- a/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml +++ b/gen/cloudresourcemanager1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Resource Manager v1.0.5+20170517 +site_name: Cloud Resource Manager v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-cloudresourcemanager1_beta1-cli site_description: A complete library to interact with Cloud Resource Manager (protocol v1beta1) diff --git a/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs b/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/cloudresourcemanager1_beta1-cli/src/main.rs b/gen/cloudresourcemanager1_beta1-cli/src/main.rs index f6a00d3fc6..81520ea574 100644 --- a/gen/cloudresourcemanager1_beta1-cli/src/main.rs +++ b/gen/cloudresourcemanager1_beta1-cli/src/main.rs @@ -1963,7 +1963,7 @@ fn main() { let mut app = App::new("cloudresourcemanager1-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .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") diff --git a/gen/cloudresourcemanager1_beta1/Cargo.toml b/gen/cloudresourcemanager1_beta1/Cargo.toml index 369a261625..37a9dbd05a 100644 --- a/gen/cloudresourcemanager1_beta1/Cargo.toml +++ b/gen/cloudresourcemanager1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-cloudresourcemanager1_beta1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Resource Manager (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/cloudresourcemanager1_beta1" homepage = "https://cloud.google.com/resource-manager" -documentation = "https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517" +documentation = "https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517" license = "MIT" keywords = ["cloudresourcemanager", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/cloudresourcemanager1_beta1/README.md b/gen/cloudresourcemanager1_beta1/README.md index 8a2a6cffe4..b639f833c9 100644 --- a/gen/cloudresourcemanager1_beta1/README.md +++ b/gen/cloudresourcemanager1_beta1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-cloudresourcemanager1_beta1` library allows access to all features of the *Google Cloud Resource Manager* service. -This documentation was generated from *Cloud Resource Manager* crate version *1.0.5+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud Resource Manager* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Cloud Resource Manager* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/resource-manager). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html) ... -* [organizations](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.Organization.html) - * [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationGetCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationTestIamPermissionCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationUpdateCall.html) -* [projects](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.Project.html) - * [*create*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectGetAncestryCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.ProjectUpdateCall.html) +* [organizations](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.Organization.html) + * [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationGetCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationTestIamPermissionCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.OrganizationUpdateCall.html) +* [projects](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.Project.html) + * [*create*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectCreateCall.html), [*delete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectDeleteCall.html), [*get*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectGetCall.html), [*get ancestry*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectGetAncestryCall.html), [*get iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectGetIamPolicyCall.html), [*list*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectListCall.html), [*set iam policy*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectTestIamPermissionCall.html), [*undelete*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectUndeleteCall.html) and [*update*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.ProjectUpdateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html)** +* **[Hub](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/struct.CloudResourceManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/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")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/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](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/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](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_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](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/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](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/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](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.5+20170517/google_cloudresourcemanager1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-cloudresourcemanager1_beta1/1.0.6+20170517/google_cloudresourcemanager1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/cloudresourcemanager1_beta1/src/lib.rs b/gen/cloudresourcemanager1_beta1/src/lib.rs index 51facfd799..cc83d1a405 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 *Cloud Resource Manager* crate version *1.0.5+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud Resource Manager* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *cloudresourcemanager:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Cloud Resource Manager* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/resource-manager). @@ -332,7 +332,7 @@ impl<'a, C, A> CloudResourceManager CloudResourceManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://cloudresourcemanager.googleapis.com/".to_string(), _root_url: "https://cloudresourcemanager.googleapis.com/".to_string(), } @@ -346,7 +346,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/clouduseraccountsvm_beta-cli/Cargo.toml b/gen/clouduseraccountsvm_beta-cli/Cargo.toml index 022d60cea4..9a9718ff2d 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 = "1.0.5+20160316" +version = "1.0.6+20160316" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-clouduseraccountsvm_beta] path = "../clouduseraccountsvm_beta" -version = "1.0.5+20160316" +version = "1.0.6+20160316" diff --git a/gen/clouduseraccountsvm_beta-cli/README.md b/gen/clouduseraccountsvm_beta-cli/README.md index 8b58b80a9f..01e80d38cc 100644 --- a/gen/clouduseraccountsvm_beta-cli/README.md +++ b/gen/clouduseraccountsvm_beta-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud User Accounts* API at revision *20160316*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud User Accounts* API at revision *20160316*. The CLI is at version *1.0.6*. ```bash clouduseraccountsvm-beta [options] diff --git a/gen/clouduseraccountsvm_beta-cli/mkdocs.yml b/gen/clouduseraccountsvm_beta-cli/mkdocs.yml index 0dc97537a4..8ad3e1bc9b 100644 --- a/gen/clouduseraccountsvm_beta-cli/mkdocs.yml +++ b/gen/clouduseraccountsvm_beta-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud User Accounts v1.0.5+20160316 +site_name: Cloud User Accounts v1.0.6+20160316 site_url: http://byron.github.io/google-apis-rs/google-clouduseraccountsvm_beta-cli site_description: A complete library to interact with Cloud User Accounts (protocol vm_beta) diff --git a/gen/clouduseraccountsvm_beta-cli/src/cmn.rs b/gen/clouduseraccountsvm_beta-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/clouduseraccountsvm_beta-cli/src/cmn.rs +++ b/gen/clouduseraccountsvm_beta-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/clouduseraccountsvm_beta-cli/src/main.rs b/gen/clouduseraccountsvm_beta-cli/src/main.rs index d0425ca5a4..d54d1c5015 100644 --- a/gen/clouduseraccountsvm_beta-cli/src/main.rs +++ b/gen/clouduseraccountsvm_beta-cli/src/main.rs @@ -1840,7 +1840,7 @@ fn main() { let mut app = App::new("clouduseraccountsvm-beta") .author("Sebastian Thiel ") - .version("1.0.5+20160316") + .version("1.0.6+20160316") .about("Creates and manages users and groups for accessing Google Compute Engine virtual machines.") .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") diff --git a/gen/clouduseraccountsvm_beta/Cargo.toml b/gen/clouduseraccountsvm_beta/Cargo.toml index 247c12a68c..a4169449a6 100644 --- a/gen/clouduseraccountsvm_beta/Cargo.toml +++ b/gen/clouduseraccountsvm_beta/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-clouduseraccountsvm_beta" -version = "1.0.5+20160316" +version = "1.0.6+20160316" 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" homepage = "https://cloud.google.com/compute/docs/access/user-accounts/api/latest/" -documentation = "https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316" +documentation = "https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316" license = "MIT" keywords = ["clouduseraccounts", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/clouduseraccountsvm_beta/README.md b/gen/clouduseraccountsvm_beta/README.md index 7e793d58b0..20139117dc 100644 --- a/gen/clouduseraccountsvm_beta/README.md +++ b/gen/clouduseraccountsvm_beta/README.md @@ -5,22 +5,22 @@ 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 *1.0.5+20160316*, where *20160316* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud User Accounts* crate version *1.0.6+20160316*, where *20160316* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.CloudUserAccounts.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.CloudUserAccounts.html) ... * global accounts operations - * [*delete*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GlobalAccountsOperationDeleteCall.html), [*get*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GlobalAccountsOperationGetCall.html) and [*list*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GlobalAccountsOperationListCall.html) -* [groups](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.Group.html) - * [*add member*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GroupAddMemberCall.html), [*delete*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GroupGetCall.html), [*insert*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GroupListCall.html) and [*remove member*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.GroupRemoveMemberCall.html) + * [*delete*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GlobalAccountsOperationDeleteCall.html), [*get*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GlobalAccountsOperationGetCall.html) and [*list*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GlobalAccountsOperationListCall.html) +* [groups](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.Group.html) + * [*add member*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GroupAddMemberCall.html), [*delete*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GroupDeleteCall.html), [*get*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GroupGetCall.html), [*insert*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GroupListCall.html) and [*remove member*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.GroupRemoveMemberCall.html) * linux - * [*get authorized keys view*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.LinuxGetAuthorizedKeysViewCall.html) and [*get linux account views*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.LinuxGetLinuxAccountViewCall.html) -* [users](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.User.html) - * [*add public key*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.UserAddPublicKeyCall.html), [*delete*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.UserDeleteCall.html), [*get*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.UserGetCall.html), [*insert*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.UserInsertCall.html), [*list*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.UserListCall.html) and [*remove public key*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.UserRemovePublicKeyCall.html) + * [*get authorized keys view*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.LinuxGetAuthorizedKeysViewCall.html) and [*get linux account views*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.LinuxGetLinuxAccountViewCall.html) +* [users](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.User.html) + * [*add public key*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.UserAddPublicKeyCall.html), [*delete*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.UserDeleteCall.html), [*get*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.UserGetCall.html), [*insert*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.UserInsertCall.html), [*list*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.UserListCall.html) and [*remove public key*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.UserRemovePublicKeyCall.html) @@ -29,17 +29,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/struct.CloudUserAccounts.html)** +* **[Hub](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/struct.CloudUserAccounts.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.Part.html)** + * **[Parts](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -136,17 +136,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/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")`. @@ -156,29 +156,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/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](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/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](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.RequestValue.html) and -[decodable](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/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](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.RequestValue.html) and +[decodable](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/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](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/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](https://docs.rs/google-clouduseraccountsvm_beta/1.0.5+20160316/google_clouduseraccountsvm_beta/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-clouduseraccountsvm_beta/1.0.6+20160316/google_clouduseraccountsvm_beta/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/clouduseraccountsvm_beta/src/lib.rs b/gen/clouduseraccountsvm_beta/src/lib.rs index 79306d81f2..6dc182782e 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 *1.0.5+20160316*, where *20160316* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud User Accounts* crate version *1.0.6+20160316*, where *20160316* is the exact revision of the *clouduseraccounts:vm_beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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/). @@ -349,7 +349,7 @@ impl<'a, C, A> CloudUserAccounts CloudUserAccounts { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/clouduseraccounts/vm_beta/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -369,7 +369,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/container1-cli/Cargo.toml b/gen/container1-cli/Cargo.toml index a18ee8bb74..f8c1cad852 100644 --- a/gen/container1-cli/Cargo.toml +++ b/gen/container1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-container1-cli" -version = "1.0.5+20170430" +version = "1.0.6+20170430" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-container1] path = "../container1" -version = "1.0.5+20170430" +version = "1.0.6+20170430" diff --git a/gen/container1-cli/README.md b/gen/container1-cli/README.md index e0f3f0354b..592d632d25 100644 --- a/gen/container1-cli/README.md +++ b/gen/container1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *container* API at revision *20170430*. The CLI is at version *1.0.5*. +This documentation was generated from the *container* API at revision *20170430*. The CLI is at version *1.0.6*. ```bash container1 [options] diff --git a/gen/container1-cli/mkdocs.yml b/gen/container1-cli/mkdocs.yml index 5293caa9c0..bf73b9e8df 100644 --- a/gen/container1-cli/mkdocs.yml +++ b/gen/container1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: container v1.0.5+20170430 +site_name: container v1.0.6+20170430 site_url: http://byron.github.io/google-apis-rs/google-container1-cli site_description: A complete library to interact with container (protocol v1) diff --git a/gen/container1-cli/src/cmn.rs b/gen/container1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/container1-cli/src/cmn.rs +++ b/gen/container1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/container1-cli/src/main.rs b/gen/container1-cli/src/main.rs index 26753c07f9..d73c3b0bc7 100644 --- a/gen/container1-cli/src/main.rs +++ b/gen/container1-cli/src/main.rs @@ -2523,7 +2523,7 @@ fn main() { let mut app = App::new("container1") .author("Sebastian Thiel ") - .version("1.0.5+20170430") + .version("1.0.6+20170430") .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") diff --git a/gen/container1/Cargo.toml b/gen/container1/Cargo.toml index 3cd45411c4..a049fb9d40 100644 --- a/gen/container1/Cargo.toml +++ b/gen/container1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-container1" -version = "1.0.5+20170430" +version = "1.0.6+20170430" 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" homepage = "https://cloud.google.com/container-engine/" -documentation = "https://docs.rs/google-container1/1.0.5+20170430" +documentation = "https://docs.rs/google-container1/1.0.6+20170430" license = "MIT" keywords = ["container", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/container1/README.md b/gen/container1/README.md index e3db66d519..e9a912d763 100644 --- a/gen/container1/README.md +++ b/gen/container1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170430*, where *20170430* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *container* crate version *1.0.6+20170430*, where *20170430* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *container* *v1* API can be found at the [official documentation site](https://cloud.google.com/container-engine/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.Container.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.Container.html) ... * projects - * [*zones clusters complete ip rotation*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterListCall.html), [*zones clusters node pools create*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters resource labels*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set master auth*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters start ip rotation*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.ProjectZoneOperationListCall.html) + * [*zones clusters complete ip rotation*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterListCall.html), [*zones clusters node pools create*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters resource labels*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set master auth*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters start ip rotation*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.ProjectZoneOperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-container1/1.0.5+20170430/google_container1/struct.Container.html)** +* **[Hub](https://docs.rs/google-container1/1.0.6+20170430/google_container1/struct.Container.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.Part.html)** + * **[Parts](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -134,17 +134,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-container1/1.0.5+20170430/google_container1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-container1/1.0.6+20170430/google_container1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-container1/1.0.5+20170430/google_container1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-container1/1.0.6+20170430/google_container1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-container1/1.0.6+20170430/google_container1/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")`. @@ -154,29 +154,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-container1/1.0.6+20170430/google_container1/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](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-container1/1.0.6+20170430/google_container1/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](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-container1/1.0.5+20170430/google_container1/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](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-container1/1.0.6+20170430/google_container1/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](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-container1/1.0.6+20170430/google_container1/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](https://docs.rs/google-container1/1.0.5+20170430/google_container1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-container1/1.0.6+20170430/google_container1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/container1/src/lib.rs b/gen/container1/src/lib.rs index c52ac51a33..303d8e5ceb 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 *1.0.5+20170430*, where *20170430* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *container* crate version *1.0.6+20170430*, where *20170430* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *container* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/container-engine/). @@ -335,7 +335,7 @@ impl<'a, C, A> Container Container { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://container.googleapis.com/".to_string(), _root_url: "https://container.googleapis.com/".to_string(), } @@ -346,7 +346,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/content2-cli/Cargo.toml b/gen/content2-cli/Cargo.toml index e405e4f4aa..71259984b0 100644 --- a/gen/content2-cli/Cargo.toml +++ b/gen/content2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-content2-cli" -version = "1.0.5+20170519" +version = "1.0.6+20170519" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-content2] path = "../content2" -version = "1.0.5+20170519" +version = "1.0.6+20170519" diff --git a/gen/content2-cli/README.md b/gen/content2-cli/README.md index d01e795f1f..c2fc23121e 100644 --- a/gen/content2-cli/README.md +++ b/gen/content2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Shopping Content* API at revision *20170519*. The CLI is at version *1.0.5*. +This documentation was generated from the *Shopping Content* API at revision *20170519*. The CLI is at version *1.0.6*. ```bash content2 [options] diff --git a/gen/content2-cli/mkdocs.yml b/gen/content2-cli/mkdocs.yml index b2fda11957..642c1c898b 100644 --- a/gen/content2-cli/mkdocs.yml +++ b/gen/content2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v1.0.5+20170519 +site_name: Shopping Content v1.0.6+20170519 site_url: http://byron.github.io/google-apis-rs/google-content2-cli site_description: A complete library to interact with Shopping Content (protocol v2) diff --git a/gen/content2-cli/src/cmn.rs b/gen/content2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/content2-cli/src/cmn.rs +++ b/gen/content2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/content2-cli/src/main.rs b/gen/content2-cli/src/main.rs index 7067d68407..66de2dfd43 100644 --- a/gen/content2-cli/src/main.rs +++ b/gen/content2-cli/src/main.rs @@ -6398,7 +6398,7 @@ fn main() { let mut app = App::new("content2") .author("Sebastian Thiel ") - .version("1.0.5+20170519") + .version("1.0.6+20170519") .about("Manages 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") diff --git a/gen/content2/Cargo.toml b/gen/content2/Cargo.toml index f681a19d44..1e0974754a 100644 --- a/gen/content2/Cargo.toml +++ b/gen/content2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-content2" -version = "1.0.5+20170519" +version = "1.0.6+20170519" 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" homepage = "https://developers.google.com/shopping-content" -documentation = "https://docs.rs/google-content2/1.0.5+20170519" +documentation = "https://docs.rs/google-content2/1.0.6+20170519" license = "MIT" keywords = ["content", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/content2/README.md b/gen/content2/README.md index 74698a58d9..a243adc0fd 100644 --- a/gen/content2/README.md +++ b/gen/content2/README.md @@ -5,34 +5,34 @@ 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 *1.0.5+20170519*, where *20170519* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Shopping Content* crate version *1.0.6+20170519*, where *20170519* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Shopping Content* *v2* API can be found at the [official documentation site](https://developers.google.com/shopping-content). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShoppingContent.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShoppingContent.html) ... -* [accounts](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.Account.html) - * [*authinfo*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountAuthinfoCall.html), [*claimwebsite*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountClaimwebsiteCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountInsertCall.html), [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountUpdateCall.html) +* [accounts](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.Account.html) + * [*authinfo*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountAuthinfoCall.html), [*claimwebsite*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountClaimwebsiteCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountInsertCall.html), [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountUpdateCall.html) * accountstatuses - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccountstatuseListCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccountstatuseListCall.html) * accounttax - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccounttaxCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccounttaxGetCall.html), [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccounttaxListCall.html), [*patch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccounttaxPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.AccounttaxUpdateCall.html) -* [datafeeds](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.Datafeed.html) - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedInsertCall.html), [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedListCall.html), [*patch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedUpdateCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccounttaxCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccounttaxGetCall.html), [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccounttaxListCall.html), [*patch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccounttaxPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.AccounttaxUpdateCall.html) +* [datafeeds](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.Datafeed.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedInsertCall.html), [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedListCall.html), [*patch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedUpdateCall.html) * datafeedstatuses - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.DatafeedstatuseListCall.html) -* [inventory](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.Inventory.html) - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.InventoryCustombatchCall.html) and [*set*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.InventorySetCall.html) -* [orders](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.Order.html) - * [*acknowledge*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderAcknowledgeCall.html), [*advancetestorder*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderAdvancetestorderCall.html), [*cancel*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderCancelCall.html), [*cancellineitem*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderCancellineitemCall.html), [*createtestorder*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderCreatetestorderCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderGetCall.html), [*getbymerchantorderid*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderGetbymerchantorderidCall.html), [*gettestordertemplate*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderGettestordertemplateCall.html), [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderListCall.html), [*refund*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderRefundCall.html), [*returnlineitem*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderReturnlineitemCall.html), [*shiplineitems*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderShiplineitemCall.html), [*updatemerchantorderid*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderUpdatemerchantorderidCall.html) and [*updateshipment*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.OrderUpdateshipmentCall.html) -* [products](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.Product.html) - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductInsertCall.html) and [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductListCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.DatafeedstatuseListCall.html) +* [inventory](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.Inventory.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.InventoryCustombatchCall.html) and [*set*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.InventorySetCall.html) +* [orders](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.Order.html) + * [*acknowledge*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderAcknowledgeCall.html), [*advancetestorder*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderAdvancetestorderCall.html), [*cancel*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderCancelCall.html), [*cancellineitem*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderCancellineitemCall.html), [*createtestorder*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderCreatetestorderCall.html), [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderGetCall.html), [*getbymerchantorderid*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderGetbymerchantorderidCall.html), [*gettestordertemplate*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderGettestordertemplateCall.html), [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderListCall.html), [*refund*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderRefundCall.html), [*returnlineitem*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderReturnlineitemCall.html), [*shiplineitems*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderShiplineitemCall.html), [*updatemerchantorderid*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderUpdatemerchantorderidCall.html) and [*updateshipment*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.OrderUpdateshipmentCall.html) +* [products](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.Product.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductCustombatchCall.html), [*delete*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductDeleteCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductGetCall.html), [*insert*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductInsertCall.html) and [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductListCall.html) * productstatuses - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ProductstatuseListCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductstatuseCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductstatuseGetCall.html) and [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ProductstatuseListCall.html) * shippingsettings - * [*custombatch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShippingsettingCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShippingsettingGetCall.html), [*getsupportedcarriers*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShippingsettingGetsupportedcarrierCall.html), [*list*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShippingsettingListCall.html), [*patch*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShippingsettingPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShippingsettingUpdateCall.html) + * [*custombatch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShippingsettingCustombatchCall.html), [*get*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShippingsettingGetCall.html), [*getsupportedcarriers*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShippingsettingGetsupportedcarrierCall.html), [*list*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShippingsettingListCall.html), [*patch*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShippingsettingPatchCall.html) and [*update*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShippingsettingUpdateCall.html) @@ -41,17 +41,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-content2/1.0.5+20170519/google_content2/struct.ShoppingContent.html)** +* **[Hub](https://docs.rs/google-content2/1.0.6+20170519/google_content2/struct.ShoppingContent.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.Part.html)** + * **[Parts](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -155,17 +155,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-content2/1.0.5+20170519/google_content2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-content2/1.0.6+20170519/google_content2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-content2/1.0.5+20170519/google_content2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-content2/1.0.6+20170519/google_content2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-content2/1.0.6+20170519/google_content2/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")`. @@ -175,29 +175,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-content2/1.0.6+20170519/google_content2/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](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-content2/1.0.6+20170519/google_content2/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](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-content2/1.0.5+20170519/google_content2/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](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-content2/1.0.6+20170519/google_content2/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](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-content2/1.0.6+20170519/google_content2/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](https://docs.rs/google-content2/1.0.5+20170519/google_content2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-content2/1.0.6+20170519/google_content2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/content2/src/lib.rs b/gen/content2/src/lib.rs index 78bc3ce61e..823eea34dd 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 *1.0.5+20170519*, where *20170519* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Shopping Content* crate version *1.0.6+20170519*, where *20170519* is the exact revision of the *content:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Shopping Content* *v2* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). @@ -357,7 +357,7 @@ impl<'a, C, A> ShoppingContent ShoppingContent { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/content/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -395,7 +395,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/content2_sandbox-cli/Cargo.toml b/gen/content2_sandbox-cli/Cargo.toml index 98baae7978..a213e2033d 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 = "1.0.5+20170519" +version = "1.0.6+20170519" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-content2_sandbox] path = "../content2_sandbox" -version = "1.0.5+20170519" +version = "1.0.6+20170519" diff --git a/gen/content2_sandbox-cli/README.md b/gen/content2_sandbox-cli/README.md index ffe35ba39a..6589d4bf9a 100644 --- a/gen/content2_sandbox-cli/README.md +++ b/gen/content2_sandbox-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Shopping Content* API at revision *20170519*. The CLI is at version *1.0.5*. +This documentation was generated from the *Shopping Content* API at revision *20170519*. The CLI is at version *1.0.6*. ```bash content2-sandbox [options] diff --git a/gen/content2_sandbox-cli/mkdocs.yml b/gen/content2_sandbox-cli/mkdocs.yml index cfb741a665..74734dc52d 100644 --- a/gen/content2_sandbox-cli/mkdocs.yml +++ b/gen/content2_sandbox-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Shopping Content v1.0.5+20170519 +site_name: Shopping Content v1.0.6+20170519 site_url: http://byron.github.io/google-apis-rs/google-content2_sandbox-cli site_description: A complete library to interact with Shopping Content (protocol v2sandbox) diff --git a/gen/content2_sandbox-cli/src/cmn.rs b/gen/content2_sandbox-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/content2_sandbox-cli/src/cmn.rs +++ b/gen/content2_sandbox-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/content2_sandbox-cli/src/main.rs b/gen/content2_sandbox-cli/src/main.rs index 2ab9ad29f9..ee200d2c19 100644 --- a/gen/content2_sandbox-cli/src/main.rs +++ b/gen/content2_sandbox-cli/src/main.rs @@ -1819,7 +1819,7 @@ fn main() { let mut app = App::new("content2-sandbox") .author("Sebastian Thiel ") - .version("1.0.5+20170519") + .version("1.0.6+20170519") .about("Manages 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") diff --git a/gen/content2_sandbox/Cargo.toml b/gen/content2_sandbox/Cargo.toml index 4b72a5b22d..1dec20d9a7 100644 --- a/gen/content2_sandbox/Cargo.toml +++ b/gen/content2_sandbox/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-content2_sandbox" -version = "1.0.5+20170519" +version = "1.0.6+20170519" 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" homepage = "https://developers.google.com/shopping-content" -documentation = "https://docs.rs/google-content2_sandbox/1.0.5+20170519" +documentation = "https://docs.rs/google-content2_sandbox/1.0.6+20170519" license = "MIT" keywords = ["content", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/content2_sandbox/README.md b/gen/content2_sandbox/README.md index 252a143371..994b806a91 100644 --- a/gen/content2_sandbox/README.md +++ b/gen/content2_sandbox/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170519*, where *20170519* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Shopping Content* crate version *1.0.6+20170519*, where *20170519* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Shopping Content* *v2_sandbox* API can be found at the [official documentation site](https://developers.google.com/shopping-content). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.ShoppingContent.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.ShoppingContent.html) ... -* [orders](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.Order.html) - * [*acknowledge*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderAcknowledgeCall.html), [*advancetestorder*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderAdvancetestorderCall.html), [*cancel*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderCancelCall.html), [*cancellineitem*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderCancellineitemCall.html), [*createtestorder*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderCreatetestorderCall.html), [*custombatch*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderCustombatchCall.html), [*get*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderGetCall.html), [*getbymerchantorderid*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderGetbymerchantorderidCall.html), [*gettestordertemplate*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderGettestordertemplateCall.html), [*list*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderListCall.html), [*refund*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderRefundCall.html), [*returnlineitem*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderReturnlineitemCall.html), [*shiplineitems*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderShiplineitemCall.html), [*updatemerchantorderid*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderUpdatemerchantorderidCall.html) and [*updateshipment*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.OrderUpdateshipmentCall.html) +* [orders](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.Order.html) + * [*acknowledge*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderAcknowledgeCall.html), [*advancetestorder*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderAdvancetestorderCall.html), [*cancel*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderCancelCall.html), [*cancellineitem*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderCancellineitemCall.html), [*createtestorder*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderCreatetestorderCall.html), [*custombatch*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderCustombatchCall.html), [*get*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderGetCall.html), [*getbymerchantorderid*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderGetbymerchantorderidCall.html), [*gettestordertemplate*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderGettestordertemplateCall.html), [*list*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderListCall.html), [*refund*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderRefundCall.html), [*returnlineitem*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderReturnlineitemCall.html), [*shiplineitems*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderShiplineitemCall.html), [*updatemerchantorderid*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderUpdatemerchantorderidCall.html) and [*updateshipment*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.OrderUpdateshipmentCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/struct.ShoppingContent.html)** +* **[Hub](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/struct.ShoppingContent.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.Part.html)** + * **[Parts](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -137,17 +137,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/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")`. @@ -157,29 +157,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/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](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/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](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.RequestValue.html) and -[decodable](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/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](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.RequestValue.html) and +[decodable](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/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](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/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](https://docs.rs/google-content2_sandbox/1.0.5+20170519/google_content2_sandbox/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-content2_sandbox/1.0.6+20170519/google_content2_sandbox/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/content2_sandbox/src/lib.rs b/gen/content2_sandbox/src/lib.rs index ccad7e6401..7ba741d288 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 *1.0.5+20170519*, where *20170519* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Shopping Content* crate version *1.0.6+20170519*, where *20170519* is the exact revision of the *content:v2sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Shopping Content* *v2_sandbox* API can be found at the //! [official documentation site](https://developers.google.com/shopping-content). @@ -339,7 +339,7 @@ impl<'a, C, A> ShoppingContent ShoppingContent { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/content/v2sandbox/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -350,7 +350,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/coordinate1-cli/Cargo.toml b/gen/coordinate1-cli/Cargo.toml index 057222ebb3..15d07c65ee 100644 --- a/gen/coordinate1-cli/Cargo.toml +++ b/gen/coordinate1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-coordinate1-cli" -version = "1.0.5+20150811" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-coordinate1] path = "../coordinate1" -version = "1.0.5+20150811" +version = "1.0.6+20150811" diff --git a/gen/coordinate1-cli/README.md b/gen/coordinate1-cli/README.md index 560c1399d2..18fb8465c1 100644 --- a/gen/coordinate1-cli/README.md +++ b/gen/coordinate1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *coordinate* API at revision *20150811*. The CLI is at version *1.0.5*. +This documentation was generated from the *coordinate* API at revision *20150811*. The CLI is at version *1.0.6*. ```bash coordinate1 [options] diff --git a/gen/coordinate1-cli/mkdocs.yml b/gen/coordinate1-cli/mkdocs.yml index 8b053c7cc5..e1e7cc5bf9 100644 --- a/gen/coordinate1-cli/mkdocs.yml +++ b/gen/coordinate1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: coordinate v1.0.5+20150811 +site_name: coordinate v1.0.6+20150811 site_url: http://byron.github.io/google-apis-rs/google-coordinate1-cli site_description: A complete library to interact with coordinate (protocol v1) diff --git a/gen/coordinate1-cli/src/cmn.rs b/gen/coordinate1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/coordinate1-cli/src/cmn.rs +++ b/gen/coordinate1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/coordinate1-cli/src/main.rs b/gen/coordinate1-cli/src/main.rs index c5846482cf..20f22a1825 100644 --- a/gen/coordinate1-cli/src/main.rs +++ b/gen/coordinate1-cli/src/main.rs @@ -1571,7 +1571,7 @@ fn main() { let mut app = App::new("coordinate1") .author("Sebastian Thiel ") - .version("1.0.5+20150811") + .version("1.0.6+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") diff --git a/gen/coordinate1/Cargo.toml b/gen/coordinate1/Cargo.toml index e5c76eaa4c..fbbcde1fb9 100644 --- a/gen/coordinate1/Cargo.toml +++ b/gen/coordinate1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-coordinate1" -version = "1.0.5+20150811" +version = "1.0.6+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" homepage = "https://developers.google.com/coordinate/" -documentation = "https://docs.rs/google-coordinate1/1.0.5+20150811" +documentation = "https://docs.rs/google-coordinate1/1.0.6+20150811" license = "MIT" keywords = ["coordinate", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/coordinate1/README.md b/gen/coordinate1/README.md index 527cbcf904..9924ce6399 100644 --- a/gen/coordinate1/README.md +++ b/gen/coordinate1/README.md @@ -5,26 +5,26 @@ 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 *1.0.5+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *coordinate* crate version *1.0.6+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *coordinate* *v1* API can be found at the [official documentation site](https://developers.google.com/coordinate/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Coordinate.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Coordinate.html) ... -* [custom field def](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.CustomFieldDef.html) - * [*list*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.CustomFieldDefListCall.html) -* [jobs](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Job.html) - * [*get*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.JobGetCall.html), [*insert*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.JobInsertCall.html), [*list*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.JobListCall.html), [*patch*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.JobPatchCall.html) and [*update*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.JobUpdateCall.html) -* [location](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Location.html) - * [*list*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.LocationListCall.html) -* [schedule](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Schedule.html) - * [*get*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.ScheduleGetCall.html), [*patch*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.SchedulePatchCall.html) and [*update*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.ScheduleUpdateCall.html) -* [team](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Team.html) - * [*list*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.TeamListCall.html) -* [worker](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Worker.html) - * [*list*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.WorkerListCall.html) +* [custom field def](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.CustomFieldDef.html) + * [*list*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.CustomFieldDefListCall.html) +* [jobs](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Job.html) + * [*get*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.JobGetCall.html), [*insert*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.JobInsertCall.html), [*list*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.JobListCall.html), [*patch*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.JobPatchCall.html) and [*update*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.JobUpdateCall.html) +* [location](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Location.html) + * [*list*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.LocationListCall.html) +* [schedule](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Schedule.html) + * [*get*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.ScheduleGetCall.html), [*patch*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.SchedulePatchCall.html) and [*update*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.ScheduleUpdateCall.html) +* [team](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Team.html) + * [*list*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.TeamListCall.html) +* [worker](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Worker.html) + * [*list*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.WorkerListCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/struct.Coordinate.html)** +* **[Hub](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/struct.Coordinate.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.Part.html)** + * **[Parts](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -146,17 +146,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/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")`. @@ -166,29 +166,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/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](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/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](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/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](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/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](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/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](https://docs.rs/google-coordinate1/1.0.5+20150811/google_coordinate1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-coordinate1/1.0.6+20150811/google_coordinate1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/coordinate1/src/lib.rs b/gen/coordinate1/src/lib.rs index 3a25bfdc97..84cd235114 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 *1.0.5+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *coordinate* crate version *1.0.6+20150811*, where *20150811* is the exact revision of the *coordinate:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *coordinate* *v1* API can be found at the //! [official documentation site](https://developers.google.com/coordinate/). @@ -361,7 +361,7 @@ impl<'a, C, A> Coordinate Coordinate { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/coordinate/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -387,7 +387,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/customsearch1-cli/Cargo.toml b/gen/customsearch1-cli/Cargo.toml index 24fa90686c..873f4da2ab 100644 --- a/gen/customsearch1-cli/Cargo.toml +++ b/gen/customsearch1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-customsearch1-cli" -version = "1.0.5+20160411" +version = "1.0.6+20160411" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-customsearch1] path = "../customsearch1" -version = "1.0.5+20160411" +version = "1.0.6+20160411" diff --git a/gen/customsearch1-cli/README.md b/gen/customsearch1-cli/README.md index 642db11c01..f4452bffa4 100644 --- a/gen/customsearch1-cli/README.md +++ b/gen/customsearch1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *customsearch* API at revision *20160411*. The CLI is at version *1.0.5*. +This documentation was generated from the *customsearch* API at revision *20160411*. The CLI is at version *1.0.6*. ```bash customsearch1 [options] diff --git a/gen/customsearch1-cli/mkdocs.yml b/gen/customsearch1-cli/mkdocs.yml index c008c1b65b..bc4ce5b281 100644 --- a/gen/customsearch1-cli/mkdocs.yml +++ b/gen/customsearch1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: customsearch v1.0.5+20160411 +site_name: customsearch v1.0.6+20160411 site_url: http://byron.github.io/google-apis-rs/google-customsearch1-cli site_description: A complete library to interact with customsearch (protocol v1) diff --git a/gen/customsearch1-cli/src/cmn.rs b/gen/customsearch1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/customsearch1-cli/src/cmn.rs +++ b/gen/customsearch1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/customsearch1-cli/src/main.rs b/gen/customsearch1-cli/src/main.rs index 0f7fcc73d0..ae79cbf780 100644 --- a/gen/customsearch1-cli/src/main.rs +++ b/gen/customsearch1-cli/src/main.rs @@ -316,7 +316,7 @@ fn main() { let mut app = App::new("customsearch1") .author("Sebastian Thiel ") - .version("1.0.5+20160411") + .version("1.0.6+20160411") .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") diff --git a/gen/customsearch1/Cargo.toml b/gen/customsearch1/Cargo.toml index 720ac06e85..ecbecc1e41 100644 --- a/gen/customsearch1/Cargo.toml +++ b/gen/customsearch1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-customsearch1" -version = "1.0.5+20160411" +version = "1.0.6+20160411" 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" homepage = "https://developers.google.com/custom-search/v1/using_rest" -documentation = "https://docs.rs/google-customsearch1/1.0.5+20160411" +documentation = "https://docs.rs/google-customsearch1/1.0.6+20160411" license = "MIT" keywords = ["customsearch", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/customsearch1/README.md b/gen/customsearch1/README.md index 7876d561f3..7b28488f08 100644 --- a/gen/customsearch1/README.md +++ b/gen/customsearch1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20160411*, where *20160411* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *customsearch* crate version *1.0.6+20160411*, where *20160411* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *customsearch* *v1* API can be found at the [official documentation site](https://developers.google.com/custom-search/v1/using_rest). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/struct.Customsearch.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/struct.Customsearch.html) ... * cse - * [*list*](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/struct.CseListCall.html) + * [*list*](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/struct.CseListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/struct.Customsearch.html)** +* **[Hub](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/struct.Customsearch.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.Part.html)** + * **[Parts](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -147,17 +147,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/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")`. @@ -167,29 +167,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/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](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/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](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/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](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/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](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/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](https://docs.rs/google-customsearch1/1.0.5+20160411/google_customsearch1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-customsearch1/1.0.6+20160411/google_customsearch1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/customsearch1/src/lib.rs b/gen/customsearch1/src/lib.rs index 2477b805c0..54ac782968 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 *1.0.5+20160411*, where *20160411* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *customsearch* crate version *1.0.6+20160411*, where *20160411* is the exact revision of the *customsearch:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *customsearch* *v1* API can be found at the //! [official documentation site](https://developers.google.com/custom-search/v1/using_rest). @@ -351,7 +351,7 @@ impl<'a, C, A> Customsearch Customsearch { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/customsearch/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -362,7 +362,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dataproc1-cli/Cargo.toml b/gen/dataproc1-cli/Cargo.toml index b9da094a92..23e58fd4c6 100644 --- a/gen/dataproc1-cli/Cargo.toml +++ b/gen/dataproc1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dataproc1-cli" -version = "1.0.5+20170515" +version = "1.0.6+20170515" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dataproc1] path = "../dataproc1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" diff --git a/gen/dataproc1-cli/README.md b/gen/dataproc1-cli/README.md index 661943b31b..d78b81fb1a 100644 --- a/gen/dataproc1-cli/README.md +++ b/gen/dataproc1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dataproc* API at revision *20170515*. The CLI is at version *1.0.5*. +This documentation was generated from the *dataproc* API at revision *20170515*. The CLI is at version *1.0.6*. ```bash dataproc1 [options] diff --git a/gen/dataproc1-cli/mkdocs.yml b/gen/dataproc1-cli/mkdocs.yml index 5744155769..e08061bcb8 100644 --- a/gen/dataproc1-cli/mkdocs.yml +++ b/gen/dataproc1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dataproc v1.0.5+20170515 +site_name: dataproc v1.0.6+20170515 site_url: http://byron.github.io/google-apis-rs/google-dataproc1-cli site_description: A complete library to interact with dataproc (protocol v1) diff --git a/gen/dataproc1-cli/src/cmn.rs b/gen/dataproc1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dataproc1-cli/src/cmn.rs +++ b/gen/dataproc1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dataproc1-cli/src/main.rs b/gen/dataproc1-cli/src/main.rs index fe3451bd98..eedf2d8000 100644 --- a/gen/dataproc1-cli/src/main.rs +++ b/gen/dataproc1-cli/src/main.rs @@ -1982,7 +1982,7 @@ fn main() { let mut app = App::new("dataproc1") .author("Sebastian Thiel ") - .version("1.0.5+20170515") + .version("1.0.6+20170515") .about("Manages 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") diff --git a/gen/dataproc1/Cargo.toml b/gen/dataproc1/Cargo.toml index f653e7a5f5..c66e76bca0 100644 --- a/gen/dataproc1/Cargo.toml +++ b/gen/dataproc1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dataproc1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" 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 = "https://docs.rs/google-dataproc1/1.0.5+20170515" +documentation = "https://docs.rs/google-dataproc1/1.0.6+20170515" license = "MIT" keywords = ["dataproc", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dataproc1/README.md b/gen/dataproc1/README.md index 8bf0e497aa..4feb8a525f 100644 --- a/gen/dataproc1/README.md +++ b/gen/dataproc1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-dataproc1` library allows access to all features of the *Google dataproc* service. -This documentation was generated from *dataproc* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dataproc* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.Dataproc.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.Dataproc.html) ... * projects - * [*regions clusters create*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionClusterCreateCall.html), [*regions clusters delete*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionClusterDeleteCall.html), [*regions clusters diagnose*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionClusterDiagnoseCall.html), [*regions clusters get*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionClusterGetCall.html), [*regions clusters list*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionClusterListCall.html), [*regions clusters patch*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionClusterPatchCall.html), [*regions jobs cancel*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionJobCancelCall.html), [*regions jobs delete*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionJobDeleteCall.html), [*regions jobs get*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionJobGetCall.html), [*regions jobs list*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionJobListCall.html), [*regions jobs patch*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionJobPatchCall.html), [*regions jobs submit*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionJobSubmitCall.html), [*regions operations cancel*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionOperationCancelCall.html), [*regions operations delete*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionOperationDeleteCall.html), [*regions operations get*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionOperationGetCall.html) and [*regions operations list*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.ProjectRegionOperationListCall.html) + * [*regions clusters create*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionClusterCreateCall.html), [*regions clusters delete*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionClusterDeleteCall.html), [*regions clusters diagnose*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionClusterDiagnoseCall.html), [*regions clusters get*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionClusterGetCall.html), [*regions clusters list*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionClusterListCall.html), [*regions clusters patch*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionClusterPatchCall.html), [*regions jobs cancel*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionJobCancelCall.html), [*regions jobs delete*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionJobDeleteCall.html), [*regions jobs get*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionJobGetCall.html), [*regions jobs list*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionJobListCall.html), [*regions jobs patch*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionJobPatchCall.html), [*regions jobs submit*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionJobSubmitCall.html), [*regions operations cancel*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionOperationCancelCall.html), [*regions operations delete*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionOperationDeleteCall.html), [*regions operations get*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionOperationGetCall.html) and [*regions operations list*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.ProjectRegionOperationListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/struct.Dataproc.html)** +* **[Hub](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/struct.Dataproc.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.Part.html)** + * **[Parts](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dataproc1/1.0.6+20170515/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")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dataproc1/1.0.6+20170515/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](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dataproc1/1.0.6+20170515/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](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/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](https://docs.rs/google-dataproc1/1.0.6+20170515/google_dataproc1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dataproc1/1.0.6+20170515/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](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dataproc1/1.0.6+20170515/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](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dataproc1/1.0.6+20170515/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](https://docs.rs/google-dataproc1/1.0.5+20170515/google_dataproc1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dataproc1/1.0.6+20170515/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. diff --git a/gen/dataproc1/src/lib.rs b/gen/dataproc1/src/lib.rs index 4ae21b3439..774cefcb0e 100644 --- a/gen/dataproc1/src/lib.rs +++ b/gen/dataproc1/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 *dataproc* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dataproc* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *dataproc:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dataproc* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/dataproc/). @@ -329,7 +329,7 @@ impl<'a, C, A> Dataproc Dataproc { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://dataproc.googleapis.com/".to_string(), _root_url: "https://dataproc.googleapis.com/".to_string(), } @@ -340,7 +340,7 @@ impl<'a, C, A> Dataproc } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/deploymentmanager2-cli/Cargo.toml b/gen/deploymentmanager2-cli/Cargo.toml index 810129c235..ee7cb4152c 100644 --- a/gen/deploymentmanager2-cli/Cargo.toml +++ b/gen/deploymentmanager2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-deploymentmanager2-cli" -version = "1.0.5+20170501" +version = "1.0.6+20170501" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-deploymentmanager2] path = "../deploymentmanager2" -version = "1.0.5+20170501" +version = "1.0.6+20170501" diff --git a/gen/deploymentmanager2-cli/README.md b/gen/deploymentmanager2-cli/README.md index 2a9488da1d..8cf8ec8d62 100644 --- a/gen/deploymentmanager2-cli/README.md +++ b/gen/deploymentmanager2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Deployment Manager* API at revision *20170501*. The CLI is at version *1.0.5*. +This documentation was generated from the *Deployment Manager* API at revision *20170501*. The CLI is at version *1.0.6*. ```bash deploymentmanager2 [options] diff --git a/gen/deploymentmanager2-cli/mkdocs.yml b/gen/deploymentmanager2-cli/mkdocs.yml index 3a50ebee77..f1d7e1687a 100644 --- a/gen/deploymentmanager2-cli/mkdocs.yml +++ b/gen/deploymentmanager2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Deployment Manager v1.0.5+20170501 +site_name: Deployment Manager v1.0.6+20170501 site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2-cli site_description: A complete library to interact with Deployment Manager (protocol v2) diff --git a/gen/deploymentmanager2-cli/src/cmn.rs b/gen/deploymentmanager2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/deploymentmanager2-cli/src/cmn.rs +++ b/gen/deploymentmanager2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/deploymentmanager2-cli/src/main.rs b/gen/deploymentmanager2-cli/src/main.rs index d6161c1a8a..a0a7a4d7ce 100644 --- a/gen/deploymentmanager2-cli/src/main.rs +++ b/gen/deploymentmanager2-cli/src/main.rs @@ -2132,7 +2132,7 @@ fn main() { let mut app = App::new("deploymentmanager2") .author("Sebastian Thiel ") - .version("1.0.5+20170501") + .version("1.0.6+20170501") .about("Declares, configures, and deploys complex solutions on 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") diff --git a/gen/deploymentmanager2/Cargo.toml b/gen/deploymentmanager2/Cargo.toml index 09d6807e5a..c173bd7771 100644 --- a/gen/deploymentmanager2/Cargo.toml +++ b/gen/deploymentmanager2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-deploymentmanager2" -version = "1.0.5+20170501" +version = "1.0.6+20170501" 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" homepage = "https://cloud.google.com/deployment-manager/" -documentation = "https://docs.rs/google-deploymentmanager2/1.0.5+20170501" +documentation = "https://docs.rs/google-deploymentmanager2/1.0.6+20170501" license = "MIT" keywords = ["deploymentmanager", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/deploymentmanager2/README.md b/gen/deploymentmanager2/README.md index f0e4f25198..a9282ae5f6 100644 --- a/gen/deploymentmanager2/README.md +++ b/gen/deploymentmanager2/README.md @@ -5,24 +5,24 @@ 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 *1.0.5+20170501*, where *20170501* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Deployment Manager* crate version *1.0.6+20170501*, where *20170501* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Deployment Manager* *v2* API can be found at the [official documentation site](https://cloud.google.com/deployment-manager/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentManager.html) ... -* [deployments](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.Deployment.html) - * [*cancel preview*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentCancelPreviewCall.html), [*delete*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentGetCall.html), [*get iam policy*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentGetIamPolicyCall.html), [*insert*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentInsertCall.html), [*list*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentListCall.html), [*patch*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentPatchCall.html), [*set iam policy*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentSetIamPolicyCall.html), [*stop*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentStopCall.html), [*test iam permissions*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentTestIamPermissionCall.html) and [*update*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentUpdateCall.html) -* [manifests](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.Manifest.html) - * [*get*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.ManifestGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.ManifestListCall.html) -* [operations](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.Operation.html) - * [*get*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.OperationListCall.html) -* [resources](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.ResourceType.html) - * [*get*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.ResourceGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.ResourceListCall.html) -* [types](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.Type.html) - * [*list*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.TypeListCall.html) +* [deployments](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.Deployment.html) + * [*cancel preview*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentCancelPreviewCall.html), [*delete*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentGetCall.html), [*get iam policy*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentGetIamPolicyCall.html), [*insert*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentInsertCall.html), [*list*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentListCall.html), [*patch*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentPatchCall.html), [*set iam policy*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentSetIamPolicyCall.html), [*stop*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentStopCall.html), [*test iam permissions*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentTestIamPermissionCall.html) and [*update*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentUpdateCall.html) +* [manifests](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.Manifest.html) + * [*get*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.ManifestGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.ManifestListCall.html) +* [operations](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.Operation.html) + * [*get*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.OperationListCall.html) +* [resources](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.ResourceType.html) + * [*get*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.ResourceGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.ResourceListCall.html) +* [types](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.Type.html) + * [*list*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.TypeListCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/struct.DeploymentManager.html)** +* **[Hub](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/struct.DeploymentManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.Part.html)** + * **[Parts](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -143,17 +143,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/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")`. @@ -163,29 +163,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/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](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/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](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/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](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/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](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/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](https://docs.rs/google-deploymentmanager2/1.0.5+20170501/google_deploymentmanager2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-deploymentmanager2/1.0.6+20170501/google_deploymentmanager2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/deploymentmanager2/src/lib.rs b/gen/deploymentmanager2/src/lib.rs index 9e5f866902..5383b66667 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 *1.0.5+20170501*, where *20170501* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Deployment Manager* crate version *1.0.6+20170501*, where *20170501* is the exact revision of the *deploymentmanager:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Deployment Manager* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/deployment-manager/). @@ -359,7 +359,7 @@ impl<'a, C, A> DeploymentManager DeploymentManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/deploymentmanager/v2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -382,7 +382,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/deploymentmanager2_beta2-cli/Cargo.toml b/gen/deploymentmanager2_beta2-cli/Cargo.toml index 376e8f6bb3..4da913459c 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 = "1.0.5+20160201" +version = "1.0.6+20160201" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-deploymentmanager2_beta2] path = "../deploymentmanager2_beta2" -version = "1.0.5+20160201" +version = "1.0.6+20160201" diff --git a/gen/deploymentmanager2_beta2-cli/README.md b/gen/deploymentmanager2_beta2-cli/README.md index 0b85998b42..915ce340ba 100644 --- a/gen/deploymentmanager2_beta2-cli/README.md +++ b/gen/deploymentmanager2_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Deployment Manager* API at revision *20160201*. The CLI is at version *1.0.5*. +This documentation was generated from the *Deployment Manager* API at revision *20160201*. The CLI is at version *1.0.6*. ```bash deploymentmanager2-beta2 [options] diff --git a/gen/deploymentmanager2_beta2-cli/mkdocs.yml b/gen/deploymentmanager2_beta2-cli/mkdocs.yml index b548d95eeb..8839f7a342 100644 --- a/gen/deploymentmanager2_beta2-cli/mkdocs.yml +++ b/gen/deploymentmanager2_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Deployment Manager v1.0.5+20160201 +site_name: Deployment Manager v1.0.6+20160201 site_url: http://byron.github.io/google-apis-rs/google-deploymentmanager2_beta2-cli site_description: A complete library to interact with Deployment Manager (protocol v2beta2) diff --git a/gen/deploymentmanager2_beta2-cli/src/cmn.rs b/gen/deploymentmanager2_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/deploymentmanager2_beta2-cli/src/cmn.rs +++ b/gen/deploymentmanager2_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/deploymentmanager2_beta2-cli/src/main.rs b/gen/deploymentmanager2_beta2-cli/src/main.rs index 5325b51cb3..22613efdce 100644 --- a/gen/deploymentmanager2_beta2-cli/src/main.rs +++ b/gen/deploymentmanager2_beta2-cli/src/main.rs @@ -1479,7 +1479,7 @@ fn main() { let mut app = App::new("deploymentmanager2-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20160201") + .version("1.0.6+20160201") .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") diff --git a/gen/deploymentmanager2_beta2/Cargo.toml b/gen/deploymentmanager2_beta2/Cargo.toml index 6614d34958..e39a113b9f 100644 --- a/gen/deploymentmanager2_beta2/Cargo.toml +++ b/gen/deploymentmanager2_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-deploymentmanager2_beta2" -version = "1.0.5+20160201" +version = "1.0.6+20160201" 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" homepage = "https://developers.google.com/deployment-manager/" -documentation = "https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201" +documentation = "https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201" license = "MIT" keywords = ["deploymentmanager", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/deploymentmanager2_beta2/README.md b/gen/deploymentmanager2_beta2/README.md index 405be8da04..6388e564f0 100644 --- a/gen/deploymentmanager2_beta2/README.md +++ b/gen/deploymentmanager2_beta2/README.md @@ -5,24 +5,24 @@ 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 *1.0.5+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Deployment Manager* crate version *1.0.6+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Deployment Manager* *v2_beta2* API can be found at the [official documentation site](https://developers.google.com/deployment-manager/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentManager.html) ... -* [deployments](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.Deployment.html) - * [*delete*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentGetCall.html), [*insert*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentInsertCall.html), [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentListCall.html), [*patch*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentPatchCall.html) and [*update*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentUpdateCall.html) -* [manifests](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.Manifest.html) - * [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.ManifestGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.ManifestListCall.html) -* [operations](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.Operation.html) - * [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.OperationListCall.html) -* [resources](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.ResourceType.html) - * [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.ResourceGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.ResourceListCall.html) -* [types](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.Type.html) - * [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.TypeListCall.html) +* [deployments](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.Deployment.html) + * [*delete*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentGetCall.html), [*insert*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentInsertCall.html), [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentListCall.html), [*patch*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentPatchCall.html) and [*update*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentUpdateCall.html) +* [manifests](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.Manifest.html) + * [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.ManifestGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.ManifestListCall.html) +* [operations](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.Operation.html) + * [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.OperationListCall.html) +* [resources](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.ResourceType.html) + * [*get*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.ResourceGetCall.html) and [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.ResourceListCall.html) +* [types](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.Type.html) + * [*list*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.TypeListCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/struct.DeploymentManager.html)** +* **[Hub](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/struct.DeploymentManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -138,17 +138,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_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")`. @@ -158,29 +158,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_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](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_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](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/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](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_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](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_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](https://docs.rs/google-deploymentmanager2_beta2/1.0.5+20160201/google_deploymentmanager2_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-deploymentmanager2_beta2/1.0.6+20160201/google_deploymentmanager2_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. diff --git a/gen/deploymentmanager2_beta2/src/lib.rs b/gen/deploymentmanager2_beta2/src/lib.rs index a3b121f08a..de92baa4f7 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 *1.0.5+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Deployment Manager* crate version *1.0.6+20160201*, where *20160201* is the exact revision of the *deploymentmanager:v2beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Deployment Manager* *v2_beta2* API can be found at the //! [official documentation site](https://developers.google.com/deployment-manager/). @@ -354,7 +354,7 @@ impl<'a, C, A> DeploymentManager DeploymentManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/deploymentmanager/v2beta2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -377,7 +377,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d1-cli/Cargo.toml b/gen/dfareporting2d1-cli/Cargo.toml index 8898ed4fc0..1d33ff30f5 100644 --- a/gen/dfareporting2d1-cli/Cargo.toml +++ b/gen/dfareporting2d1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d1-cli" -version = "1.0.5+20160323" +version = "1.0.6+20160323" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d1] path = "../dfareporting2d1" -version = "1.0.5+20160323" +version = "1.0.6+20160323" diff --git a/gen/dfareporting2d1-cli/README.md b/gen/dfareporting2d1-cli/README.md index ebb0f90e7a..cd080d9fd1 100644 --- a/gen/dfareporting2d1-cli/README.md +++ b/gen/dfareporting2d1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20160323*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20160323*. The CLI is at version *1.0.6*. ```bash dfareporting2d1 [options] diff --git a/gen/dfareporting2d1-cli/mkdocs.yml b/gen/dfareporting2d1-cli/mkdocs.yml index 94eb5de8a6..3d62fc405c 100644 --- a/gen/dfareporting2d1-cli/mkdocs.yml +++ b/gen/dfareporting2d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20160323 +site_name: dfareporting v1.0.6+20160323 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d1-cli site_description: A complete library to interact with dfareporting (protocol v2.1) diff --git a/gen/dfareporting2d1-cli/src/cmn.rs b/gen/dfareporting2d1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d1-cli/src/cmn.rs +++ b/gen/dfareporting2d1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d1-cli/src/main.rs b/gen/dfareporting2d1-cli/src/main.rs index 57e3922abb..e5aed21556 100644 --- a/gen/dfareporting2d1-cli/src/main.rs +++ b/gen/dfareporting2d1-cli/src/main.rs @@ -22315,7 +22315,7 @@ fn main() { let mut app = App::new("dfareporting2d1") .author("Sebastian Thiel ") - .version("1.0.5+20160323") + .version("1.0.6+20160323") .about("Manages 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") diff --git a/gen/dfareporting2d1/Cargo.toml b/gen/dfareporting2d1/Cargo.toml index cb9aa71ef6..041c91c8a5 100644 --- a/gen/dfareporting2d1/Cargo.toml +++ b/gen/dfareporting2d1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d1" -version = "1.0.5+20160323" +version = "1.0.6+20160323" 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" homepage = "https://developers.google.com/doubleclick-advertisers/reporting/" -documentation = "https://docs.rs/google-dfareporting2d1/1.0.5+20160323" +documentation = "https://docs.rs/google-dfareporting2d1/1.0.6+20160323" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d1/README.md b/gen/dfareporting2d1/README.md index cc827332ef..ce21cff0a8 100644 --- a/gen/dfareporting2d1/README.md +++ b/gen/dfareporting2d1/README.md @@ -5,134 +5,134 @@ 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 *1.0.5+20160323*, where *20160323* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20160323*, where *20160323* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dfareporting* *v2d1* 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](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ContentCategoryUpdateCall.html) -* [countries](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.DirectorySiteListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.LandingPageUpdateCall.html) -* [metros](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.TargetableRemarketingListListCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.UserRoleUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ContentCategoryUpdateCall.html) +* [countries](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.DirectorySiteListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.LandingPageUpdateCall.html) +* [metros](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.TargetableRemarketingListListCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.UserRoleUpdateCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.ReportFileGetCall.html) @@ -140,17 +140,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -247,17 +247,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/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")`. @@ -267,29 +267,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/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](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/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](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/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](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/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](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/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](https://docs.rs/google-dfareporting2d1/1.0.5+20160323/google_dfareporting2d1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d1/1.0.6+20160323/google_dfareporting2d1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting2d1/src/lib.rs b/gen/dfareporting2d1/src/lib.rs index 07e7617503..2577d1eb91 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 *1.0.5+20160323*, where *20160323* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20160323*, where *20160323* is the exact revision of the *dfareporting:v2.1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d1* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). @@ -451,7 +451,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -624,7 +624,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d2-cli/Cargo.toml b/gen/dfareporting2d2-cli/Cargo.toml index 57da6de0be..fda48fc2c6 100644 --- a/gen/dfareporting2d2-cli/Cargo.toml +++ b/gen/dfareporting2d2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d2-cli" -version = "1.0.5+20160803" +version = "1.0.6+20160803" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d2] path = "../dfareporting2d2" -version = "1.0.5+20160803" +version = "1.0.6+20160803" diff --git a/gen/dfareporting2d2-cli/README.md b/gen/dfareporting2d2-cli/README.md index 7ccfe30c0c..be47cc629d 100644 --- a/gen/dfareporting2d2-cli/README.md +++ b/gen/dfareporting2d2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.6*. ```bash dfareporting2d2 [options] diff --git a/gen/dfareporting2d2-cli/mkdocs.yml b/gen/dfareporting2d2-cli/mkdocs.yml index 017dcc5f8d..f7bef6e1d9 100644 --- a/gen/dfareporting2d2-cli/mkdocs.yml +++ b/gen/dfareporting2d2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20160803 +site_name: dfareporting v1.0.6+20160803 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d2-cli site_description: A complete library to interact with dfareporting (protocol v2.2) diff --git a/gen/dfareporting2d2-cli/src/cmn.rs b/gen/dfareporting2d2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d2-cli/src/cmn.rs +++ b/gen/dfareporting2d2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d2-cli/src/main.rs b/gen/dfareporting2d2-cli/src/main.rs index 14bc757b6a..11e8a8893b 100644 --- a/gen/dfareporting2d2-cli/src/main.rs +++ b/gen/dfareporting2d2-cli/src/main.rs @@ -22335,7 +22335,7 @@ fn main() { let mut app = App::new("dfareporting2d2") .author("Sebastian Thiel ") - .version("1.0.5+20160803") + .version("1.0.6+20160803") .about("Manages 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") diff --git a/gen/dfareporting2d2/Cargo.toml b/gen/dfareporting2d2/Cargo.toml index 946cc55951..50f34d8602 100644 --- a/gen/dfareporting2d2/Cargo.toml +++ b/gen/dfareporting2d2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d2" -version = "1.0.5+20160803" +version = "1.0.6+20160803" 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" homepage = "https://developers.google.com/doubleclick-advertisers/reporting/" -documentation = "https://docs.rs/google-dfareporting2d2/1.0.5+20160803" +documentation = "https://docs.rs/google-dfareporting2d2/1.0.6+20160803" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d2/README.md b/gen/dfareporting2d2/README.md index c930e7adf9..d26c6071ff 100644 --- a/gen/dfareporting2d2/README.md +++ b/gen/dfareporting2d2/README.md @@ -5,134 +5,134 @@ 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 *1.0.5+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dfareporting* *v2d2* 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](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ContentCategoryUpdateCall.html) -* [countries](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.DirectorySiteListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.LandingPageUpdateCall.html) -* [metros](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.TargetableRemarketingListListCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.UserRoleUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ContentCategoryUpdateCall.html) +* [countries](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.DirectorySiteListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.LandingPageUpdateCall.html) +* [metros](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.TargetableRemarketingListListCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.UserRoleUpdateCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.ReportFileGetCall.html) @@ -140,17 +140,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -247,17 +247,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/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")`. @@ -267,29 +267,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/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](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/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](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/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](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/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](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/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](https://docs.rs/google-dfareporting2d2/1.0.5+20160803/google_dfareporting2d2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d2/1.0.6+20160803/google_dfareporting2d2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting2d2/src/lib.rs b/gen/dfareporting2d2/src/lib.rs index d9b38db403..c93d6cb1a5 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 *1.0.5+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). @@ -451,7 +451,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -624,7 +624,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d3-cli/Cargo.toml b/gen/dfareporting2d3-cli/Cargo.toml index 10c3b8d98c..dacfb28f8d 100644 --- a/gen/dfareporting2d3-cli/Cargo.toml +++ b/gen/dfareporting2d3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d3-cli" -version = "1.0.5+20160803" +version = "1.0.6+20160803" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d3] path = "../dfareporting2d3" -version = "1.0.5+20160803" +version = "1.0.6+20160803" diff --git a/gen/dfareporting2d3-cli/README.md b/gen/dfareporting2d3-cli/README.md index 128717fbe5..398d96e9eb 100644 --- a/gen/dfareporting2d3-cli/README.md +++ b/gen/dfareporting2d3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.6*. ```bash dfareporting2d3 [options] diff --git a/gen/dfareporting2d3-cli/mkdocs.yml b/gen/dfareporting2d3-cli/mkdocs.yml index 11063d820c..6842ae78f0 100644 --- a/gen/dfareporting2d3-cli/mkdocs.yml +++ b/gen/dfareporting2d3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20160803 +site_name: dfareporting v1.0.6+20160803 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d3-cli site_description: A complete library to interact with dfareporting (protocol v2.3) diff --git a/gen/dfareporting2d3-cli/src/cmn.rs b/gen/dfareporting2d3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d3-cli/src/cmn.rs +++ b/gen/dfareporting2d3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d3-cli/src/main.rs b/gen/dfareporting2d3-cli/src/main.rs index 521d815b77..f7fa29cac4 100644 --- a/gen/dfareporting2d3-cli/src/main.rs +++ b/gen/dfareporting2d3-cli/src/main.rs @@ -22270,7 +22270,7 @@ fn main() { let mut app = App::new("dfareporting2d3") .author("Sebastian Thiel ") - .version("1.0.5+20160803") + .version("1.0.6+20160803") .about("Manages 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") diff --git a/gen/dfareporting2d3/Cargo.toml b/gen/dfareporting2d3/Cargo.toml index d8013cecc4..726f1b4c28 100644 --- a/gen/dfareporting2d3/Cargo.toml +++ b/gen/dfareporting2d3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d3" -version = "1.0.5+20160803" +version = "1.0.6+20160803" 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 = "https://docs.rs/google-dfareporting2d3/1.0.5+20160803" +documentation = "https://docs.rs/google-dfareporting2d3/1.0.6+20160803" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d3/README.md b/gen/dfareporting2d3/README.md index 259cba2e2d..431fd8ab06 100644 --- a/gen/dfareporting2d3/README.md +++ b/gen/dfareporting2d3/README.md @@ -5,134 +5,134 @@ DO NOT EDIT ! --> The `google-dfareporting2d3` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.5+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ContentCategoryUpdateCall.html) -* [countries](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.DirectorySiteListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.LandingPageUpdateCall.html) -* [metros](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.TargetableRemarketingListListCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.UserRoleUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ContentCategoryUpdateCall.html) +* [countries](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.DirectorySiteListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.LandingPageUpdateCall.html) +* [metros](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.TargetableRemarketingListListCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.UserRoleUpdateCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.ReportFileGetCall.html) @@ -140,17 +140,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -247,17 +247,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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")`. @@ -267,29 +267,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/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](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/google_dfareporting2d3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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](https://docs.rs/google-dfareporting2d3/1.0.5+20160803/google_dfareporting2d3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d3/1.0.6+20160803/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. diff --git a/gen/dfareporting2d3/src/lib.rs b/gen/dfareporting2d3/src/lib.rs index 9a8f52373a..611eb03089 100644 --- a/gen/dfareporting2d3/src/lib.rs +++ b/gen/dfareporting2d3/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 *1.0.5+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d3* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). @@ -451,7 +451,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -624,7 +624,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d4-cli/Cargo.toml b/gen/dfareporting2d4-cli/Cargo.toml index 50cab78591..23d76d6e54 100644 --- a/gen/dfareporting2d4-cli/Cargo.toml +++ b/gen/dfareporting2d4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d4-cli" -version = "1.0.5+20160803" +version = "1.0.6+20160803" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d4-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d4] path = "../dfareporting2d4" -version = "1.0.5+20160803" +version = "1.0.6+20160803" diff --git a/gen/dfareporting2d4-cli/README.md b/gen/dfareporting2d4-cli/README.md index d4a1451105..52f6c6eb3c 100644 --- a/gen/dfareporting2d4-cli/README.md +++ b/gen/dfareporting2d4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20160803*. The CLI is at version *1.0.6*. ```bash dfareporting2d4 [options] diff --git a/gen/dfareporting2d4-cli/mkdocs.yml b/gen/dfareporting2d4-cli/mkdocs.yml index b5641e0844..c749cfae6c 100644 --- a/gen/dfareporting2d4-cli/mkdocs.yml +++ b/gen/dfareporting2d4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20160803 +site_name: dfareporting v1.0.6+20160803 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d4-cli site_description: A complete library to interact with dfareporting (protocol v2.4) diff --git a/gen/dfareporting2d4-cli/src/cmn.rs b/gen/dfareporting2d4-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d4-cli/src/cmn.rs +++ b/gen/dfareporting2d4-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d4-cli/src/main.rs b/gen/dfareporting2d4-cli/src/main.rs index bc3a1acb08..3ef33d7426 100644 --- a/gen/dfareporting2d4-cli/src/main.rs +++ b/gen/dfareporting2d4-cli/src/main.rs @@ -22273,7 +22273,7 @@ fn main() { let mut app = App::new("dfareporting2d4") .author("Sebastian Thiel ") - .version("1.0.5+20160803") + .version("1.0.6+20160803") .about("Manages 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_dfareporting2d4_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting2d4/Cargo.toml b/gen/dfareporting2d4/Cargo.toml index b0c6bd83a4..7c3246dfd4 100644 --- a/gen/dfareporting2d4/Cargo.toml +++ b/gen/dfareporting2d4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d4" -version = "1.0.5+20160803" +version = "1.0.6+20160803" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d4" homepage = "https://developers.google.com/doubleclick-advertisers/reporting/" -documentation = "https://docs.rs/google-dfareporting2d4/1.0.5+20160803" +documentation = "https://docs.rs/google-dfareporting2d4/1.0.6+20160803" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d4/README.md b/gen/dfareporting2d4/README.md index 48c394b34f..4755b7b0d4 100644 --- a/gen/dfareporting2d4/README.md +++ b/gen/dfareporting2d4/README.md @@ -5,134 +5,134 @@ DO NOT EDIT ! --> The `google-dfareporting2d4` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.5+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dfareporting* *v2d4* 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](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ContentCategoryUpdateCall.html) -* [countries](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.DirectorySiteListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.LandingPageUpdateCall.html) -* [metros](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.TargetableRemarketingListListCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.UserRoleUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ContentCategoryUpdateCall.html) +* [countries](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.DirectorySiteListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.LandingPageUpdateCall.html) +* [metros](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.TargetableRemarketingListListCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.UserRoleUpdateCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.ReportFileGetCall.html) @@ -140,17 +140,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -247,17 +247,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/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")`. @@ -267,29 +267,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/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](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/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](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/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](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/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](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/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](https://docs.rs/google-dfareporting2d4/1.0.5+20160803/google_dfareporting2d4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d4/1.0.6+20160803/google_dfareporting2d4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting2d4/src/lib.rs b/gen/dfareporting2d4/src/lib.rs index 36ca58ceb6..bba560ced1 100644 --- a/gen/dfareporting2d4/src/lib.rs +++ b/gen/dfareporting2d4/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 *1.0.5+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20160803*, where *20160803* is the exact revision of the *dfareporting:v2.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d4* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). @@ -451,7 +451,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.4/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -624,7 +624,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d5-cli/Cargo.toml b/gen/dfareporting2d5-cli/Cargo.toml index 244bd9e7d0..d079fe918d 100644 --- a/gen/dfareporting2d5-cli/Cargo.toml +++ b/gen/dfareporting2d5-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d5-cli" -version = "1.0.5+20170428" +version = "1.0.6+20170428" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.5)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d5-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d5] path = "../dfareporting2d5" -version = "1.0.5+20170428" +version = "1.0.6+20170428" diff --git a/gen/dfareporting2d5-cli/README.md b/gen/dfareporting2d5-cli/README.md index 4bda829f0a..111d939adf 100644 --- a/gen/dfareporting2d5-cli/README.md +++ b/gen/dfareporting2d5-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20170428*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20170428*. The CLI is at version *1.0.6*. ```bash dfareporting2d5 [options] diff --git a/gen/dfareporting2d5-cli/mkdocs.yml b/gen/dfareporting2d5-cli/mkdocs.yml index 6ce5aae95a..04b57b4866 100644 --- a/gen/dfareporting2d5-cli/mkdocs.yml +++ b/gen/dfareporting2d5-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20170428 +site_name: dfareporting v1.0.6+20170428 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d5-cli site_description: A complete library to interact with dfareporting (protocol v2.5) diff --git a/gen/dfareporting2d5-cli/src/cmn.rs b/gen/dfareporting2d5-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d5-cli/src/cmn.rs +++ b/gen/dfareporting2d5-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d5-cli/src/main.rs b/gen/dfareporting2d5-cli/src/main.rs index 0afe06813d..6ed9a6be4c 100644 --- a/gen/dfareporting2d5-cli/src/main.rs +++ b/gen/dfareporting2d5-cli/src/main.rs @@ -22705,7 +22705,7 @@ fn main() { let mut app = App::new("dfareporting2d5") .author("Sebastian Thiel ") - .version("1.0.5+20170428") + .version("1.0.6+20170428") .about("Manages 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_dfareporting2d5_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting2d5/Cargo.toml b/gen/dfareporting2d5/Cargo.toml index c307d86fc7..464e8d3db8 100644 --- a/gen/dfareporting2d5/Cargo.toml +++ b/gen/dfareporting2d5/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d5" -version = "1.0.5+20170428" +version = "1.0.6+20170428" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.5)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d5" homepage = "https://developers.google.com/doubleclick-advertisers/reporting/" -documentation = "https://docs.rs/google-dfareporting2d5/1.0.5+20170428" +documentation = "https://docs.rs/google-dfareporting2d5/1.0.6+20170428" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d5/README.md b/gen/dfareporting2d5/README.md index fadf00675e..ff193e0c75 100644 --- a/gen/dfareporting2d5/README.md +++ b/gen/dfareporting2d5/README.md @@ -5,138 +5,138 @@ DO NOT EDIT ! --> The `google-dfareporting2d5` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.5+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dfareporting* *v2d5* 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](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ContentCategoryUpdateCall.html) -* [conversions](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Conversion.html) - * [*batchinsert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ConversionBatchinsertCall.html) -* [countries](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DirectorySiteListCall.html) -* [dynamic targeting keys](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DynamicTargetingKey.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.DynamicTargetingKeyListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.LandingPageUpdateCall.html) -* [metros](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.TargetableRemarketingListListCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.UserRoleUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ContentCategoryUpdateCall.html) +* [conversions](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Conversion.html) + * [*batchinsert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ConversionBatchinsertCall.html) +* [countries](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DirectorySiteListCall.html) +* [dynamic targeting keys](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DynamicTargetingKey.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.DynamicTargetingKeyListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.LandingPageUpdateCall.html) +* [metros](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.TargetableRemarketingListListCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.UserRoleUpdateCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.ReportFileGetCall.html) @@ -144,17 +144,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -251,17 +251,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/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")`. @@ -271,29 +271,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/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](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/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](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/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](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/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](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/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](https://docs.rs/google-dfareporting2d5/1.0.5+20170428/google_dfareporting2d5/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d5/1.0.6+20170428/google_dfareporting2d5/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting2d5/src/lib.rs b/gen/dfareporting2d5/src/lib.rs index 803fbdd2fc..8ab0d03417 100644 --- a/gen/dfareporting2d5/src/lib.rs +++ b/gen/dfareporting2d5/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 *1.0.5+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.5* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d5* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). @@ -459,7 +459,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.5/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -638,7 +638,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d6-cli/Cargo.toml b/gen/dfareporting2d6-cli/Cargo.toml index 756c39b8c8..721f7eb2d8 100644 --- a/gen/dfareporting2d6-cli/Cargo.toml +++ b/gen/dfareporting2d6-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d6-cli" -version = "1.0.5+20170428" +version = "1.0.6+20170428" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.6)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d6-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d6] path = "../dfareporting2d6" -version = "1.0.5+20170428" +version = "1.0.6+20170428" diff --git a/gen/dfareporting2d6-cli/README.md b/gen/dfareporting2d6-cli/README.md index 78496a4aca..6bd36722c1 100644 --- a/gen/dfareporting2d6-cli/README.md +++ b/gen/dfareporting2d6-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20170428*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20170428*. The CLI is at version *1.0.6*. ```bash dfareporting2d6 [options] diff --git a/gen/dfareporting2d6-cli/mkdocs.yml b/gen/dfareporting2d6-cli/mkdocs.yml index c42d4ee701..d1ca326ad8 100644 --- a/gen/dfareporting2d6-cli/mkdocs.yml +++ b/gen/dfareporting2d6-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20170428 +site_name: dfareporting v1.0.6+20170428 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d6-cli site_description: A complete library to interact with dfareporting (protocol v2.6) diff --git a/gen/dfareporting2d6-cli/src/cmn.rs b/gen/dfareporting2d6-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d6-cli/src/cmn.rs +++ b/gen/dfareporting2d6-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d6-cli/src/main.rs b/gen/dfareporting2d6-cli/src/main.rs index 50a148b3ab..5e09c69b08 100644 --- a/gen/dfareporting2d6-cli/src/main.rs +++ b/gen/dfareporting2d6-cli/src/main.rs @@ -23404,7 +23404,7 @@ fn main() { let mut app = App::new("dfareporting2d6") .author("Sebastian Thiel ") - .version("1.0.5+20170428") + .version("1.0.6+20170428") .about("Manages 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_dfareporting2d6_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting2d6/Cargo.toml b/gen/dfareporting2d6/Cargo.toml index 65c99cff02..eaa1fa79a9 100644 --- a/gen/dfareporting2d6/Cargo.toml +++ b/gen/dfareporting2d6/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d6" -version = "1.0.5+20170428" +version = "1.0.6+20170428" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.6)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d6" homepage = "https://developers.google.com/doubleclick-advertisers/" -documentation = "https://docs.rs/google-dfareporting2d6/1.0.5+20170428" +documentation = "https://docs.rs/google-dfareporting2d6/1.0.6+20170428" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d6/README.md b/gen/dfareporting2d6/README.md index 9cb9c29d8c..3eef70bf9f 100644 --- a/gen/dfareporting2d6/README.md +++ b/gen/dfareporting2d6/README.md @@ -5,142 +5,142 @@ DO NOT EDIT ! --> The `google-dfareporting2d6` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.5+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dfareporting* *v2d6* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ContentCategoryUpdateCall.html) -* [conversions](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Conversion.html) - * [*batchinsert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ConversionBatchinsertCall.html) -* [countries](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DirectorySiteListCall.html) -* [dynamic targeting keys](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DynamicTargetingKey.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.DynamicTargetingKeyListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LandingPageUpdateCall.html) -* [languages](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Language.html) - * [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.LanguageListCall.html) -* [metros](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetableRemarketingListListCall.html) -* [targeting templates](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetingTemplate.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.TargetingTemplateUpdateCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.UserRoleUpdateCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ContentCategoryUpdateCall.html) +* [conversions](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Conversion.html) + * [*batchinsert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ConversionBatchinsertCall.html) +* [countries](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DirectorySiteListCall.html) +* [dynamic targeting keys](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DynamicTargetingKey.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.DynamicTargetingKeyListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LandingPageUpdateCall.html) +* [languages](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Language.html) + * [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.LanguageListCall.html) +* [metros](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetableRemarketingListListCall.html) +* [targeting templates](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetingTemplate.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.TargetingTemplateUpdateCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.UserRoleUpdateCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.ReportFileGetCall.html) @@ -148,17 +148,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -255,17 +255,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/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")`. @@ -275,29 +275,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/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](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/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](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/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](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/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](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/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](https://docs.rs/google-dfareporting2d6/1.0.5+20170428/google_dfareporting2d6/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d6/1.0.6+20170428/google_dfareporting2d6/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting2d6/src/lib.rs b/gen/dfareporting2d6/src/lib.rs index a5622b4315..cde39a790a 100644 --- a/gen/dfareporting2d6/src/lib.rs +++ b/gen/dfareporting2d6/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 *1.0.5+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d6* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/). @@ -463,7 +463,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.6/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -648,7 +648,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dfareporting2d7-cli/Cargo.toml b/gen/dfareporting2d7-cli/Cargo.toml index d97a607b6c..97796ee142 100644 --- a/gen/dfareporting2d7-cli/Cargo.toml +++ b/gen/dfareporting2d7-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d7-cli" -version = "1.0.5+20170428" +version = "1.0.6+20170428" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.7)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dfareporting2d7] path = "../dfareporting2d7" -version = "1.0.5+20170428" +version = "1.0.6+20170428" diff --git a/gen/dfareporting2d7-cli/README.md b/gen/dfareporting2d7-cli/README.md index ea5e9b0e3f..88036f2467 100644 --- a/gen/dfareporting2d7-cli/README.md +++ b/gen/dfareporting2d7-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dfareporting* API at revision *20170428*. The CLI is at version *1.0.5*. +This documentation was generated from the *dfareporting* API at revision *20170428*. The CLI is at version *1.0.6*. ```bash dfareporting2d7 [options] diff --git a/gen/dfareporting2d7-cli/mkdocs.yml b/gen/dfareporting2d7-cli/mkdocs.yml index d65f0b15d6..39a0401e25 100644 --- a/gen/dfareporting2d7-cli/mkdocs.yml +++ b/gen/dfareporting2d7-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v1.0.5+20170428 +site_name: dfareporting v1.0.6+20170428 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d7-cli site_description: A complete library to interact with dfareporting (protocol v2.7) diff --git a/gen/dfareporting2d7-cli/src/cmn.rs b/gen/dfareporting2d7-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dfareporting2d7-cli/src/cmn.rs +++ b/gen/dfareporting2d7-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dfareporting2d7-cli/src/main.rs b/gen/dfareporting2d7-cli/src/main.rs index ab83d099b1..432415425c 100644 --- a/gen/dfareporting2d7-cli/src/main.rs +++ b/gen/dfareporting2d7-cli/src/main.rs @@ -23630,7 +23630,7 @@ fn main() { let mut app = App::new("dfareporting2d7") .author("Sebastian Thiel ") - .version("1.0.5+20170428") + .version("1.0.6+20170428") .about("Manages 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_dfareporting2d7_cli") .arg(Arg::with_name("url") diff --git a/gen/dfareporting2d7/Cargo.toml b/gen/dfareporting2d7/Cargo.toml index 12b1cd68b6..8fc1301661 100644 --- a/gen/dfareporting2d7/Cargo.toml +++ b/gen/dfareporting2d7/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dfareporting2d7" -version = "1.0.5+20170428" +version = "1.0.6+20170428" authors = ["Sebastian Thiel "] description = "A complete library to interact with dfareporting (protocol v2.7)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/dfareporting2d7" homepage = "https://developers.google.com/doubleclick-advertisers/" -documentation = "https://docs.rs/google-dfareporting2d7/1.0.5+20170428" +documentation = "https://docs.rs/google-dfareporting2d7/1.0.6+20170428" license = "MIT" keywords = ["dfareporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dfareporting2d7/README.md b/gen/dfareporting2d7/README.md index 1f01404bca..5002b77fb0 100644 --- a/gen/dfareporting2d7/README.md +++ b/gen/dfareporting2d7/README.md @@ -5,144 +5,144 @@ DO NOT EDIT ! --> The `google-dfareporting2d7` library allows access to all features of the *Google dfareporting* service. -This documentation was generated from *dfareporting* crate version *1.0.5+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.7* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dfareporting* crate version *1.0.6+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.7* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dfareporting* *v2d7* API can be found at the [official documentation site](https://developers.google.com/doubleclick-advertisers/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Dfareporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Dfareporting.html) ... -* [account active ad summaries](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountActiveAdSummary.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountActiveAdSummaryGetCall.html) -* [account permission groups](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPermissionGroupListCall.html) -* [account permissions](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPermission.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPermissionListCall.html) -* [account user profiles](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUserProfileUpdateCall.html) -* [accounts](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Account.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AccountUpdateCall.html) -* [ads](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Ad.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdUpdateCall.html) -* [advertiser groups](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroup.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGroupUpdateCall.html) -* [advertisers](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Advertiser.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.AdvertiserUpdateCall.html) -* [browsers](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Browser.html) - * [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.BrowserListCall.html) -* [campaign creative associations](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignCreativeAssociation.html) - * [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignCreativeAssociationListCall.html) -* [campaigns](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Campaign.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CampaignUpdateCall.html) -* [change logs](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ChangeLog.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ChangeLogListCall.html) -* [cities](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.City.html) - * [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CityListCall.html) -* [connection types](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ConnectionType.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ConnectionTypeListCall.html) -* [content categories](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategory.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ContentCategoryUpdateCall.html) -* [conversions](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Conversion.html) - * [*batchinsert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ConversionBatchinsertCall.html) -* [countries](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Country.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CountryListCall.html) -* [creative assets](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeAsset.html) - * [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeAssetInsertCall.html) -* [creative field values](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValue.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldValueUpdateCall.html) -* [creative fields](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeField.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeFieldUpdateCall.html) -* [creative groups](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGroupUpdateCall.html) -* [creatives](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Creative.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeUpdateCall.html) -* [dimension values](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DimensionValue.html) - * [*query*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DimensionValueQueryCall.html) -* [directory site contacts](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySiteContact.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySiteContactListCall.html) -* [directory sites](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySite.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DirectorySiteListCall.html) -* [dynamic targeting keys](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DynamicTargetingKey.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.DynamicTargetingKeyListCall.html) -* [event tags](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTag.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.EventTagUpdateCall.html) -* [files](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.File.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FileListCall.html) -* [floodlight activities](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivity.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityUpdateCall.html) -* [floodlight activity groups](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupUpdateCall.html) -* [floodlight configurations](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightConfiguration.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FloodlightConfigurationUpdateCall.html) -* [inventory items](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.InventoryItem.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.InventoryItemListCall.html) -* [landing pages](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPage.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LandingPageUpdateCall.html) -* [languages](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Language.html) - * [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.LanguageListCall.html) -* [metros](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Metro.html) - * [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.MetroListCall.html) -* [mobile carriers](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.MobileCarrier.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.MobileCarrierListCall.html) -* [operating system versions](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OperatingSystemVersion.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OperatingSystemVersionListCall.html) -* [operating systems](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OperatingSystem.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OperatingSystemListCall.html) -* [order documents](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OrderDocument.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OrderDocumentListCall.html) -* [orders](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Order.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.OrderListCall.html) -* [placement groups](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGroupUpdateCall.html) -* [placement strategies](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategy.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementStrategyUpdateCall.html) -* [placements](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Placement.html) - * [*generatetags*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlacementUpdateCall.html) -* [platform types](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlatformType.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PlatformTypeListCall.html) -* [postal codes](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PostalCode.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.PostalCodeListCall.html) -* [projects](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Project.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ProjectListCall.html) -* [regions](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Region.html) - * [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RegionListCall.html) -* [remarketing list shares](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListShare.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListShareUpdateCall.html) -* [remarketing lists](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.RemarketingListUpdateCall.html) -* [reports](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Report.html) - * [*compatible fields query*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportUpdateCall.html) -* [sites](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Site.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SiteUpdateCall.html) -* [sizes](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Size.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SizeListCall.html) -* [subaccounts](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Subaccount.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.SubaccountUpdateCall.html) -* [targetable remarketing lists](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetableRemarketingList.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetableRemarketingListListCall.html) -* [targeting templates](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetingTemplate.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.TargetingTemplateUpdateCall.html) -* [user profiles](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserProfile.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserProfileListCall.html) -* [user role permission groups](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePermissionGroup.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePermissionGroupListCall.html) -* [user role permissions](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePermission.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePermissionListCall.html) -* [user roles](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRole.html) - * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.UserRoleUpdateCall.html) -* [video formats](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.VideoFormat.html) - * [*get*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.VideoFormatGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.VideoFormatListCall.html) +* [account active ad summaries](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountActiveAdSummary.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountActiveAdSummaryGetCall.html) +* [account permission groups](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPermissionGroupListCall.html) +* [account permissions](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPermission.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPermissionListCall.html) +* [account user profiles](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUserProfileGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUserProfileInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUserProfileListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUserProfilePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUserProfileUpdateCall.html) +* [accounts](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Account.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountGetCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AccountUpdateCall.html) +* [ads](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Ad.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdUpdateCall.html) +* [advertiser groups](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroup.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroupDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGroupUpdateCall.html) +* [advertisers](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Advertiser.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.AdvertiserUpdateCall.html) +* [browsers](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Browser.html) + * [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.BrowserListCall.html) +* [campaign creative associations](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignCreativeAssociation.html) + * [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignCreativeAssociationInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignCreativeAssociationListCall.html) +* [campaigns](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Campaign.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CampaignUpdateCall.html) +* [change logs](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ChangeLog.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ChangeLogGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ChangeLogListCall.html) +* [cities](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.City.html) + * [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CityListCall.html) +* [connection types](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ConnectionType.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ConnectionTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ConnectionTypeListCall.html) +* [content categories](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategory.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategoryDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategoryGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategoryInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategoryListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategoryPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ContentCategoryUpdateCall.html) +* [conversions](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Conversion.html) + * [*batchinsert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ConversionBatchinsertCall.html) +* [countries](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Country.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CountryGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CountryListCall.html) +* [creative assets](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeAsset.html) + * [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeAssetInsertCall.html) +* [creative field values](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValue.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValueDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValueGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValueInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValueListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValuePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldValueUpdateCall.html) +* [creative fields](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeField.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeFieldUpdateCall.html) +* [creative groups](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGroupUpdateCall.html) +* [creatives](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Creative.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeUpdateCall.html) +* [dimension values](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DimensionValue.html) + * [*query*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DimensionValueQueryCall.html) +* [directory site contacts](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySiteContact.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySiteContactGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySiteContactListCall.html) +* [directory sites](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySite.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySiteInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DirectorySiteListCall.html) +* [dynamic targeting keys](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DynamicTargetingKey.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DynamicTargetingKeyDeleteCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DynamicTargetingKeyInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.DynamicTargetingKeyListCall.html) +* [event tags](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTag.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTagDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTagGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTagInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTagListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTagPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.EventTagUpdateCall.html) +* [files](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.File.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FileListCall.html) +* [floodlight activities](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivity.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityDeleteCall.html), [*generatetag*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityUpdateCall.html) +* [floodlight activity groups](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightActivityGroupUpdateCall.html) +* [floodlight configurations](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightConfiguration.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightConfigurationGetCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightConfigurationListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightConfigurationPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FloodlightConfigurationUpdateCall.html) +* [inventory items](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.InventoryItem.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.InventoryItemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.InventoryItemListCall.html) +* [landing pages](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPage.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPageDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPageGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPageInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPageListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPagePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LandingPageUpdateCall.html) +* [languages](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Language.html) + * [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.LanguageListCall.html) +* [metros](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Metro.html) + * [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.MetroListCall.html) +* [mobile carriers](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.MobileCarrier.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.MobileCarrierGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.MobileCarrierListCall.html) +* [operating system versions](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OperatingSystemVersion.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OperatingSystemVersionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OperatingSystemVersionListCall.html) +* [operating systems](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OperatingSystem.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OperatingSystemGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OperatingSystemListCall.html) +* [order documents](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OrderDocument.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OrderDocumentGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OrderDocumentListCall.html) +* [orders](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Order.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OrderGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.OrderListCall.html) +* [placement groups](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGroupGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGroupInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGroupListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGroupPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGroupUpdateCall.html) +* [placement strategies](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategy.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategyDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategyGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategyInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategyListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategyPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementStrategyUpdateCall.html) +* [placements](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Placement.html) + * [*generatetags*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGeneratetagCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlacementUpdateCall.html) +* [platform types](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlatformType.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlatformTypeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PlatformTypeListCall.html) +* [postal codes](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PostalCode.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PostalCodeGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.PostalCodeListCall.html) +* [projects](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Project.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ProjectGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ProjectListCall.html) +* [regions](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Region.html) + * [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RegionListCall.html) +* [remarketing list shares](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListShare.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListShareGetCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListSharePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListShareUpdateCall.html) +* [remarketing lists](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.RemarketingListUpdateCall.html) +* [reports](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Report.html) + * [*compatible fields query*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportCompatibleFieldQueryCall.html), [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportDeleteCall.html), [*files get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportFileGetCall.html), [*files list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportFileListCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportPatchCall.html), [*run*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportRunCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportUpdateCall.html) +* [sites](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Site.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SiteGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SiteInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SiteListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SitePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SiteUpdateCall.html) +* [sizes](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Size.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SizeGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SizeInsertCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SizeListCall.html) +* [subaccounts](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Subaccount.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SubaccountGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SubaccountInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SubaccountListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SubaccountPatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.SubaccountUpdateCall.html) +* [targetable remarketing lists](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetableRemarketingList.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetableRemarketingListGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetableRemarketingListListCall.html) +* [targeting templates](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetingTemplate.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetingTemplateGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetingTemplateInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetingTemplateListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetingTemplatePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.TargetingTemplateUpdateCall.html) +* [user profiles](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserProfile.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserProfileGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserProfileListCall.html) +* [user role permission groups](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePermissionGroup.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePermissionGroupGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePermissionGroupListCall.html) +* [user role permissions](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePermission.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePermissionGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePermissionListCall.html) +* [user roles](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRole.html) + * [*delete*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRoleDeleteCall.html), [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRoleGetCall.html), [*insert*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRoleInsertCall.html), [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRoleListCall.html), [*patch*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRolePatchCall.html) and [*update*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.UserRoleUpdateCall.html) +* [video formats](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.VideoFormat.html) + * [*get*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.VideoFormatGetCall.html) and [*list*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.VideoFormatListCall.html) Upload supported by ... -* [*insert creative assets*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.CreativeAssetInsertCall.html) +* [*insert creative assets*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.CreativeAssetInsertCall.html) Download supported by ... -* [*get files*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.FileGetCall.html) -* [*files get reports*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.ReportFileGetCall.html) +* [*get files*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.FileGetCall.html) +* [*files get reports*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.ReportFileGetCall.html) @@ -150,17 +150,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/struct.Dfareporting.html)** +* **[Hub](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/struct.Dfareporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.Part.html)** + * **[Parts](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -257,17 +257,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/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")`. @@ -277,29 +277,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/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](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/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](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/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](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/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](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/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](https://docs.rs/google-dfareporting2d7/1.0.5+20170428/google_dfareporting2d7/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dfareporting2d7/1.0.6+20170428/google_dfareporting2d7/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dfareporting2d7/src/lib.rs b/gen/dfareporting2d7/src/lib.rs index e1266aae22..3afa60e5fe 100644 --- a/gen/dfareporting2d7/src/lib.rs +++ b/gen/dfareporting2d7/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 *1.0.5+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.7* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dfareporting* crate version *1.0.6+20170428*, where *20170428* is the exact revision of the *dfareporting:v2.7* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dfareporting* *v2d7* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-advertisers/). @@ -465,7 +465,7 @@ impl<'a, C, A> Dfareporting Dfareporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dfareporting/v2.7/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -653,7 +653,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/discovery1-cli/Cargo.toml b/gen/discovery1-cli/Cargo.toml index 743cfcb94d..bd16f54eaf 100644 --- a/gen/discovery1-cli/Cargo.toml +++ b/gen/discovery1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-discovery1-cli" -version = "1.0.5+00000000" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-discovery1] path = "../discovery1" -version = "1.0.5+00000000" +version = "1.0.6+00000000" diff --git a/gen/discovery1-cli/README.md b/gen/discovery1-cli/README.md index d0266e68fa..bbe6fbb6e6 100644 --- a/gen/discovery1-cli/README.md +++ b/gen/discovery1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *discovery* API at revision *00000000*. The CLI is at version *1.0.5*. +This documentation was generated from the *discovery* API at revision *00000000*. The CLI is at version *1.0.6*. ```bash discovery1 [options] diff --git a/gen/discovery1-cli/mkdocs.yml b/gen/discovery1-cli/mkdocs.yml index 4312ea8635..fbb86d69a1 100644 --- a/gen/discovery1-cli/mkdocs.yml +++ b/gen/discovery1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: discovery v1.0.5+00000000 +site_name: discovery v1.0.6+00000000 site_url: http://byron.github.io/google-apis-rs/google-discovery1-cli site_description: A complete library to interact with discovery (protocol v1) diff --git a/gen/discovery1-cli/src/cmn.rs b/gen/discovery1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/discovery1-cli/src/cmn.rs +++ b/gen/discovery1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/discovery1-cli/src/main.rs b/gen/discovery1-cli/src/main.rs index ef75b4220f..ed7f41c3d7 100644 --- a/gen/discovery1-cli/src/main.rs +++ b/gen/discovery1-cli/src/main.rs @@ -303,7 +303,7 @@ fn main() { let mut app = App::new("discovery1") .author("Sebastian Thiel ") - .version("1.0.5+00000000") + .version("1.0.6+00000000") .about("Provides 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") diff --git a/gen/discovery1/Cargo.toml b/gen/discovery1/Cargo.toml index 3ef00b0d1d..d2031c90a0 100644 --- a/gen/discovery1/Cargo.toml +++ b/gen/discovery1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-discovery1" -version = "1.0.5+00000000" +version = "1.0.6+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" homepage = "https://developers.google.com/discovery/" -documentation = "https://docs.rs/google-discovery1/1.0.5+00000000" +documentation = "https://docs.rs/google-discovery1/1.0.6+00000000" license = "MIT" keywords = ["discovery", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/discovery1/README.md b/gen/discovery1/README.md index 2bb234016b..24134932a1 100644 --- a/gen/discovery1/README.md +++ b/gen/discovery1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *discovery* crate version *1.0.6+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *discovery* *v1* API can be found at the [official documentation site](https://developers.google.com/discovery/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/struct.Discovery.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/struct.Discovery.html) ... * apis - * [*get rest*](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/struct.ApiGetRestCall.html) and [*list*](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/struct.ApiListCall.html) + * [*get rest*](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/struct.ApiGetRestCall.html) and [*list*](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/struct.ApiListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/struct.Discovery.html)** +* **[Hub](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/struct.Discovery.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.Part.html)** + * **[Parts](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -116,17 +116,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/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")`. @@ -136,29 +136,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/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](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/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](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/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](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/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](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/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](https://docs.rs/google-discovery1/1.0.5+00000000/google_discovery1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-discovery1/1.0.6+00000000/google_discovery1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/discovery1/src/lib.rs b/gen/discovery1/src/lib.rs index b26247a7f0..00acdaab4b 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 *1.0.5+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *discovery* crate version *1.0.6+00000000*, where *00000000* is the exact revision of the *discovery:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *discovery* *v1* API can be found at the //! [official documentation site](https://developers.google.com/discovery/). @@ -289,7 +289,7 @@ impl<'a, C, A> Discovery Discovery { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/discovery/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -300,7 +300,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/dns1-cli/Cargo.toml b/gen/dns1-cli/Cargo.toml index f2b91c5ae4..911b423e13 100644 --- a/gen/dns1-cli/Cargo.toml +++ b/gen/dns1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dns1-cli" -version = "1.0.5+20170512" +version = "1.0.6+20170512" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-dns1] path = "../dns1" -version = "1.0.5+20170512" +version = "1.0.6+20170512" diff --git a/gen/dns1-cli/README.md b/gen/dns1-cli/README.md index 416724016e..45be90c79b 100644 --- a/gen/dns1-cli/README.md +++ b/gen/dns1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *dns* API at revision *20170512*. The CLI is at version *1.0.5*. +This documentation was generated from the *dns* API at revision *20170512*. The CLI is at version *1.0.6*. ```bash dns1 [options] diff --git a/gen/dns1-cli/mkdocs.yml b/gen/dns1-cli/mkdocs.yml index 88e5331189..9641c19133 100644 --- a/gen/dns1-cli/mkdocs.yml +++ b/gen/dns1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dns v1.0.5+20170512 +site_name: dns v1.0.6+20170512 site_url: http://byron.github.io/google-apis-rs/google-dns1-cli site_description: A complete library to interact with dns (protocol v1) diff --git a/gen/dns1-cli/src/cmn.rs b/gen/dns1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/dns1-cli/src/cmn.rs +++ b/gen/dns1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/dns1-cli/src/main.rs b/gen/dns1-cli/src/main.rs index 777d8de25a..58e04f11ad 100644 --- a/gen/dns1-cli/src/main.rs +++ b/gen/dns1-cli/src/main.rs @@ -1026,7 +1026,7 @@ fn main() { let mut app = App::new("dns1") .author("Sebastian Thiel ") - .version("1.0.5+20170512") + .version("1.0.6+20170512") .about("Configures and serves 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") diff --git a/gen/dns1/Cargo.toml b/gen/dns1/Cargo.toml index a10002cf2f..2f97cccdfc 100644 --- a/gen/dns1/Cargo.toml +++ b/gen/dns1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-dns1" -version = "1.0.5+20170512" +version = "1.0.6+20170512" 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" homepage = "https://developers.google.com/cloud-dns" -documentation = "https://docs.rs/google-dns1/1.0.5+20170512" +documentation = "https://docs.rs/google-dns1/1.0.6+20170512" license = "MIT" keywords = ["dns", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/dns1/README.md b/gen/dns1/README.md index afd6380ca4..f8cd85bc21 100644 --- a/gen/dns1/README.md +++ b/gen/dns1/README.md @@ -5,22 +5,22 @@ 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 *1.0.5+20170512*, where *20170512* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *dns* crate version *1.0.6+20170512*, where *20170512* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *dns* *v1* API can be found at the [official documentation site](https://developers.google.com/cloud-dns). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.Dns.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.Dns.html) ... -* [changes](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.Change.html) - * [*create*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ChangeCreateCall.html), [*get*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ChangeGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ChangeListCall.html) -* [managed zones](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ManagedZone.html) - * [*create*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ManagedZoneCreateCall.html), [*delete*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ManagedZoneDeleteCall.html), [*get*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ManagedZoneGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ManagedZoneListCall.html) -* [projects](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.Project.html) - * [*get*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ProjectGetCall.html) -* [resource record sets](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ResourceRecordSet.html) - * [*list*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.ResourceRecordSetListCall.html) +* [changes](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.Change.html) + * [*create*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ChangeCreateCall.html), [*get*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ChangeGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ChangeListCall.html) +* [managed zones](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ManagedZone.html) + * [*create*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ManagedZoneCreateCall.html), [*delete*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ManagedZoneDeleteCall.html), [*get*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ManagedZoneGetCall.html) and [*list*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ManagedZoneListCall.html) +* [projects](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.Project.html) + * [*get*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ProjectGetCall.html) +* [resource record sets](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ResourceRecordSet.html) + * [*list*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.ResourceRecordSetListCall.html) @@ -29,17 +29,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/struct.Dns.html)** +* **[Hub](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/struct.Dns.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.Part.html)** + * **[Parts](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -128,17 +128,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/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 +148,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/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](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/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](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/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](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/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](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/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](https://docs.rs/google-dns1/1.0.5+20170512/google_dns1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-dns1/1.0.6+20170512/google_dns1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/dns1/src/lib.rs b/gen/dns1/src/lib.rs index 955ba8d020..744e76abc6 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 *1.0.5+20170512*, where *20170512* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *dns* crate version *1.0.6+20170512*, where *20170512* is the exact revision of the *dns:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *dns* *v1* API can be found at the //! [official documentation site](https://developers.google.com/cloud-dns). @@ -338,7 +338,7 @@ impl<'a, C, A> Dns Dns { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/dns/v1/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -358,7 +358,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/doubleclickbidmanager1-cli/Cargo.toml b/gen/doubleclickbidmanager1-cli/Cargo.toml index a679e00df8..afd8cec93c 100644 --- a/gen/doubleclickbidmanager1-cli/Cargo.toml +++ b/gen/doubleclickbidmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclickbidmanager1-cli" -version = "1.0.5+20170224" +version = "1.0.6+20170224" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-doubleclickbidmanager1] path = "../doubleclickbidmanager1" -version = "1.0.5+20170224" +version = "1.0.6+20170224" diff --git a/gen/doubleclickbidmanager1-cli/README.md b/gen/doubleclickbidmanager1-cli/README.md index 5ccb5c6c3b..c94c01788f 100644 --- a/gen/doubleclickbidmanager1-cli/README.md +++ b/gen/doubleclickbidmanager1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *DoubleClick Bid Manager* API at revision *20170224*. The CLI is at version *1.0.5*. +This documentation was generated from the *DoubleClick Bid Manager* API at revision *20170224*. The CLI is at version *1.0.6*. ```bash doubleclickbidmanager1 [options] diff --git a/gen/doubleclickbidmanager1-cli/mkdocs.yml b/gen/doubleclickbidmanager1-cli/mkdocs.yml index a59c584bab..db85f14fbb 100644 --- a/gen/doubleclickbidmanager1-cli/mkdocs.yml +++ b/gen/doubleclickbidmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: DoubleClick Bid Manager v1.0.5+20170224 +site_name: DoubleClick Bid Manager v1.0.6+20170224 site_url: http://byron.github.io/google-apis-rs/google-doubleclickbidmanager1-cli site_description: A complete library to interact with DoubleClick Bid Manager (protocol v1) diff --git a/gen/doubleclickbidmanager1-cli/src/cmn.rs b/gen/doubleclickbidmanager1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/doubleclickbidmanager1-cli/src/cmn.rs +++ b/gen/doubleclickbidmanager1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/doubleclickbidmanager1-cli/src/main.rs b/gen/doubleclickbidmanager1-cli/src/main.rs index 01606475ff..0427c7a3a3 100644 --- a/gen/doubleclickbidmanager1-cli/src/main.rs +++ b/gen/doubleclickbidmanager1-cli/src/main.rs @@ -1045,7 +1045,7 @@ fn main() { let mut app = App::new("doubleclickbidmanager1") .author("Sebastian Thiel ") - .version("1.0.5+20170224") + .version("1.0.6+20170224") .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("url") diff --git a/gen/doubleclickbidmanager1/Cargo.toml b/gen/doubleclickbidmanager1/Cargo.toml index 663f749b64..958e3f2d38 100644 --- a/gen/doubleclickbidmanager1/Cargo.toml +++ b/gen/doubleclickbidmanager1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-doubleclickbidmanager1" -version = "1.0.5+20170224" +version = "1.0.6+20170224" 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" homepage = "https://developers.google.com/bid-manager/" -documentation = "https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224" +documentation = "https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224" license = "MIT" keywords = ["doubleclickbidmanage", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/doubleclickbidmanager1/README.md b/gen/doubleclickbidmanager1/README.md index 2328d9e689..a823795c0f 100644 --- a/gen/doubleclickbidmanager1/README.md +++ b/gen/doubleclickbidmanager1/README.md @@ -5,22 +5,22 @@ 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 *1.0.5+20170224*, where *20170224* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.6+20170224*, where *20170224* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/bid-manager/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html) ... * lineitems - * [*downloadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.LineitemDownloadlineitemCall.html) and [*uploadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.LineitemUploadlineitemCall.html) -* [queries](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.Query.html) - * [*createquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.QueryCreatequeryCall.html), [*deletequery*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.QueryDeletequeryCall.html), [*getquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.QueryGetqueryCall.html), [*listqueries*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.QueryListqueryCall.html) and [*runquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.QueryRunqueryCall.html) -* [reports](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.Report.html) - * [*listreports*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.ReportListreportCall.html) + * [*downloadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.LineitemDownloadlineitemCall.html) and [*uploadlineitems*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.LineitemUploadlineitemCall.html) +* [queries](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.Query.html) + * [*createquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.QueryCreatequeryCall.html), [*deletequery*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.QueryDeletequeryCall.html), [*getquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.QueryGetqueryCall.html), [*listqueries*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.QueryListqueryCall.html) and [*runquery*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.QueryRunqueryCall.html) +* [reports](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.Report.html) + * [*listreports*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.ReportListreportCall.html) * sdf - * [*download*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.SdfDownloadCall.html) + * [*download*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.SdfDownloadCall.html) @@ -29,17 +29,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html)** +* **[Hub](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/struct.DoubleClickBidManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.Part.html)** + * **[Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -123,17 +123,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/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")`. @@ -143,29 +143,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/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](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/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](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/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](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/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](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/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](https://docs.rs/google-doubleclickbidmanager1/1.0.5+20170224/google_doubleclickbidmanager1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-doubleclickbidmanager1/1.0.6+20170224/google_doubleclickbidmanager1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/doubleclickbidmanager1/src/lib.rs b/gen/doubleclickbidmanager1/src/lib.rs index 9cbc2957ac..f3527e8a40 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 *1.0.5+20170224*, where *20170224* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *DoubleClick Bid Manager* crate version *1.0.6+20170224*, where *20170224* is the exact revision of the *doubleclickbidmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *DoubleClick Bid Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/bid-manager/). @@ -318,7 +318,7 @@ impl<'a, C, A> DoubleClickBidManager DoubleClickBidManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/doubleclickbidmanager/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -338,7 +338,7 @@ impl<'a, C, A> DoubleClickBidManager } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/doubleclicksearch2-cli/Cargo.toml b/gen/doubleclicksearch2-cli/Cargo.toml index e769c2f022..070f362e8d 100644 --- a/gen/doubleclicksearch2-cli/Cargo.toml +++ b/gen/doubleclicksearch2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-doubleclicksearch2-cli" -version = "1.0.5+20170509" +version = "1.0.6+20170509" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-doubleclicksearch2] path = "../doubleclicksearch2" -version = "1.0.5+20170509" +version = "1.0.6+20170509" diff --git a/gen/doubleclicksearch2-cli/README.md b/gen/doubleclicksearch2-cli/README.md index 2f5ca313f3..bb6800d120 100644 --- a/gen/doubleclicksearch2-cli/README.md +++ b/gen/doubleclicksearch2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *doubleclicksearch* API at revision *20170509*. The CLI is at version *1.0.5*. +This documentation was generated from the *doubleclicksearch* API at revision *20170509*. The CLI is at version *1.0.6*. ```bash doubleclicksearch2 [options] diff --git a/gen/doubleclicksearch2-cli/mkdocs.yml b/gen/doubleclicksearch2-cli/mkdocs.yml index 2dadb076a6..1e2f358dba 100644 --- a/gen/doubleclicksearch2-cli/mkdocs.yml +++ b/gen/doubleclicksearch2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: doubleclicksearch v1.0.5+20170509 +site_name: doubleclicksearch v1.0.6+20170509 site_url: http://byron.github.io/google-apis-rs/google-doubleclicksearch2-cli site_description: A complete library to interact with doubleclicksearch (protocol v2) diff --git a/gen/doubleclicksearch2-cli/src/cmn.rs b/gen/doubleclicksearch2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/doubleclicksearch2-cli/src/cmn.rs +++ b/gen/doubleclicksearch2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/doubleclicksearch2-cli/src/main.rs b/gen/doubleclicksearch2-cli/src/main.rs index 01cfb0decc..0f383bc12b 100644 --- a/gen/doubleclicksearch2-cli/src/main.rs +++ b/gen/doubleclicksearch2-cli/src/main.rs @@ -1292,7 +1292,7 @@ fn main() { let mut app = App::new("doubleclicksearch2") .author("Sebastian Thiel ") - .version("1.0.5+20170509") + .version("1.0.6+20170509") .about("Reports and modifies 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") diff --git a/gen/doubleclicksearch2/Cargo.toml b/gen/doubleclicksearch2/Cargo.toml index 7bb9cd3699..533e7da902 100644 --- a/gen/doubleclicksearch2/Cargo.toml +++ b/gen/doubleclicksearch2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-doubleclicksearch2" -version = "1.0.5+20170509" +version = "1.0.6+20170509" 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" homepage = "https://developers.google.com/doubleclick-search/" -documentation = "https://docs.rs/google-doubleclicksearch2/1.0.5+20170509" +documentation = "https://docs.rs/google-doubleclicksearch2/1.0.6+20170509" license = "MIT" keywords = ["doubleclicksearch", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/doubleclicksearch2/README.md b/gen/doubleclicksearch2/README.md index 28c4cab7a0..d71f0a3948 100644 --- a/gen/doubleclicksearch2/README.md +++ b/gen/doubleclicksearch2/README.md @@ -5,25 +5,25 @@ 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 *1.0.5+20170509*, where *20170509* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *doubleclicksearch* crate version *1.0.6+20170509*, where *20170509* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *doubleclicksearch* *v2* API can be found at the [official documentation site](https://developers.google.com/doubleclick-search/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.Doubleclicksearch.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.Doubleclicksearch.html) ... -* [conversion](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.Conversion.html) - * [*get*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ConversionGetCall.html), [*insert*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ConversionInsertCall.html), [*patch*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ConversionPatchCall.html), [*update*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ConversionUpdateCall.html) and [*update availability*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ConversionUpdateAvailabilityCall.html) -* [reports](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.Report.html) - * [*generate*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ReportGenerateCall.html), [*get*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ReportGetCall.html), [*get file*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ReportGetFileCall.html) and [*request*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ReportRequestCall.html) -* [saved columns](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.SavedColumn.html) - * [*list*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.SavedColumnListCall.html) +* [conversion](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.Conversion.html) + * [*get*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ConversionGetCall.html), [*insert*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ConversionInsertCall.html), [*patch*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ConversionPatchCall.html), [*update*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ConversionUpdateCall.html) and [*update availability*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ConversionUpdateAvailabilityCall.html) +* [reports](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.Report.html) + * [*generate*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ReportGenerateCall.html), [*get*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ReportGetCall.html), [*get file*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ReportGetFileCall.html) and [*request*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ReportRequestCall.html) +* [saved columns](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.SavedColumn.html) + * [*list*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.SavedColumnListCall.html) Download supported by ... -* [*get file reports*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.ReportGetFileCall.html) +* [*get file reports*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.ReportGetFileCall.html) @@ -31,17 +31,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/struct.Doubleclicksearch.html)** +* **[Hub](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/struct.Doubleclicksearch.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.Part.html)** + * **[Parts](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/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")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/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](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/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](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/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](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/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](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/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](https://docs.rs/google-doubleclicksearch2/1.0.5+20170509/google_doubleclicksearch2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-doubleclicksearch2/1.0.6+20170509/google_doubleclicksearch2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/doubleclicksearch2/src/lib.rs b/gen/doubleclicksearch2/src/lib.rs index 71045459de..0ea5885dce 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 *1.0.5+20170509*, where *20170509* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *doubleclicksearch* crate version *1.0.6+20170509*, where *20170509* is the exact revision of the *doubleclicksearch:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *doubleclicksearch* *v2* API can be found at the //! [official documentation site](https://developers.google.com/doubleclick-search/). @@ -322,7 +322,7 @@ impl<'a, C, A> Doubleclicksearch Doubleclicksearch { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/doubleclicksearch/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -339,7 +339,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/drive2-cli/Cargo.toml b/gen/drive2-cli/Cargo.toml index 07471fefd0..c616481d00 100644 --- a/gen/drive2-cli/Cargo.toml +++ b/gen/drive2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive2-cli" -version = "1.0.5+20170512" +version = "1.0.6+20170512" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-drive2] path = "../drive2" -version = "1.0.5+20170512" +version = "1.0.6+20170512" diff --git a/gen/drive2-cli/README.md b/gen/drive2-cli/README.md index 23a5eb17dc..a5c3c23365 100644 --- a/gen/drive2-cli/README.md +++ b/gen/drive2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20170512*. The CLI is at version *1.0.5*. +This documentation was generated from the *drive* API at revision *20170512*. The CLI is at version *1.0.6*. ```bash drive2 [options] diff --git a/gen/drive2-cli/mkdocs.yml b/gen/drive2-cli/mkdocs.yml index 0f0bc16a17..1c9aca45c7 100644 --- a/gen/drive2-cli/mkdocs.yml +++ b/gen/drive2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v1.0.5+20170512 +site_name: drive v1.0.6+20170512 site_url: http://byron.github.io/google-apis-rs/google-drive2-cli site_description: A complete library to interact with drive (protocol v2) diff --git a/gen/drive2-cli/src/cmn.rs b/gen/drive2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/drive2-cli/src/cmn.rs +++ b/gen/drive2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/drive2-cli/src/main.rs b/gen/drive2-cli/src/main.rs index 5f21ae5f35..316e465882 100644 --- a/gen/drive2-cli/src/main.rs +++ b/gen/drive2-cli/src/main.rs @@ -7722,7 +7722,7 @@ fn main() { let mut app = App::new("drive2") .author("Sebastian Thiel ") - .version("1.0.5+20170512") + .version("1.0.6+20170512") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive2_cli") .arg(Arg::with_name("url") diff --git a/gen/drive2/Cargo.toml b/gen/drive2/Cargo.toml index 625cb7011d..7b044bb662 100644 --- a/gen/drive2/Cargo.toml +++ b/gen/drive2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-drive2" -version = "1.0.5+20170512" +version = "1.0.6+20170512" 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" homepage = "https://developers.google.com/drive/" -documentation = "https://docs.rs/google-drive2/1.0.5+20170512" +documentation = "https://docs.rs/google-drive2/1.0.6+20170512" license = "MIT" keywords = ["drive", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/drive2/README.md b/gen/drive2/README.md index 4aa11fb8ec..c07d071e62 100644 --- a/gen/drive2/README.md +++ b/gen/drive2/README.md @@ -5,64 +5,64 @@ 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 *1.0.5+20170512*, where *20170512* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *drive* crate version *1.0.6+20170512*, where *20170512* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *drive* *v2* 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](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Drive.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Drive.html) ... -* [about](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.About.html) - * [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.AboutGetCall.html) -* [apps](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.App.html) - * [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.AppGetCall.html) and [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.AppListCall.html) -* [changes](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Change.html) - * [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChangeGetCall.html), [*get start page token*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChangeWatchCall.html) -* [channels](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Channel.html) - * [*stop*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChannelStopCall.html) +* [about](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.About.html) + * [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.AboutGetCall.html) +* [apps](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.App.html) + * [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.AppGetCall.html) and [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.AppListCall.html) +* [changes](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Change.html) + * [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChangeGetCall.html), [*get start page token*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChangeWatchCall.html) +* [channels](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Channel.html) + * [*stop*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChannelStopCall.html) * children - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChildrenDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChildrenGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChildrenInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChildrenListCall.html) -* [comments](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Comment.html) - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.CommentListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.CommentPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.CommentUpdateCall.html) -* [files](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.File.html) - * [*copy*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileCopyCall.html), [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FilePatchCall.html), [*touch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileTouchCall.html), [*trash*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileTrashCall.html), [*untrash*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileUntrashCall.html), [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileWatchCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChildrenDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChildrenGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChildrenInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChildrenListCall.html) +* [comments](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Comment.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.CommentListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.CommentPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.CommentUpdateCall.html) +* [files](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.File.html) + * [*copy*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileCopyCall.html), [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FilePatchCall.html), [*touch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileTouchCall.html), [*trash*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileTrashCall.html), [*untrash*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileUntrashCall.html), [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileWatchCall.html) * parents - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ParentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ParentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ParentInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ParentListCall.html) -* [permissions](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Permission.html) - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionGetCall.html), [*get id for email*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionGetIdForEmailCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PermissionUpdateCall.html) -* [properties](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Property.html) - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PropertyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PropertyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PropertyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PropertyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PropertyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.PropertyUpdateCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ParentDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ParentGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ParentInsertCall.html) and [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ParentListCall.html) +* [permissions](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Permission.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionGetCall.html), [*get id for email*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionGetIdForEmailCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PermissionUpdateCall.html) +* [properties](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Property.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PropertyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PropertyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PropertyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PropertyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PropertyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.PropertyUpdateCall.html) * realtime - * [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RealtimeGetCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RealtimeUpdateCall.html) + * [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RealtimeGetCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RealtimeUpdateCall.html) * replies - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ReplyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ReplyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ReplyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ReplyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ReplyUpdateCall.html) -* [revisions](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Revision.html) - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RevisionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RevisionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RevisionUpdateCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ReplyGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ReplyInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ReplyListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ReplyPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ReplyUpdateCall.html) +* [revisions](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Revision.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RevisionListCall.html), [*patch*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RevisionPatchCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RevisionUpdateCall.html) * teamdrives - * [*delete*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.TeamdriveGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.TeamdriveInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.TeamdriveUpdateCall.html) + * [*delete*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.TeamdriveGetCall.html), [*insert*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.TeamdriveInsertCall.html), [*list*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.TeamdriveUpdateCall.html) Upload supported by ... -* [*update files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileUpdateCall.html) -* [*insert files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileInsertCall.html) -* [*update realtime*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RealtimeUpdateCall.html) +* [*update files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileUpdateCall.html) +* [*insert files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileInsertCall.html) +* [*update realtime*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RealtimeUpdateCall.html) Download supported by ... -* [*watch files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileWatchCall.html) -* [*get realtime*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.RealtimeGetCall.html) -* [*get files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileGetCall.html) -* [*export files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileExportCall.html) +* [*watch files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileWatchCall.html) +* [*get realtime*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.RealtimeGetCall.html) +* [*get files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileGetCall.html) +* [*export files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileExportCall.html) Subscription supported by ... -* [*watch files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileWatchCall.html) -* [*insert files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileInsertCall.html) -* [*get files*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.FileGetCall.html) -* [*watch changes*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChangeWatchCall.html) -* [*list changes*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.ChangeListCall.html) +* [*watch files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileWatchCall.html) +* [*insert files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileInsertCall.html) +* [*get files*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.FileGetCall.html) +* [*watch changes*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChangeWatchCall.html) +* [*list changes*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.ChangeListCall.html) @@ -70,17 +70,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/struct.Drive.html)** +* **[Hub](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/struct.Drive.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.Part.html)** + * **[Parts](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -196,17 +196,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/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")`. @@ -216,29 +216,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/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](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/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](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/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](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/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](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/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](https://docs.rs/google-drive2/1.0.5+20170512/google_drive2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-drive2/1.0.6+20170512/google_drive2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/drive2/src/lib.rs b/gen/drive2/src/lib.rs index cf7a2ac3bf..e322ede0db 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 *1.0.5+20170512*, where *20170512* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *drive* crate version *1.0.6+20170512*, where *20170512* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *drive* *v2* API can be found at the //! [official documentation site](https://developers.google.com/drive/). @@ -443,7 +443,7 @@ impl<'a, C, A> Drive Drive { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/drive/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -493,7 +493,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/drive3-cli/Cargo.toml b/gen/drive3-cli/Cargo.toml index 6260b264e4..e9543cc390 100644 --- a/gen/drive3-cli/Cargo.toml +++ b/gen/drive3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-drive3-cli" -version = "1.0.5+20170512" +version = "1.0.6+20170512" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-drive3] path = "../drive3" -version = "1.0.5+20170512" +version = "1.0.6+20170512" diff --git a/gen/drive3-cli/README.md b/gen/drive3-cli/README.md index 8fc5f409c6..175fbf2f36 100644 --- a/gen/drive3-cli/README.md +++ b/gen/drive3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *drive* API at revision *20170512*. The CLI is at version *1.0.5*. +This documentation was generated from the *drive* API at revision *20170512*. The CLI is at version *1.0.6*. ```bash drive3 [options] diff --git a/gen/drive3-cli/mkdocs.yml b/gen/drive3-cli/mkdocs.yml index 3967d021fe..d01514c39a 100644 --- a/gen/drive3-cli/mkdocs.yml +++ b/gen/drive3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: drive v1.0.5+20170512 +site_name: drive v1.0.6+20170512 site_url: http://byron.github.io/google-apis-rs/google-drive3-cli site_description: A complete library to interact with drive (protocol v3) diff --git a/gen/drive3-cli/src/cmn.rs b/gen/drive3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/drive3-cli/src/cmn.rs +++ b/gen/drive3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/drive3-cli/src/main.rs b/gen/drive3-cli/src/main.rs index 5c43e6858c..47b1addcea 100644 --- a/gen/drive3-cli/src/main.rs +++ b/gen/drive3-cli/src/main.rs @@ -4558,7 +4558,7 @@ fn main() { let mut app = App::new("drive3") .author("Sebastian Thiel ") - .version("1.0.5+20170512") + .version("1.0.6+20170512") .about("Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_drive3_cli") .arg(Arg::with_name("url") diff --git a/gen/drive3/Cargo.toml b/gen/drive3/Cargo.toml index df16109787..4973fc4f81 100644 --- a/gen/drive3/Cargo.toml +++ b/gen/drive3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-drive3" -version = "1.0.5+20170512" +version = "1.0.6+20170512" 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 = "https://docs.rs/google-drive3/1.0.5+20170512" +documentation = "https://docs.rs/google-drive3/1.0.6+20170512" license = "MIT" keywords = ["drive", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/drive3/README.md b/gen/drive3/README.md index d855f67129..15d504061b 100644 --- a/gen/drive3/README.md +++ b/gen/drive3/README.md @@ -5,53 +5,53 @@ DO NOT EDIT ! --> The `google-drive3` library allows access to all features of the *Google drive* service. -This documentation was generated from *drive* crate version *1.0.5+20170512*, where *20170512* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *drive* crate version *1.0.6+20170512*, where *20170512* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Drive.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Drive.html) ... -* [about](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.About.html) - * [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.AboutGetCall.html) -* [changes](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Change.html) - * [*get start page token*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ChangeWatchCall.html) -* [channels](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Channel.html) - * [*stop*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ChannelStopCall.html) -* [comments](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Comment.html) - * [*create*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.CommentCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.CommentGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.CommentListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.CommentUpdateCall.html) -* [files](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.File.html) - * [*copy*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileCopyCall.html), [*create*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileListCall.html), [*update*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileWatchCall.html) -* [permissions](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Permission.html) - * [*create*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.PermissionCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.PermissionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.PermissionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.PermissionUpdateCall.html) -* [replies](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Reply.html) - * [*create*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ReplyCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ReplyGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ReplyListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ReplyUpdateCall.html) -* [revisions](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Revision.html) - * [*delete*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.RevisionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.RevisionUpdateCall.html) +* [about](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.About.html) + * [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.AboutGetCall.html) +* [changes](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Change.html) + * [*get start page token*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ChangeGetStartPageTokenCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ChangeListCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ChangeWatchCall.html) +* [channels](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Channel.html) + * [*stop*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ChannelStopCall.html) +* [comments](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Comment.html) + * [*create*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.CommentCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.CommentDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.CommentGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.CommentListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.CommentUpdateCall.html) +* [files](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.File.html) + * [*copy*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileCopyCall.html), [*create*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileDeleteCall.html), [*empty trash*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileEmptyTrashCall.html), [*export*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileExportCall.html), [*generate ids*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileGenerateIdCall.html), [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileListCall.html), [*update*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileUpdateCall.html) and [*watch*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileWatchCall.html) +* [permissions](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Permission.html) + * [*create*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.PermissionCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.PermissionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.PermissionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.PermissionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.PermissionUpdateCall.html) +* [replies](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Reply.html) + * [*create*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ReplyCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ReplyDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ReplyGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ReplyListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ReplyUpdateCall.html) +* [revisions](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Revision.html) + * [*delete*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.RevisionDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.RevisionGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.RevisionListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.RevisionUpdateCall.html) * teamdrives - * [*create*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.TeamdriveCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.TeamdriveGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.TeamdriveUpdateCall.html) + * [*create*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.TeamdriveCreateCall.html), [*delete*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.TeamdriveDeleteCall.html), [*get*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.TeamdriveGetCall.html), [*list*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.TeamdriveListCall.html) and [*update*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.TeamdriveUpdateCall.html) Upload supported by ... -* [*update files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileUpdateCall.html) -* [*create files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileCreateCall.html) +* [*update files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileUpdateCall.html) +* [*create files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileCreateCall.html) Download supported by ... -* [*watch files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileWatchCall.html) -* [*export files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileExportCall.html) -* [*get revisions*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.RevisionGetCall.html) -* [*get files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileGetCall.html) +* [*watch files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileWatchCall.html) +* [*export files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileExportCall.html) +* [*get revisions*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.RevisionGetCall.html) +* [*get files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileGetCall.html) Subscription supported by ... -* [*watch files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileWatchCall.html) -* [*watch changes*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ChangeWatchCall.html) -* [*list changes*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.ChangeListCall.html) -* [*create files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileCreateCall.html) -* [*get files*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.FileGetCall.html) +* [*watch files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileWatchCall.html) +* [*watch changes*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ChangeWatchCall.html) +* [*list changes*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.ChangeListCall.html) +* [*create files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileCreateCall.html) +* [*get files*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.FileGetCall.html) @@ -59,17 +59,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/struct.Drive.html)** +* **[Hub](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/struct.Drive.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.Part.html)** + * **[Parts](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -171,17 +171,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-drive3/1.0.6+20170512/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")`. @@ -191,29 +191,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-drive3/1.0.6+20170512/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](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-drive3/1.0.6+20170512/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](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/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](https://docs.rs/google-drive3/1.0.6+20170512/google_drive3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-drive3/1.0.6+20170512/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](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-drive3/1.0.6+20170512/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](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-drive3/1.0.6+20170512/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](https://docs.rs/google-drive3/1.0.5+20170512/google_drive3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-drive3/1.0.6+20170512/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. diff --git a/gen/drive3/src/lib.rs b/gen/drive3/src/lib.rs index a0405b285f..242e90cb69 100644 --- a/gen/drive3/src/lib.rs +++ b/gen/drive3/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 *1.0.5+20170512*, where *20170512* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *drive* crate version *1.0.6+20170512*, where *20170512* is the exact revision of the *drive:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *drive* *v3* API can be found at the //! [official documentation site](https://developers.google.com/drive/). @@ -404,7 +404,7 @@ impl<'a, C, A> Drive Drive { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/drive/v3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -439,7 +439,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/firebasedynamiclinks1-cli/Cargo.toml b/gen/firebasedynamiclinks1-cli/Cargo.toml index da82d224aa..f318f92e45 100644 --- a/gen/firebasedynamiclinks1-cli/Cargo.toml +++ b/gen/firebasedynamiclinks1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-firebasedynamiclinks1-cli" -version = "1.0.5+20170517" +version = "1.0.6+20170517" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firebase Dynamic Links (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-firebasedynamiclinks1] path = "../firebasedynamiclinks1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/firebasedynamiclinks1-cli/README.md b/gen/firebasedynamiclinks1-cli/README.md index 8578850673..005cc4463b 100644 --- a/gen/firebasedynamiclinks1-cli/README.md +++ b/gen/firebasedynamiclinks1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Firebase Dynamic Links* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *Firebase Dynamic Links* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash firebasedynamiclinks1 [options] diff --git a/gen/firebasedynamiclinks1-cli/mkdocs.yml b/gen/firebasedynamiclinks1-cli/mkdocs.yml index b1a626529e..bb34c9eca8 100644 --- a/gen/firebasedynamiclinks1-cli/mkdocs.yml +++ b/gen/firebasedynamiclinks1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Firebase Dynamic Links v1.0.5+20170517 +site_name: Firebase Dynamic Links v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-firebasedynamiclinks1-cli site_description: A complete library to interact with Firebase Dynamic Links (protocol v1) diff --git a/gen/firebasedynamiclinks1-cli/src/cmn.rs b/gen/firebasedynamiclinks1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/firebasedynamiclinks1-cli/src/cmn.rs +++ b/gen/firebasedynamiclinks1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/firebasedynamiclinks1-cli/src/main.rs b/gen/firebasedynamiclinks1-cli/src/main.rs index 622a9e35b7..7bd0242e86 100644 --- a/gen/firebasedynamiclinks1-cli/src/main.rs +++ b/gen/firebasedynamiclinks1-cli/src/main.rs @@ -297,7 +297,7 @@ fn main() { let mut app = App::new("firebasedynamiclinks1") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .about("Programmatically creates and manages Firebase Dynamic Links.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_firebasedynamiclinks1_cli") .arg(Arg::with_name("url") diff --git a/gen/firebasedynamiclinks1/Cargo.toml b/gen/firebasedynamiclinks1/Cargo.toml index 91a5b7073c..02eb323851 100644 --- a/gen/firebasedynamiclinks1/Cargo.toml +++ b/gen/firebasedynamiclinks1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-firebasedynamiclinks1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" authors = ["Sebastian Thiel "] description = "A complete library to interact with Firebase Dynamic Links (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/firebasedynamiclinks1" homepage = "https://firebase.google.com/docs/dynamic-links/" -documentation = "https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517" +documentation = "https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517" license = "MIT" keywords = ["firebasedynamiclinks", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/firebasedynamiclinks1/README.md b/gen/firebasedynamiclinks1/README.md index 16303b3a42..50c3d61f75 100644 --- a/gen/firebasedynamiclinks1/README.md +++ b/gen/firebasedynamiclinks1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-firebasedynamiclinks1` library allows access to all features of the *Google Firebase Dynamic Links* service. -This documentation was generated from *Firebase Dynamic Links* crate version *1.0.5+20170517*, where *20170517* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Firebase Dynamic Links* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Firebase Dynamic Links* *v1* API can be found at the [official documentation site](https://firebase.google.com/docs/dynamic-links/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html) ... * short links - * [*create*](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/struct.ShortLinkCreateCall.html) + * [*create*](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/struct.ShortLinkCreateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html)** +* **[Hub](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/struct.FirebaseDynamicLinks.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.Part.html)** + * **[Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -122,17 +122,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/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")`. @@ -142,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](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/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](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/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](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/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](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/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](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/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](https://docs.rs/google-firebasedynamiclinks1/1.0.5+20170517/google_firebasedynamiclinks1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-firebasedynamiclinks1/1.0.6+20170517/google_firebasedynamiclinks1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/firebasedynamiclinks1/src/lib.rs b/gen/firebasedynamiclinks1/src/lib.rs index cb86098365..2c72bd2646 100644 --- a/gen/firebasedynamiclinks1/src/lib.rs +++ b/gen/firebasedynamiclinks1/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 *Firebase Dynamic Links* crate version *1.0.5+20170517*, where *20170517* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Firebase Dynamic Links* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *firebasedynamiclinks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Firebase Dynamic Links* *v1* API can be found at the //! [official documentation site](https://firebase.google.com/docs/dynamic-links/). @@ -323,7 +323,7 @@ impl<'a, C, A> FirebaseDynamicLinks FirebaseDynamicLinks { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://firebasedynamiclinks.googleapis.com/".to_string(), _root_url: "https://firebasedynamiclinks.googleapis.com/".to_string(), } @@ -334,7 +334,7 @@ impl<'a, C, A> FirebaseDynamicLinks } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/fitness1-cli/Cargo.toml b/gen/fitness1-cli/Cargo.toml index 0508267593..30747bede0 100644 --- a/gen/fitness1-cli/Cargo.toml +++ b/gen/fitness1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fitness1-cli" -version = "1.0.5+20161128" +version = "1.0.6+20161128" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-fitness1] path = "../fitness1" -version = "1.0.5+20161128" +version = "1.0.6+20161128" diff --git a/gen/fitness1-cli/README.md b/gen/fitness1-cli/README.md index 0ca5b3732d..765db90f76 100644 --- a/gen/fitness1-cli/README.md +++ b/gen/fitness1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *fitness* API at revision *20161128*. The CLI is at version *1.0.5*. +This documentation was generated from the *fitness* API at revision *20161128*. The CLI is at version *1.0.6*. ```bash fitness1 [options] diff --git a/gen/fitness1-cli/mkdocs.yml b/gen/fitness1-cli/mkdocs.yml index 75893360da..9b833f2463 100644 --- a/gen/fitness1-cli/mkdocs.yml +++ b/gen/fitness1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: fitness v1.0.5+20161128 +site_name: fitness v1.0.6+20161128 site_url: http://byron.github.io/google-apis-rs/google-fitness1-cli site_description: A complete library to interact with fitness (protocol v1) diff --git a/gen/fitness1-cli/src/cmn.rs b/gen/fitness1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/fitness1-cli/src/cmn.rs +++ b/gen/fitness1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/fitness1-cli/src/main.rs b/gen/fitness1-cli/src/main.rs index 115f975cbe..0b598f302c 100644 --- a/gen/fitness1-cli/src/main.rs +++ b/gen/fitness1-cli/src/main.rs @@ -1541,7 +1541,7 @@ fn main() { let mut app = App::new("fitness1") .author("Sebastian Thiel ") - .version("1.0.5+20161128") + .version("1.0.6+20161128") .about("Stores and accesses user data in the fitness store from apps on any platform.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_fitness1_cli") .arg(Arg::with_name("url") diff --git a/gen/fitness1/Cargo.toml b/gen/fitness1/Cargo.toml index 90287945e5..d027cd60ba 100644 --- a/gen/fitness1/Cargo.toml +++ b/gen/fitness1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-fitness1" -version = "1.0.5+20161128" +version = "1.0.6+20161128" 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" homepage = "https://developers.google.com/fit/rest/" -documentation = "https://docs.rs/google-fitness1/1.0.5+20161128" +documentation = "https://docs.rs/google-fitness1/1.0.6+20161128" license = "MIT" keywords = ["fitness", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/fitness1/README.md b/gen/fitness1/README.md index 0f151ff8a2..2edcb1811b 100644 --- a/gen/fitness1/README.md +++ b/gen/fitness1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20161128*, where *20161128* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *fitness* crate version *1.0.6+20161128*, where *20161128* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *fitness* *v1* API can be found at the [official documentation site](https://developers.google.com/fit/rest/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.Fitness.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.Fitness.html) ... * users - * [*data sources create*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceCreateCall.html), [*data sources datasets delete*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceDatasetDeleteCall.html), [*data sources datasets get*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceDatasetGetCall.html), [*data sources datasets patch*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceDatasetPatchCall.html), [*data sources delete*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceDeleteCall.html), [*data sources get*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceGetCall.html), [*data sources list*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceListCall.html), [*data sources patch*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourcePatchCall.html), [*data sources update*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDataSourceUpdateCall.html), [*dataset aggregate*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserDatasetAggregateCall.html), [*sessions delete*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserSessionDeleteCall.html), [*sessions list*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserSessionListCall.html) and [*sessions update*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.UserSessionUpdateCall.html) + * [*data sources create*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceCreateCall.html), [*data sources datasets delete*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceDatasetDeleteCall.html), [*data sources datasets get*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceDatasetGetCall.html), [*data sources datasets patch*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceDatasetPatchCall.html), [*data sources delete*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceDeleteCall.html), [*data sources get*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceGetCall.html), [*data sources list*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceListCall.html), [*data sources patch*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourcePatchCall.html), [*data sources update*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDataSourceUpdateCall.html), [*dataset aggregate*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserDatasetAggregateCall.html), [*sessions delete*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserSessionDeleteCall.html), [*sessions list*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserSessionListCall.html) and [*sessions update*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.UserSessionUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/struct.Fitness.html)** +* **[Hub](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/struct.Fitness.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.Part.html)** + * **[Parts](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/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")`. @@ -146,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](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/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](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/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](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/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](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/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](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/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](https://docs.rs/google-fitness1/1.0.5+20161128/google_fitness1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-fitness1/1.0.6+20161128/google_fitness1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/fitness1/src/lib.rs b/gen/fitness1/src/lib.rs index a36415d3a8..92c929963b 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 *1.0.5+20161128*, where *20161128* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *fitness* crate version *1.0.6+20161128*, where *20161128* is the exact revision of the *fitness:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *fitness* *v1* API can be found at the //! [official documentation site](https://developers.google.com/fit/rest/). @@ -395,7 +395,7 @@ impl<'a, C, A> Fitness Fitness { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/fitness/v1/users/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -406,7 +406,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/fusiontables2-cli/Cargo.toml b/gen/fusiontables2-cli/Cargo.toml index a863490a0f..dd78ddc855 100644 --- a/gen/fusiontables2-cli/Cargo.toml +++ b/gen/fusiontables2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-fusiontables2-cli" -version = "1.0.5+20170413" +version = "1.0.6+20170413" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-fusiontables2] path = "../fusiontables2" -version = "1.0.5+20170413" +version = "1.0.6+20170413" diff --git a/gen/fusiontables2-cli/README.md b/gen/fusiontables2-cli/README.md index 9df6e558b0..dad1595b70 100644 --- a/gen/fusiontables2-cli/README.md +++ b/gen/fusiontables2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *fusiontables* API at revision *20170413*. The CLI is at version *1.0.5*. +This documentation was generated from the *fusiontables* API at revision *20170413*. The CLI is at version *1.0.6*. ```bash fusiontables2 [options] diff --git a/gen/fusiontables2-cli/mkdocs.yml b/gen/fusiontables2-cli/mkdocs.yml index 25e32a28f7..a42a101af3 100644 --- a/gen/fusiontables2-cli/mkdocs.yml +++ b/gen/fusiontables2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: fusiontables v1.0.5+20170413 +site_name: fusiontables v1.0.6+20170413 site_url: http://byron.github.io/google-apis-rs/google-fusiontables2-cli site_description: A complete library to interact with fusiontables (protocol v2) diff --git a/gen/fusiontables2-cli/src/cmn.rs b/gen/fusiontables2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/fusiontables2-cli/src/cmn.rs +++ b/gen/fusiontables2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/fusiontables2-cli/src/main.rs b/gen/fusiontables2-cli/src/main.rs index 73ad0e96fe..9f4d3e0505 100644 --- a/gen/fusiontables2-cli/src/main.rs +++ b/gen/fusiontables2-cli/src/main.rs @@ -3586,7 +3586,7 @@ fn main() { let mut app = App::new("fusiontables2") .author("Sebastian Thiel ") - .version("1.0.5+20170413") + .version("1.0.6+20170413") .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") diff --git a/gen/fusiontables2/Cargo.toml b/gen/fusiontables2/Cargo.toml index 749e3d310c..3f554a18de 100644 --- a/gen/fusiontables2/Cargo.toml +++ b/gen/fusiontables2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-fusiontables2" -version = "1.0.5+20170413" +version = "1.0.6+20170413" 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" homepage = "https://developers.google.com/fusiontables" -documentation = "https://docs.rs/google-fusiontables2/1.0.5+20170413" +documentation = "https://docs.rs/google-fusiontables2/1.0.6+20170413" license = "MIT" keywords = ["fusiontables", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/fusiontables2/README.md b/gen/fusiontables2/README.md index 34a8418477..4919658fdd 100644 --- a/gen/fusiontables2/README.md +++ b/gen/fusiontables2/README.md @@ -5,38 +5,38 @@ 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 *1.0.5+20170413*, where *20170413* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *fusiontables* crate version *1.0.6+20170413*, where *20170413* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *fusiontables* *v2* API can be found at the [official documentation site](https://developers.google.com/fusiontables). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.Fusiontables.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.Fusiontables.html) ... -* [column](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.Column.html) - * [*delete*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.ColumnDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.ColumnGetCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.ColumnInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.ColumnListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.ColumnPatchCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.ColumnUpdateCall.html) +* [column](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.Column.html) + * [*delete*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.ColumnDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.ColumnGetCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.ColumnInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.ColumnListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.ColumnPatchCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.ColumnUpdateCall.html) * query - * [*sql*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.QuerySqlCall.html) and [*sql get*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.QuerySqlGetCall.html) + * [*sql*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.QuerySqlCall.html) and [*sql get*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.QuerySqlGetCall.html) * style - * [*delete*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.StyleDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.StyleGetCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.StyleInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.StyleListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.StylePatchCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.StyleUpdateCall.html) -* [table](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.Table.html) - * [*copy*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableCopyCall.html), [*delete*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableGetCall.html), [*import rows*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableImportRowCall.html), [*import table*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableImportTableCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TablePatchCall.html), [*replace rows*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableReplaceRowCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableUpdateCall.html) -* [task](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.Task.html) - * [*delete*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TaskGetCall.html) and [*list*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TaskListCall.html) -* [template](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.Template.html) - * [*delete*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TemplateDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TemplateGetCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TemplateInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TemplateListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TemplatePatchCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TemplateUpdateCall.html) + * [*delete*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.StyleDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.StyleGetCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.StyleInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.StyleListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.StylePatchCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.StyleUpdateCall.html) +* [table](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.Table.html) + * [*copy*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableCopyCall.html), [*delete*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableGetCall.html), [*import rows*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableImportRowCall.html), [*import table*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableImportTableCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TablePatchCall.html), [*replace rows*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableReplaceRowCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableUpdateCall.html) +* [task](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.Task.html) + * [*delete*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TaskGetCall.html) and [*list*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TaskListCall.html) +* [template](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.Template.html) + * [*delete*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TemplateDeleteCall.html), [*get*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TemplateGetCall.html), [*insert*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TemplateInsertCall.html), [*list*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TemplateListCall.html), [*patch*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TemplatePatchCall.html) and [*update*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TemplateUpdateCall.html) Upload supported by ... -* [*replace rows table*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableReplaceRowCall.html) -* [*import rows table*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableImportRowCall.html) -* [*import table table*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.TableImportTableCall.html) +* [*replace rows table*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableReplaceRowCall.html) +* [*import rows table*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableImportRowCall.html) +* [*import table table*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.TableImportTableCall.html) Download supported by ... -* [*sql get query*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.QuerySqlGetCall.html) -* [*sql query*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.QuerySqlCall.html) +* [*sql get query*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.QuerySqlGetCall.html) +* [*sql query*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.QuerySqlCall.html) @@ -44,17 +44,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/struct.Fusiontables.html)** +* **[Hub](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/struct.Fusiontables.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.Part.html)** + * **[Parts](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -145,17 +145,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/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")`. @@ -165,29 +165,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/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](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/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](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/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](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/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](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/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](https://docs.rs/google-fusiontables2/1.0.5+20170413/google_fusiontables2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-fusiontables2/1.0.6+20170413/google_fusiontables2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/fusiontables2/src/lib.rs b/gen/fusiontables2/src/lib.rs index 3fef4cc6ac..75d095d68c 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 *1.0.5+20170413*, where *20170413* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *fusiontables* crate version *1.0.6+20170413*, where *20170413* is the exact revision of the *fusiontables:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *fusiontables* *v2* API can be found at the //! [official documentation site](https://developers.google.com/fusiontables). @@ -347,7 +347,7 @@ impl<'a, C, A> Fusiontables Fusiontables { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/fusiontables/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -373,7 +373,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/games1-cli/Cargo.toml b/gen/games1-cli/Cargo.toml index f280de53ac..17207b20c0 100644 --- a/gen/games1-cli/Cargo.toml +++ b/gen/games1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-games1-cli" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-games1] path = "../games1" -version = "1.0.5+20170511" +version = "1.0.6+20170511" diff --git a/gen/games1-cli/README.md b/gen/games1-cli/README.md index 8b8517d0c5..3bf54f841e 100644 --- a/gen/games1-cli/README.md +++ b/gen/games1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games* API at revision *20170511*. The CLI is at version *1.0.5*. +This documentation was generated from the *Games* API at revision *20170511*. The CLI is at version *1.0.6*. ```bash games1 [options] diff --git a/gen/games1-cli/mkdocs.yml b/gen/games1-cli/mkdocs.yml index afd17523b7..03b8641351 100644 --- a/gen/games1-cli/mkdocs.yml +++ b/gen/games1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games v1.0.5+20170511 +site_name: Games v1.0.6+20170511 site_url: http://byron.github.io/google-apis-rs/google-games1-cli site_description: A complete library to interact with Games (protocol v1) diff --git a/gen/games1-cli/src/cmn.rs b/gen/games1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/games1-cli/src/cmn.rs +++ b/gen/games1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/games1-cli/src/main.rs b/gen/games1-cli/src/main.rs index adf35c6ccc..de798350bf 100644 --- a/gen/games1-cli/src/main.rs +++ b/gen/games1-cli/src/main.rs @@ -5260,7 +5260,7 @@ fn main() { let mut app = App::new("games1") .author("Sebastian Thiel ") - .version("1.0.5+20170511") + .version("1.0.6+20170511") .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") diff --git a/gen/games1/Cargo.toml b/gen/games1/Cargo.toml index a043faa858..e3ec5f8ad4 100644 --- a/gen/games1/Cargo.toml +++ b/gen/games1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-games1" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" homepage = "https://developers.google.com/games/services/" -documentation = "https://docs.rs/google-games1/1.0.5+20170511" +documentation = "https://docs.rs/google-games1/1.0.6+20170511" license = "MIT" keywords = ["games", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/games1/README.md b/gen/games1/README.md index da6165f482..d155e2ff9f 100644 --- a/gen/games1/README.md +++ b/gen/games1/README.md @@ -5,44 +5,44 @@ 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Games* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Games* *v1* API can be found at the [official documentation site](https://developers.google.com/games/services/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Games.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Games.html) ... -* [achievement definitions](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementDefinition.html) - * [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementDefinitionListCall.html) +* [achievement definitions](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementDefinition.html) + * [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementDefinitionListCall.html) * achievements - * [*increment*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementIncrementCall.html), [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementListCall.html), [*reveal*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementRevealCall.html), [*set steps at least*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementSetStepsAtLeastCall.html), [*unlock*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementUnlockCall.html) and [*update multiple*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.AchievementUpdateMultipleCall.html) -* [applications](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Application.html) - * [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ApplicationGetCall.html), [*played*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ApplicationPlayedCall.html) and [*verify*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ApplicationVerifyCall.html) + * [*increment*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementIncrementCall.html), [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementListCall.html), [*reveal*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementRevealCall.html), [*set steps at least*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementSetStepsAtLeastCall.html), [*unlock*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementUnlockCall.html) and [*update multiple*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.AchievementUpdateMultipleCall.html) +* [applications](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Application.html) + * [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ApplicationGetCall.html), [*played*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ApplicationPlayedCall.html) and [*verify*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ApplicationVerifyCall.html) * events - * [*list by player*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.EventListByPlayerCall.html), [*list definitions*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.EventListDefinitionCall.html) and [*record*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.EventRecordCall.html) -* [leaderboards](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Leaderboard.html) - * [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.LeaderboardGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.LeaderboardListCall.html) + * [*list by player*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.EventListByPlayerCall.html), [*list definitions*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.EventListDefinitionCall.html) and [*record*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.EventRecordCall.html) +* [leaderboards](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Leaderboard.html) + * [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.LeaderboardGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.LeaderboardListCall.html) * metagame - * [*get metagame config*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.MetagameGetMetagameConfigCall.html) and [*list categories by player*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.MetagameListCategoriesByPlayerCall.html) -* [players](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Player.html) - * [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.PlayerGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.PlayerListCall.html) + * [*get metagame config*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.MetagameGetMetagameConfigCall.html) and [*list categories by player*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.MetagameListCategoriesByPlayerCall.html) +* [players](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Player.html) + * [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.PlayerGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.PlayerListCall.html) * pushtokens - * [*remove*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.PushtokenRemoveCall.html) and [*update*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.PushtokenUpdateCall.html) -* [quest milestones](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.QuestMilestone.html) - * [*claim*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.QuestMilestoneClaimCall.html) -* [quests](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Quest.html) - * [*accept*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.QuestAcceptCall.html) and [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.QuestListCall.html) + * [*remove*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.PushtokenRemoveCall.html) and [*update*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.PushtokenUpdateCall.html) +* [quest milestones](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.QuestMilestone.html) + * [*claim*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.QuestMilestoneClaimCall.html) +* [quests](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Quest.html) + * [*accept*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.QuestAcceptCall.html) and [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.QuestListCall.html) * revisions - * [*check*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RevisionCheckCall.html) -* [rooms](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Room.html) - * [*create*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomDismisCall.html), [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomGetCall.html), [*join*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomLeaveCall.html), [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomListCall.html) and [*report status*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.RoomReportStatuCall.html) + * [*check*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RevisionCheckCall.html) +* [rooms](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Room.html) + * [*create*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomDismisCall.html), [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomGetCall.html), [*join*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomLeaveCall.html), [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomListCall.html) and [*report status*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.RoomReportStatuCall.html) * scores - * [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ScoreGetCall.html), [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ScoreListCall.html), [*list window*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ScoreListWindowCall.html), [*submit*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ScoreSubmitCall.html) and [*submit multiple*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.ScoreSubmitMultipleCall.html) -* [snapshots](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Snapshot.html) - * [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.SnapshotGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.SnapshotListCall.html) + * [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ScoreGetCall.html), [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ScoreListCall.html), [*list window*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ScoreListWindowCall.html), [*submit*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ScoreSubmitCall.html) and [*submit multiple*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.ScoreSubmitMultipleCall.html) +* [snapshots](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Snapshot.html) + * [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.SnapshotGetCall.html) and [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.SnapshotListCall.html) * turn based matches - * [*cancel*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheCancelCall.html), [*create*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheDismisCall.html), [*finish*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheFinishCall.html), [*get*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheGetCall.html), [*join*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheLeaveCall.html), [*leave turn*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheLeaveTurnCall.html), [*list*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheListCall.html), [*rematch*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheRematchCall.html), [*sync*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheSyncCall.html) and [*take turn*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.TurnBasedMatcheTakeTurnCall.html) + * [*cancel*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheCancelCall.html), [*create*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheCreateCall.html), [*decline*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheDeclineCall.html), [*dismiss*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheDismisCall.html), [*finish*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheFinishCall.html), [*get*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheGetCall.html), [*join*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheJoinCall.html), [*leave*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheLeaveCall.html), [*leave turn*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheLeaveTurnCall.html), [*list*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheListCall.html), [*rematch*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheRematchCall.html), [*sync*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheSyncCall.html) and [*take turn*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.TurnBasedMatcheTakeTurnCall.html) @@ -51,17 +51,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-games1/1.0.5+20170511/google_games1/struct.Games.html)** +* **[Hub](https://docs.rs/google-games1/1.0.6+20170511/google_games1/struct.Games.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.Part.html)** + * **[Parts](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -154,17 +154,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-games1/1.0.5+20170511/google_games1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-games1/1.0.6+20170511/google_games1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-games1/1.0.5+20170511/google_games1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-games1/1.0.6+20170511/google_games1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-games1/1.0.6+20170511/google_games1/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")`. @@ -174,29 +174,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-games1/1.0.6+20170511/google_games1/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](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-games1/1.0.6+20170511/google_games1/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](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-games1/1.0.5+20170511/google_games1/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](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-games1/1.0.6+20170511/google_games1/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](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-games1/1.0.6+20170511/google_games1/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](https://docs.rs/google-games1/1.0.5+20170511/google_games1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-games1/1.0.6+20170511/google_games1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/games1/src/lib.rs b/gen/games1/src/lib.rs index dda69505a9..22eca36eeb 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Games* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *games:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Games* *v1* API can be found at the //! [official documentation site](https://developers.google.com/games/services/). @@ -360,7 +360,7 @@ impl<'a, C, A> Games Games { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/games/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -413,7 +413,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/gamesconfiguration1_configuration-cli/Cargo.toml b/gen/gamesconfiguration1_configuration-cli/Cargo.toml index 67712cc0d8..f4dca71997 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 = "1.0.5+20170511" +version = "1.0.6+20170511" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-gamesconfiguration1_configuration] path = "../gamesconfiguration1_configuration" -version = "1.0.5+20170511" +version = "1.0.6+20170511" diff --git a/gen/gamesconfiguration1_configuration-cli/README.md b/gen/gamesconfiguration1_configuration-cli/README.md index 849a16d00d..33059cf853 100644 --- a/gen/gamesconfiguration1_configuration-cli/README.md +++ b/gen/gamesconfiguration1_configuration-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games Configuration* API at revision *20170511*. The CLI is at version *1.0.5*. +This documentation was generated from the *Games Configuration* API at revision *20170511*. The CLI is at version *1.0.6*. ```bash gamesconfiguration1-configuration [options] diff --git a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml index d270ccf793..31741b2fac 100644 --- a/gen/gamesconfiguration1_configuration-cli/mkdocs.yml +++ b/gen/gamesconfiguration1_configuration-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Configuration v1.0.5+20170511 +site_name: Games Configuration v1.0.6+20170511 site_url: http://byron.github.io/google-apis-rs/google-gamesconfiguration1_configuration-cli site_description: A complete library to interact with Games Configuration (protocol v1configuration) diff --git a/gen/gamesconfiguration1_configuration-cli/src/cmn.rs b/gen/gamesconfiguration1_configuration-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/cmn.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/gamesconfiguration1_configuration-cli/src/main.rs b/gen/gamesconfiguration1_configuration-cli/src/main.rs index 700a1263cf..b93dcce33c 100644 --- a/gen/gamesconfiguration1_configuration-cli/src/main.rs +++ b/gen/gamesconfiguration1_configuration-cli/src/main.rs @@ -1552,7 +1552,7 @@ fn main() { let mut app = App::new("gamesconfiguration1-configuration") .author("Sebastian Thiel ") - .version("1.0.5+20170511") + .version("1.0.6+20170511") .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") diff --git a/gen/gamesconfiguration1_configuration/Cargo.toml b/gen/gamesconfiguration1_configuration/Cargo.toml index 883b09d1c2..3ddaf76131 100644 --- a/gen/gamesconfiguration1_configuration/Cargo.toml +++ b/gen/gamesconfiguration1_configuration/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-gamesconfiguration1_configuration" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" homepage = "https://developers.google.com/games/services" -documentation = "https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511" +documentation = "https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511" license = "MIT" keywords = ["gamesConfiguration", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/gamesconfiguration1_configuration/README.md b/gen/gamesconfiguration1_configuration/README.md index cf84fdf49f..8908d739bb 100644 --- a/gen/gamesconfiguration1_configuration/README.md +++ b/gen/gamesconfiguration1_configuration/README.md @@ -5,25 +5,25 @@ 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Games Configuration* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Games Configuration* *v1_configuration* API can be found at the [official documentation site](https://developers.google.com/games/services). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html) ... -* [achievement configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfiguration.html) - * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationUpdateCall.html) -* [image configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.ImageConfiguration.html) - * [*upload*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) -* [leaderboard configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfiguration.html) - * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationUpdateCall.html) +* [achievement configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfiguration.html) + * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.AchievementConfigurationUpdateCall.html) +* [image configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.ImageConfiguration.html) + * [*upload*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) +* [leaderboard configurations](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfiguration.html) + * [*delete*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationDeleteCall.html), [*get*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationGetCall.html), [*insert*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationInsertCall.html), [*list*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationListCall.html), [*patch*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationPatchCall.html) and [*update*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.LeaderboardConfigurationUpdateCall.html) Upload supported by ... -* [*upload image configurations*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) +* [*upload image configurations*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.ImageConfigurationUploadCall.html) @@ -31,17 +31,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html)** +* **[Hub](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/struct.GamesConfiguration.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.Part.html)** + * **[Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/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")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/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](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/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](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.RequestValue.html) and -[decodable](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/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](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.RequestValue.html) and +[decodable](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/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](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/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](https://docs.rs/google-gamesconfiguration1_configuration/1.0.5+20170511/google_gamesconfiguration1_configuration/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-gamesconfiguration1_configuration/1.0.6+20170511/google_gamesconfiguration1_configuration/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/gamesconfiguration1_configuration/src/lib.rs b/gen/gamesconfiguration1_configuration/src/lib.rs index b52ac131a9..3924f7411f 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Games Configuration* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *gamesConfiguration:v1configuration* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Games Configuration* *v1_configuration* API can be found at the //! [official documentation site](https://developers.google.com/games/services). @@ -328,7 +328,7 @@ impl<'a, C, A> GamesConfiguration GamesConfiguration { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/games/v1configuration/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -345,7 +345,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/gamesmanagement1_management-cli/Cargo.toml b/gen/gamesmanagement1_management-cli/Cargo.toml index a1c2af28c9..5d211e82d3 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 = "1.0.5+20170511" +version = "1.0.6+20170511" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-gamesmanagement1_management] path = "../gamesmanagement1_management" -version = "1.0.5+20170511" +version = "1.0.6+20170511" diff --git a/gen/gamesmanagement1_management-cli/README.md b/gen/gamesmanagement1_management-cli/README.md index 14453e409c..ddff6a150e 100644 --- a/gen/gamesmanagement1_management-cli/README.md +++ b/gen/gamesmanagement1_management-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Games Management* API at revision *20170511*. The CLI is at version *1.0.5*. +This documentation was generated from the *Games Management* API at revision *20170511*. The CLI is at version *1.0.6*. ```bash gamesmanagement1-management [options] diff --git a/gen/gamesmanagement1_management-cli/mkdocs.yml b/gen/gamesmanagement1_management-cli/mkdocs.yml index 922c092600..7dc3169687 100644 --- a/gen/gamesmanagement1_management-cli/mkdocs.yml +++ b/gen/gamesmanagement1_management-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Games Management v1.0.5+20170511 +site_name: Games Management v1.0.6+20170511 site_url: http://byron.github.io/google-apis-rs/google-gamesmanagement1_management-cli site_description: A complete library to interact with Games Management (protocol v1management) diff --git a/gen/gamesmanagement1_management-cli/src/cmn.rs b/gen/gamesmanagement1_management-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/gamesmanagement1_management-cli/src/cmn.rs +++ b/gen/gamesmanagement1_management-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/gamesmanagement1_management-cli/src/main.rs b/gen/gamesmanagement1_management-cli/src/main.rs index 4beb7e705d..15c95b5319 100644 --- a/gen/gamesmanagement1_management-cli/src/main.rs +++ b/gen/gamesmanagement1_management-cli/src/main.rs @@ -2079,7 +2079,7 @@ fn main() { let mut app = App::new("gamesmanagement1-management") .author("Sebastian Thiel ") - .version("1.0.5+20170511") + .version("1.0.6+20170511") .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") diff --git a/gen/gamesmanagement1_management/Cargo.toml b/gen/gamesmanagement1_management/Cargo.toml index 396bea817c..3ab44f4a93 100644 --- a/gen/gamesmanagement1_management/Cargo.toml +++ b/gen/gamesmanagement1_management/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-gamesmanagement1_management" -version = "1.0.5+20170511" +version = "1.0.6+20170511" 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" homepage = "https://developers.google.com/games/services" -documentation = "https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511" +documentation = "https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511" license = "MIT" keywords = ["gamesManagement", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/gamesmanagement1_management/README.md b/gen/gamesmanagement1_management/README.md index 95857db342..ea637f40dd 100644 --- a/gen/gamesmanagement1_management/README.md +++ b/gen/gamesmanagement1_management/README.md @@ -5,30 +5,30 @@ 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Games Management* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Games Management* *v1_management* API can be found at the [official documentation site](https://developers.google.com/games/services). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.GamesManagement.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.GamesManagement.html) ... * achievements - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.AchievementResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.AchievementResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.AchievementResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.AchievementResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.AchievementResetMultipleForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.AchievementResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.AchievementResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.AchievementResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.AchievementResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.AchievementResetMultipleForAllPlayerCall.html) * applications - * [*list hidden*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.ApplicationListHiddenCall.html) + * [*list hidden*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.ApplicationListHiddenCall.html) * events - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.EventResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.EventResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.EventResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.EventResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.EventResetMultipleForAllPlayerCall.html) -* [players](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.Player.html) - * [*hide*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.PlayerHideCall.html) and [*unhide*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.PlayerUnhideCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.EventResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.EventResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.EventResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.EventResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.EventResetMultipleForAllPlayerCall.html) +* [players](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.Player.html) + * [*hide*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.PlayerHideCall.html) and [*unhide*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.PlayerUnhideCall.html) * quests - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.QuestResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.QuestResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.QuestResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.QuestResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.QuestResetMultipleForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.QuestResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.QuestResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.QuestResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.QuestResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.QuestResetMultipleForAllPlayerCall.html) * rooms - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.RoomResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.RoomResetForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.RoomResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.RoomResetForAllPlayerCall.html) * scores - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.ScoreResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.ScoreResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.ScoreResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.ScoreResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.ScoreResetMultipleForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.ScoreResetCall.html), [*reset all*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.ScoreResetAllCall.html), [*reset all for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.ScoreResetAllForAllPlayerCall.html), [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.ScoreResetForAllPlayerCall.html) and [*reset multiple for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.ScoreResetMultipleForAllPlayerCall.html) * turn based matches - * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.TurnBasedMatcheResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.TurnBasedMatcheResetForAllPlayerCall.html) + * [*reset*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.TurnBasedMatcheResetCall.html) and [*reset for all players*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.TurnBasedMatcheResetForAllPlayerCall.html) @@ -37,17 +37,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/struct.GamesManagement.html)** +* **[Hub](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/struct.GamesManagement.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.Part.html)** + * **[Parts](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -131,17 +131,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/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")`. @@ -151,29 +151,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/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](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/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](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.RequestValue.html) and -[decodable](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/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](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.RequestValue.html) and +[decodable](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/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](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/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](https://docs.rs/google-gamesmanagement1_management/1.0.5+20170511/google_gamesmanagement1_management/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-gamesmanagement1_management/1.0.6+20170511/google_gamesmanagement1_management/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/gamesmanagement1_management/src/lib.rs b/gen/gamesmanagement1_management/src/lib.rs index 71681e0ed9..3b9e65695d 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 *1.0.5+20170511*, where *20170511* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Games Management* crate version *1.0.6+20170511*, where *20170511* is the exact revision of the *gamesManagement:v1management* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Games Management* *v1_management* API can be found at the //! [official documentation site](https://developers.google.com/games/services). @@ -330,7 +330,7 @@ impl<'a, C, A> GamesManagement GamesManagement { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/games/v1management/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -362,7 +362,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/gan1_beta1-cli/Cargo.toml b/gen/gan1_beta1-cli/Cargo.toml index 9d035f438b..2514db5850 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 = "1.0.5+20130205" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-gan1_beta1] path = "../gan1_beta1" -version = "1.0.5+20130205" +version = "1.0.6+20130205" diff --git a/gen/gan1_beta1-cli/README.md b/gen/gan1_beta1-cli/README.md index c0a5115c46..ad0353efd0 100644 --- a/gen/gan1_beta1-cli/README.md +++ b/gen/gan1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *gan* API at revision *20130205*. The CLI is at version *1.0.5*. +This documentation was generated from the *gan* API at revision *20130205*. The CLI is at version *1.0.6*. ```bash gan1-beta1 [options] diff --git a/gen/gan1_beta1-cli/mkdocs.yml b/gen/gan1_beta1-cli/mkdocs.yml index 887cf25147..9a890750c3 100644 --- a/gen/gan1_beta1-cli/mkdocs.yml +++ b/gen/gan1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: gan v1.0.5+20130205 +site_name: gan v1.0.6+20130205 site_url: http://byron.github.io/google-apis-rs/google-gan1_beta1-cli site_description: A complete library to interact with gan (protocol v1beta1) diff --git a/gen/gan1_beta1-cli/src/cmn.rs b/gen/gan1_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/gan1_beta1-cli/src/cmn.rs +++ b/gen/gan1_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/gan1_beta1-cli/src/main.rs b/gen/gan1_beta1-cli/src/main.rs index 92abcfffa2..e6647aafed 100644 --- a/gen/gan1_beta1-cli/src/main.rs +++ b/gen/gan1_beta1-cli/src/main.rs @@ -1263,7 +1263,7 @@ fn main() { let mut app = App::new("gan1-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20130205") + .version("1.0.6+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") diff --git a/gen/gan1_beta1/Cargo.toml b/gen/gan1_beta1/Cargo.toml index 356de1317c..f6ba1c412c 100644 --- a/gen/gan1_beta1/Cargo.toml +++ b/gen/gan1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-gan1_beta1" -version = "1.0.5+20130205" +version = "1.0.6+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" homepage = "https://developers.google.com/affiliate-network/" -documentation = "https://docs.rs/google-gan1_beta1/1.0.5+20130205" +documentation = "https://docs.rs/google-gan1_beta1/1.0.6+20130205" license = "MIT" keywords = ["gan", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/gan1_beta1/README.md b/gen/gan1_beta1/README.md index 45e0486de4..520570ff2c 100644 --- a/gen/gan1_beta1/README.md +++ b/gen/gan1_beta1/README.md @@ -5,26 +5,26 @@ 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 *1.0.5+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *gan* crate version *1.0.6+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *gan* *v1_beta1* API can be found at the [official documentation site](https://developers.google.com/affiliate-network/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Gan.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Gan.html) ... -* [advertisers](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Advertiser.html) - * [*get*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.AdvertiserGetCall.html) and [*list*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.AdvertiserListCall.html) -* [cc offers](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.CcOffer.html) - * [*list*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.CcOfferListCall.html) -* [events](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Event.html) - * [*list*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.EventListCall.html) -* [links](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Link.html) - * [*get*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.LinkGetCall.html), [*insert*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.LinkInsertCall.html) and [*list*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.LinkListCall.html) -* [publishers](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Publisher.html) - * [*get*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.PublisherGetCall.html) and [*list*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.PublisherListCall.html) -* [reports](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Report.html) - * [*get*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.ReportGetCall.html) +* [advertisers](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Advertiser.html) + * [*get*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.AdvertiserGetCall.html) and [*list*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.AdvertiserListCall.html) +* [cc offers](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.CcOffer.html) + * [*list*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.CcOfferListCall.html) +* [events](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Event.html) + * [*list*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.EventListCall.html) +* [links](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Link.html) + * [*get*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.LinkGetCall.html), [*insert*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.LinkInsertCall.html) and [*list*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.LinkListCall.html) +* [publishers](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Publisher.html) + * [*get*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.PublisherGetCall.html) and [*list*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.PublisherListCall.html) +* [reports](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Report.html) + * [*get*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.ReportGetCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/struct.Gan.html)** +* **[Hub](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/struct.Gan.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -141,17 +141,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/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")`. @@ -161,29 +161,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/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](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/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](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_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](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/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](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/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](https://docs.rs/google-gan1_beta1/1.0.5+20130205/google_gan1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-gan1_beta1/1.0.6+20130205/google_gan1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/gan1_beta1/src/lib.rs b/gen/gan1_beta1/src/lib.rs index 8232cf3899..ff06df2fba 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 *1.0.5+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *gan* crate version *1.0.6+20130205*, where *20130205* is the exact revision of the *gan:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *gan* *v1_beta1* API can be found at the //! [official documentation site](https://developers.google.com/affiliate-network/). @@ -327,7 +327,7 @@ impl<'a, C, A> Gan Gan { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/gan/v1beta1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -353,7 +353,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/genomics1-cli/Cargo.toml b/gen/genomics1-cli/Cargo.toml index 1800cea7db..c4c021f66d 100644 --- a/gen/genomics1-cli/Cargo.toml +++ b/gen/genomics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-genomics1-cli" -version = "1.0.5+20170520" +version = "1.0.6+20170520" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-genomics1] path = "../genomics1" -version = "1.0.5+20170520" +version = "1.0.6+20170520" diff --git a/gen/genomics1-cli/README.md b/gen/genomics1-cli/README.md index 9e9f0bd455..0fad7da4cd 100644 --- a/gen/genomics1-cli/README.md +++ b/gen/genomics1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *genomics* API at revision *20170520*. The CLI is at version *1.0.5*. +This documentation was generated from the *genomics* API at revision *20170520*. The CLI is at version *1.0.6*. ```bash genomics1 [options] diff --git a/gen/genomics1-cli/mkdocs.yml b/gen/genomics1-cli/mkdocs.yml index c4a685f8a4..b79921b76f 100644 --- a/gen/genomics1-cli/mkdocs.yml +++ b/gen/genomics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: genomics v1.0.5+20170520 +site_name: genomics v1.0.6+20170520 site_url: http://byron.github.io/google-apis-rs/google-genomics1-cli site_description: A complete library to interact with genomics (protocol v1) diff --git a/gen/genomics1-cli/src/cmn.rs b/gen/genomics1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/genomics1-cli/src/cmn.rs +++ b/gen/genomics1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/genomics1-cli/src/main.rs b/gen/genomics1-cli/src/main.rs index a9e34ab17f..c2568fe5b9 100644 --- a/gen/genomics1-cli/src/main.rs +++ b/gen/genomics1-cli/src/main.rs @@ -6241,7 +6241,7 @@ fn main() { let mut app = App::new("genomics1") .author("Sebastian Thiel ") - .version("1.0.5+20170520") + .version("1.0.6+20170520") .about("Upload, process, query, and search Genomics data in the cloud.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_genomics1_cli") .arg(Arg::with_name("url") diff --git a/gen/genomics1/Cargo.toml b/gen/genomics1/Cargo.toml index 4d7daf0178..b0d09439fe 100644 --- a/gen/genomics1/Cargo.toml +++ b/gen/genomics1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-genomics1" -version = "1.0.5+20170520" +version = "1.0.6+20170520" 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" homepage = "https://cloud.google.com/genomics" -documentation = "https://docs.rs/google-genomics1/1.0.5+20170520" +documentation = "https://docs.rs/google-genomics1/1.0.6+20170520" license = "MIT" keywords = ["genomics", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/genomics1/README.md b/gen/genomics1/README.md index 3a97ca3444..28515e49f2 100644 --- a/gen/genomics1/README.md +++ b/gen/genomics1/README.md @@ -5,36 +5,36 @@ 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 *1.0.5+20170520*, where *20170520* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *genomics* crate version *1.0.6+20170520*, where *20170520* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *genomics* *v1* API can be found at the [official documentation site](https://cloud.google.com/genomics). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Genomics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Genomics.html) ... -* [annotations](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Annotation.html) - * [*batch create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationBatchCreateCall.html), [*create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationGetCall.html), [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationSearchCall.html) and [*update*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationUpdateCall.html) +* [annotations](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Annotation.html) + * [*batch create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationBatchCreateCall.html), [*create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationGetCall.html), [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationSearchCall.html) and [*update*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationUpdateCall.html) * annotationsets - * [*create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationsetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationsetGetCall.html), [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationsetSearchCall.html) and [*update*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.AnnotationsetUpdateCall.html) + * [*create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationsetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationsetGetCall.html), [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationsetSearchCall.html) and [*update*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.AnnotationsetUpdateCall.html) * callsets - * [*create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.CallsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.CallsetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.CallsetGetCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.CallsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.CallsetSearchCall.html) -* [datasets](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Dataset.html) - * [*create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetGetCall.html), [*get iam policy*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetGetIamPolicyCall.html), [*list*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetPatchCall.html), [*set iam policy*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetTestIamPermissionCall.html) and [*undelete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.DatasetUndeleteCall.html) -* [operations](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Operation.html) - * [*cancel*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.OperationCancelCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.OperationListCall.html) + * [*create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.CallsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.CallsetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.CallsetGetCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.CallsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.CallsetSearchCall.html) +* [datasets](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Dataset.html) + * [*create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetGetCall.html), [*get iam policy*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetGetIamPolicyCall.html), [*list*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetListCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetPatchCall.html), [*set iam policy*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetTestIamPermissionCall.html) and [*undelete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.DatasetUndeleteCall.html) +* [operations](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Operation.html) + * [*cancel*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.OperationCancelCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.OperationListCall.html) * readgroupsets - * [*coveragebuckets list*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetDeleteCall.html), [*export*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetExportCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetGetCall.html), [*import*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetImportCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadgroupsetSearchCall.html) -* [reads](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Read.html) - * [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReadSearchCall.html) -* [references](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Reference.html) - * [*bases list*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReferenceBaseListCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReferenceGetCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReferenceSearchCall.html) + * [*coveragebuckets list*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetCoveragebucketListCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetDeleteCall.html), [*export*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetExportCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetGetCall.html), [*import*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetImportCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadgroupsetSearchCall.html) +* [reads](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Read.html) + * [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReadSearchCall.html) +* [references](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Reference.html) + * [*bases list*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReferenceBaseListCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReferenceGetCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReferenceSearchCall.html) * referencesets - * [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReferencesetGetCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.ReferencesetSearchCall.html) -* [variants](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Variant.html) - * [*create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantGetCall.html), [*import*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantImportCall.html), [*merge*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantMergeCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantSearchCall.html) + * [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReferencesetGetCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.ReferencesetSearchCall.html) +* [variants](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Variant.html) + * [*create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantDeleteCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantGetCall.html), [*import*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantImportCall.html), [*merge*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantMergeCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantSearchCall.html) * variantsets - * [*create*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantsetDeleteCall.html), [*export*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantsetExportCall.html), [*get*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantsetGetCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.VariantsetSearchCall.html) + * [*create*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantsetCreateCall.html), [*delete*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantsetDeleteCall.html), [*export*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantsetExportCall.html), [*get*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantsetGetCall.html), [*patch*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantsetPatchCall.html) and [*search*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.VariantsetSearchCall.html) @@ -43,17 +43,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/struct.Genomics.html)** +* **[Hub](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/struct.Genomics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.Part.html)** + * **[Parts](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -151,17 +151,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/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")`. @@ -171,29 +171,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/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](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/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](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/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](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/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](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/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](https://docs.rs/google-genomics1/1.0.5+20170520/google_genomics1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-genomics1/1.0.6+20170520/google_genomics1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/genomics1/src/lib.rs b/gen/genomics1/src/lib.rs index e6312c31e6..44df2e75a7 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 *1.0.5+20170520*, where *20170520* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *genomics* crate version *1.0.6+20170520*, where *20170520* is the exact revision of the *genomics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *genomics* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/genomics). @@ -369,7 +369,7 @@ impl<'a, C, A> Genomics Genomics { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://genomics.googleapis.com/".to_string(), _root_url: "https://genomics.googleapis.com/".to_string(), } @@ -410,7 +410,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/gmail1-cli/Cargo.toml b/gen/gmail1-cli/Cargo.toml index 6393b43afc..29ebf765ef 100644 --- a/gen/gmail1-cli/Cargo.toml +++ b/gen/gmail1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-gmail1-cli" -version = "1.0.5+20170510" +version = "1.0.6+20170510" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-gmail1] path = "../gmail1" -version = "1.0.5+20170510" +version = "1.0.6+20170510" diff --git a/gen/gmail1-cli/README.md b/gen/gmail1-cli/README.md index ebdf6f4821..bc39b35f30 100644 --- a/gen/gmail1-cli/README.md +++ b/gen/gmail1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *gmail* API at revision *20170510*. The CLI is at version *1.0.5*. +This documentation was generated from the *gmail* API at revision *20170510*. The CLI is at version *1.0.6*. ```bash gmail1 [options] diff --git a/gen/gmail1-cli/mkdocs.yml b/gen/gmail1-cli/mkdocs.yml index 4acbb137b9..3566a3aab1 100644 --- a/gen/gmail1-cli/mkdocs.yml +++ b/gen/gmail1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: gmail v1.0.5+20170510 +site_name: gmail v1.0.6+20170510 site_url: http://byron.github.io/google-apis-rs/google-gmail1-cli site_description: A complete library to interact with gmail (protocol v1) diff --git a/gen/gmail1-cli/src/cmn.rs b/gen/gmail1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/gmail1-cli/src/cmn.rs +++ b/gen/gmail1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/gmail1-cli/src/main.rs b/gen/gmail1-cli/src/main.rs index ea9cf72b71..cc7d2f4c47 100644 --- a/gen/gmail1-cli/src/main.rs +++ b/gen/gmail1-cli/src/main.rs @@ -6247,7 +6247,7 @@ fn main() { let mut app = App::new("gmail1") .author("Sebastian Thiel ") - .version("1.0.5+20170510") + .version("1.0.6+20170510") .about("Access Gmail mailboxes including sending user email.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_gmail1_cli") .arg(Arg::with_name("url") diff --git a/gen/gmail1/Cargo.toml b/gen/gmail1/Cargo.toml index b099d2a6c3..f841f358ac 100644 --- a/gen/gmail1/Cargo.toml +++ b/gen/gmail1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-gmail1" -version = "1.0.5+20170510" +version = "1.0.6+20170510" 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" homepage = "https://developers.google.com/gmail/api/" -documentation = "https://docs.rs/google-gmail1/1.0.5+20170510" +documentation = "https://docs.rs/google-gmail1/1.0.6+20170510" license = "MIT" keywords = ["gmail", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/gmail1/README.md b/gen/gmail1/README.md index e5ada1c28c..5fbdd5b84e 100644 --- a/gen/gmail1/README.md +++ b/gen/gmail1/README.md @@ -5,26 +5,26 @@ 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 *1.0.5+20170510*, where *20170510* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *gmail* crate version *1.0.6+20170510*, where *20170510* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *gmail* *v1* API can be found at the [official documentation site](https://developers.google.com/gmail/api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.Gmail.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.Gmail.html) ... * users - * [*drafts create*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftCreateCall.html), [*drafts delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftDeleteCall.html), [*drafts get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftGetCall.html), [*drafts list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftListCall.html), [*drafts send*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftSendCall.html), [*drafts update*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftUpdateCall.html), [*get profile*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserGetProfileCall.html), [*history list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserHistoryListCall.html), [*labels create*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserLabelCreateCall.html), [*labels delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserLabelDeleteCall.html), [*labels get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserLabelGetCall.html), [*labels list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserLabelListCall.html), [*labels patch*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserLabelPatchCall.html), [*labels update*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserLabelUpdateCall.html), [*messages attachments get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageAttachmentGetCall.html), [*messages batch delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageBatchDeleteCall.html), [*messages batch modify*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageBatchModifyCall.html), [*messages delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageDeleteCall.html), [*messages get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageGetCall.html), [*messages import*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageImportCall.html), [*messages insert*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageInsertCall.html), [*messages list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageListCall.html), [*messages modify*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageModifyCall.html), [*messages send*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageSendCall.html), [*messages trash*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageTrashCall.html), [*messages untrash*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageUntrashCall.html), [*settings filters create*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingFilterCreateCall.html), [*settings filters delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingFilterDeleteCall.html), [*settings filters get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingFilterGetCall.html), [*settings filters list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingFilterListCall.html), [*settings forwarding addresses create*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingForwardingAddresseCreateCall.html), [*settings forwarding addresses delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingForwardingAddresseDeleteCall.html), [*settings forwarding addresses get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingForwardingAddresseGetCall.html), [*settings forwarding addresses list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingForwardingAddresseListCall.html), [*settings get auto forwarding*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingGetAutoForwardingCall.html), [*settings get imap*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingGetImapCall.html), [*settings get pop*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingGetPopCall.html), [*settings get vacation*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingGetVacationCall.html), [*settings send as create*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendACreateCall.html), [*settings send as delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendADeleteCall.html), [*settings send as get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendAGetCall.html), [*settings send as list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendAListCall.html), [*settings send as patch*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendAPatchCall.html), [*settings send as smime info delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendASmimeInfoDeleteCall.html), [*settings send as smime info get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendASmimeInfoGetCall.html), [*settings send as smime info insert*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendASmimeInfoInsertCall.html), [*settings send as smime info list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendASmimeInfoListCall.html), [*settings send as smime info set default*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendASmimeInfoSetDefaultCall.html), [*settings send as update*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendAUpdateCall.html), [*settings send as verify*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingSendAVerifyCall.html), [*settings update auto forwarding*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingUpdateAutoForwardingCall.html), [*settings update imap*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingUpdateImapCall.html), [*settings update pop*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingUpdatePopCall.html), [*settings update vacation*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserSettingUpdateVacationCall.html), [*stop*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserStopCall.html), [*threads delete*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserThreadDeleteCall.html), [*threads get*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserThreadGetCall.html), [*threads list*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserThreadListCall.html), [*threads modify*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserThreadModifyCall.html), [*threads trash*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserThreadTrashCall.html), [*threads untrash*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserThreadUntrashCall.html) and [*watch*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserWatchCall.html) + * [*drafts create*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftCreateCall.html), [*drafts delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftDeleteCall.html), [*drafts get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftGetCall.html), [*drafts list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftListCall.html), [*drafts send*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftSendCall.html), [*drafts update*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftUpdateCall.html), [*get profile*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserGetProfileCall.html), [*history list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserHistoryListCall.html), [*labels create*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserLabelCreateCall.html), [*labels delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserLabelDeleteCall.html), [*labels get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserLabelGetCall.html), [*labels list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserLabelListCall.html), [*labels patch*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserLabelPatchCall.html), [*labels update*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserLabelUpdateCall.html), [*messages attachments get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageAttachmentGetCall.html), [*messages batch delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageBatchDeleteCall.html), [*messages batch modify*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageBatchModifyCall.html), [*messages delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageDeleteCall.html), [*messages get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageGetCall.html), [*messages import*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageImportCall.html), [*messages insert*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageInsertCall.html), [*messages list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageListCall.html), [*messages modify*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageModifyCall.html), [*messages send*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageSendCall.html), [*messages trash*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageTrashCall.html), [*messages untrash*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageUntrashCall.html), [*settings filters create*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingFilterCreateCall.html), [*settings filters delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingFilterDeleteCall.html), [*settings filters get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingFilterGetCall.html), [*settings filters list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingFilterListCall.html), [*settings forwarding addresses create*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingForwardingAddresseCreateCall.html), [*settings forwarding addresses delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingForwardingAddresseDeleteCall.html), [*settings forwarding addresses get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingForwardingAddresseGetCall.html), [*settings forwarding addresses list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingForwardingAddresseListCall.html), [*settings get auto forwarding*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingGetAutoForwardingCall.html), [*settings get imap*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingGetImapCall.html), [*settings get pop*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingGetPopCall.html), [*settings get vacation*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingGetVacationCall.html), [*settings send as create*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendACreateCall.html), [*settings send as delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendADeleteCall.html), [*settings send as get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendAGetCall.html), [*settings send as list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendAListCall.html), [*settings send as patch*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendAPatchCall.html), [*settings send as smime info delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendASmimeInfoDeleteCall.html), [*settings send as smime info get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendASmimeInfoGetCall.html), [*settings send as smime info insert*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendASmimeInfoInsertCall.html), [*settings send as smime info list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendASmimeInfoListCall.html), [*settings send as smime info set default*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendASmimeInfoSetDefaultCall.html), [*settings send as update*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendAUpdateCall.html), [*settings send as verify*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingSendAVerifyCall.html), [*settings update auto forwarding*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingUpdateAutoForwardingCall.html), [*settings update imap*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingUpdateImapCall.html), [*settings update pop*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingUpdatePopCall.html), [*settings update vacation*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserSettingUpdateVacationCall.html), [*stop*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserStopCall.html), [*threads delete*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserThreadDeleteCall.html), [*threads get*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserThreadGetCall.html), [*threads list*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserThreadListCall.html), [*threads modify*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserThreadModifyCall.html), [*threads trash*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserThreadTrashCall.html), [*threads untrash*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserThreadUntrashCall.html) and [*watch*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserWatchCall.html) Upload supported by ... -* [*messages import users*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageImportCall.html) -* [*drafts create users*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftCreateCall.html) -* [*drafts send users*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftSendCall.html) -* [*messages send users*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageSendCall.html) -* [*drafts update users*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserDraftUpdateCall.html) -* [*messages insert users*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.UserMessageInsertCall.html) +* [*messages import users*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageImportCall.html) +* [*drafts create users*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftCreateCall.html) +* [*drafts send users*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftSendCall.html) +* [*messages send users*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageSendCall.html) +* [*drafts update users*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserDraftUpdateCall.html) +* [*messages insert users*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.UserMessageInsertCall.html) @@ -32,17 +32,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/struct.Gmail.html)** +* **[Hub](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/struct.Gmail.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.Part.html)** + * **[Parts](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -143,17 +143,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/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")`. @@ -163,29 +163,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/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](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/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](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/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](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/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](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/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](https://docs.rs/google-gmail1/1.0.5+20170510/google_gmail1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-gmail1/1.0.6+20170510/google_gmail1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/gmail1/src/lib.rs b/gen/gmail1/src/lib.rs index 43d1dc11c3..997cb22d85 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 *1.0.5+20170510*, where *20170510* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *gmail* crate version *1.0.6+20170510*, where *20170510* is the exact revision of the *gmail:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *gmail* *v1* API can be found at the //! [official documentation site](https://developers.google.com/gmail/api/). @@ -385,7 +385,7 @@ impl<'a, C, A> Gmail Gmail { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/gmail/v1/users/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -396,7 +396,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/groupsmigration1-cli/Cargo.toml b/gen/groupsmigration1-cli/Cargo.toml index 440b00c2d3..b44c56d98e 100644 --- a/gen/groupsmigration1-cli/Cargo.toml +++ b/gen/groupsmigration1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupsmigration1-cli" -version = "1.0.5+20140416" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-groupsmigration1] path = "../groupsmigration1" -version = "1.0.5+20140416" +version = "1.0.6+20140416" diff --git a/gen/groupsmigration1-cli/README.md b/gen/groupsmigration1-cli/README.md index 7ccbdafbaa..33101f7f0e 100644 --- a/gen/groupsmigration1-cli/README.md +++ b/gen/groupsmigration1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Groups Migration* API at revision *20140416*. The CLI is at version *1.0.5*. +This documentation was generated from the *Groups Migration* API at revision *20140416*. The CLI is at version *1.0.6*. ```bash groupsmigration1 [options] diff --git a/gen/groupsmigration1-cli/mkdocs.yml b/gen/groupsmigration1-cli/mkdocs.yml index 8f7d618817..1c9d3e4279 100644 --- a/gen/groupsmigration1-cli/mkdocs.yml +++ b/gen/groupsmigration1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Groups Migration v1.0.5+20140416 +site_name: Groups Migration v1.0.6+20140416 site_url: http://byron.github.io/google-apis-rs/google-groupsmigration1-cli site_description: A complete library to interact with Groups Migration (protocol v1) diff --git a/gen/groupsmigration1-cli/src/cmn.rs b/gen/groupsmigration1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/groupsmigration1-cli/src/cmn.rs +++ b/gen/groupsmigration1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/groupsmigration1-cli/src/main.rs b/gen/groupsmigration1-cli/src/main.rs index e15697e46e..d7449153dd 100644 --- a/gen/groupsmigration1-cli/src/main.rs +++ b/gen/groupsmigration1-cli/src/main.rs @@ -236,7 +236,7 @@ fn main() { let mut app = App::new("groupsmigration1") .author("Sebastian Thiel ") - .version("1.0.5+20140416") + .version("1.0.6+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") diff --git a/gen/groupsmigration1/Cargo.toml b/gen/groupsmigration1/Cargo.toml index b997d0df91..b07fff457c 100644 --- a/gen/groupsmigration1/Cargo.toml +++ b/gen/groupsmigration1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-groupsmigration1" -version = "1.0.5+20140416" +version = "1.0.6+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" homepage = "https://developers.google.com/google-apps/groups-migration/" -documentation = "https://docs.rs/google-groupsmigration1/1.0.5+20140416" +documentation = "https://docs.rs/google-groupsmigration1/1.0.6+20140416" license = "MIT" keywords = ["groupsmigration", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/groupsmigration1/README.md b/gen/groupsmigration1/README.md index 61e5d8967b..c355040246 100644 --- a/gen/groupsmigration1/README.md +++ b/gen/groupsmigration1/README.md @@ -5,21 +5,21 @@ 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 *1.0.5+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Groups Migration* crate version *1.0.6+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Groups Migration* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/groups-migration/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/struct.GroupsMigration.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/struct.GroupsMigration.html) ... * archive - * [*insert*](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/struct.ArchiveInsertCall.html) + * [*insert*](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/struct.ArchiveInsertCall.html) Upload supported by ... -* [*insert archive*](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/struct.ArchiveInsertCall.html) +* [*insert archive*](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/struct.ArchiveInsertCall.html) @@ -27,17 +27,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/struct.GroupsMigration.html)** +* **[Hub](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/struct.GroupsMigration.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.Part.html)** + * **[Parts](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -121,17 +121,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/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")`. @@ -141,29 +141,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/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](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/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](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/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](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/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](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/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](https://docs.rs/google-groupsmigration1/1.0.5+20140416/google_groupsmigration1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-groupsmigration1/1.0.6+20140416/google_groupsmigration1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/groupsmigration1/src/lib.rs b/gen/groupsmigration1/src/lib.rs index ff19f5c3f0..f32f2a8174 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 *1.0.5+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Groups Migration* crate version *1.0.6+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Groups Migration* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/groups-migration/). @@ -317,7 +317,7 @@ impl<'a, C, A> GroupsMigration GroupsMigration { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/groups/v1/groups/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -328,7 +328,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/groupssettings1-cli/Cargo.toml b/gen/groupssettings1-cli/Cargo.toml index 872c37b089..032779f367 100644 --- a/gen/groupssettings1-cli/Cargo.toml +++ b/gen/groupssettings1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-groupssettings1-cli" -version = "1.0.5+20160525" +version = "1.0.6+20160525" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-groupssettings1] path = "../groupssettings1" -version = "1.0.5+20160525" +version = "1.0.6+20160525" diff --git a/gen/groupssettings1-cli/README.md b/gen/groupssettings1-cli/README.md index a104334175..d5828f7a8a 100644 --- a/gen/groupssettings1-cli/README.md +++ b/gen/groupssettings1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *groupssettings* API at revision *20160525*. The CLI is at version *1.0.5*. +This documentation was generated from the *groupssettings* API at revision *20160525*. The CLI is at version *1.0.6*. ```bash groupssettings1 [options] diff --git a/gen/groupssettings1-cli/mkdocs.yml b/gen/groupssettings1-cli/mkdocs.yml index 16f7a613d3..89cfda877b 100644 --- a/gen/groupssettings1-cli/mkdocs.yml +++ b/gen/groupssettings1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: groupssettings v1.0.5+20160525 +site_name: groupssettings v1.0.6+20160525 site_url: http://byron.github.io/google-apis-rs/google-groupssettings1-cli site_description: A complete library to interact with groupssettings (protocol v1) diff --git a/gen/groupssettings1-cli/src/cmn.rs b/gen/groupssettings1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/groupssettings1-cli/src/cmn.rs +++ b/gen/groupssettings1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/groupssettings1-cli/src/main.rs b/gen/groupssettings1-cli/src/main.rs index 35698aa1fb..ec8db6cc9c 100644 --- a/gen/groupssettings1-cli/src/main.rs +++ b/gen/groupssettings1-cli/src/main.rs @@ -517,7 +517,7 @@ fn main() { let mut app = App::new("groupssettings1") .author("Sebastian Thiel ") - .version("1.0.5+20160525") + .version("1.0.6+20160525") .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") diff --git a/gen/groupssettings1/Cargo.toml b/gen/groupssettings1/Cargo.toml index 53981bdce7..f24a6a2ea9 100644 --- a/gen/groupssettings1/Cargo.toml +++ b/gen/groupssettings1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-groupssettings1" -version = "1.0.5+20160525" +version = "1.0.6+20160525" 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" homepage = "https://developers.google.com/google-apps/groups-settings/get_started" -documentation = "https://docs.rs/google-groupssettings1/1.0.5+20160525" +documentation = "https://docs.rs/google-groupssettings1/1.0.6+20160525" license = "MIT" keywords = ["groupssettings", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/groupssettings1/README.md b/gen/groupssettings1/README.md index 3d389065df..77e5246bda 100644 --- a/gen/groupssettings1/README.md +++ b/gen/groupssettings1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20160525*, where *20160525* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *groupssettings* crate version *1.0.6+20160525*, where *20160525* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/struct.Groupssettings.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/struct.Groupssettings.html) ... * groups - * [*get*](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/struct.GroupGetCall.html), [*patch*](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/struct.GroupUpdateCall.html) + * [*get*](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/struct.GroupGetCall.html), [*patch*](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/struct.GroupPatchCall.html) and [*update*](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/struct.GroupUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/struct.Groupssettings.html)** +* **[Hub](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/struct.Groupssettings.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.Part.html)** + * **[Parts](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -124,17 +124,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/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")`. @@ -144,29 +144,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/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](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/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](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/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](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/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](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/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](https://docs.rs/google-groupssettings1/1.0.5+20160525/google_groupssettings1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-groupssettings1/1.0.6+20160525/google_groupssettings1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/groupssettings1/src/lib.rs b/gen/groupssettings1/src/lib.rs index 9dfddcbf8f..b0f20afe38 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 *1.0.5+20160525*, where *20160525* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *groupssettings* crate version *1.0.6+20160525*, where *20160525* is the exact revision of the *groupssettings:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -325,7 +325,7 @@ impl<'a, C, A> Groupssettings Groupssettings { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/groups/v1/groups/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -336,7 +336,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/iam1-cli/Cargo.toml b/gen/iam1-cli/Cargo.toml index 038ffba726..81ea7eb6d3 100644 --- a/gen/iam1-cli/Cargo.toml +++ b/gen/iam1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-iam1-cli" -version = "1.0.5+20170515" +version = "1.0.6+20170515" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-iam1] path = "../iam1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" diff --git a/gen/iam1-cli/README.md b/gen/iam1-cli/README.md index 9602dfa1c7..f321f3cce9 100644 --- a/gen/iam1-cli/README.md +++ b/gen/iam1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *iam* API at revision *20170515*. The CLI is at version *1.0.5*. +This documentation was generated from the *iam* API at revision *20170515*. The CLI is at version *1.0.6*. ```bash iam1 [options] diff --git a/gen/iam1-cli/mkdocs.yml b/gen/iam1-cli/mkdocs.yml index 0cb2a032d3..d6b32a183d 100644 --- a/gen/iam1-cli/mkdocs.yml +++ b/gen/iam1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: iam v1.0.5+20170515 +site_name: iam v1.0.6+20170515 site_url: http://byron.github.io/google-apis-rs/google-iam1-cli site_description: A complete library to interact with iam (protocol v1) diff --git a/gen/iam1-cli/src/cmn.rs b/gen/iam1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/iam1-cli/src/cmn.rs +++ b/gen/iam1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/iam1-cli/src/main.rs b/gen/iam1-cli/src/main.rs index 2034bf344b..ce34a7cfa9 100644 --- a/gen/iam1-cli/src/main.rs +++ b/gen/iam1-cli/src/main.rs @@ -1720,7 +1720,7 @@ fn main() { let mut app = App::new("iam1") .author("Sebastian Thiel ") - .version("1.0.5+20170515") + .version("1.0.6+20170515") .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") diff --git a/gen/iam1/Cargo.toml b/gen/iam1/Cargo.toml index 543a435282..aee6517c06 100644 --- a/gen/iam1/Cargo.toml +++ b/gen/iam1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-iam1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" 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 = "https://docs.rs/google-iam1/1.0.5+20170515" +documentation = "https://docs.rs/google-iam1/1.0.6+20170515" license = "MIT" keywords = ["iam", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/iam1/README.md b/gen/iam1/README.md index 42e2244b7a..db231b9bc7 100644 --- a/gen/iam1/README.md +++ b/gen/iam1/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-iam1` library allows access to all features of the *Google iam* service. -This documentation was generated from *iam* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *iam* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.Iam.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.Iam.html) ... * projects - * [*service accounts create*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountSignBlobCall.html), [*service accounts sign jwt*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountSignJwtCall.html), [*service accounts test iam permissions*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.ProjectServiceAccountUpdateCall.html) -* [roles](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.Role.html) - * [*query grantable roles*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.RoleQueryGrantableRoleCall.html) + * [*service accounts create*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountCreateCall.html), [*service accounts delete*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountDeleteCall.html), [*service accounts get*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountGetCall.html), [*service accounts get iam policy*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountGetIamPolicyCall.html), [*service accounts keys create*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountKeyCreateCall.html), [*service accounts keys delete*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountKeyDeleteCall.html), [*service accounts keys get*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountKeyGetCall.html), [*service accounts keys list*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountKeyListCall.html), [*service accounts list*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountListCall.html), [*service accounts set iam policy*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountSetIamPolicyCall.html), [*service accounts sign blob*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountSignBlobCall.html), [*service accounts sign jwt*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountSignJwtCall.html), [*service accounts test iam permissions*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountTestIamPermissionCall.html) and [*service accounts update*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.ProjectServiceAccountUpdateCall.html) +* [roles](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.Role.html) + * [*query grantable roles*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.RoleQueryGrantableRoleCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/struct.Iam.html)** +* **[Hub](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/struct.Iam.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.Part.html)** + * **[Parts](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-iam1/1.0.6+20170515/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")`. @@ -146,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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-iam1/1.0.6+20170515/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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-iam1/1.0.6+20170515/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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/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](https://docs.rs/google-iam1/1.0.6+20170515/google_iam1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-iam1/1.0.6+20170515/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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-iam1/1.0.6+20170515/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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-iam1/1.0.6+20170515/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](https://docs.rs/google-iam1/1.0.5+20170515/google_iam1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-iam1/1.0.6+20170515/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. diff --git a/gen/iam1/src/lib.rs b/gen/iam1/src/lib.rs index 82bfd952d7..b69e72fa8d 100644 --- a/gen/iam1/src/lib.rs +++ b/gen/iam1/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 *iam* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *iam* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *iam:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *iam* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/iam/). @@ -327,7 +327,7 @@ impl<'a, C, A> Iam Iam { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://iam.googleapis.com/".to_string(), _root_url: "https://iam.googleapis.com/".to_string(), } @@ -341,7 +341,7 @@ impl<'a, C, A> Iam } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/identitytoolkit3-cli/Cargo.toml b/gen/identitytoolkit3-cli/Cargo.toml index acc94045ed..91436d947b 100644 --- a/gen/identitytoolkit3-cli/Cargo.toml +++ b/gen/identitytoolkit3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-identitytoolkit3-cli" -version = "1.0.5+20170425" +version = "1.0.6+20170425" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-identitytoolkit3] path = "../identitytoolkit3" -version = "1.0.5+20170425" +version = "1.0.6+20170425" diff --git a/gen/identitytoolkit3-cli/README.md b/gen/identitytoolkit3-cli/README.md index b9401693a0..248cb0baa4 100644 --- a/gen/identitytoolkit3-cli/README.md +++ b/gen/identitytoolkit3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Identity Toolkit* API at revision *20170425*. The CLI is at version *1.0.5*. +This documentation was generated from the *Identity Toolkit* API at revision *20170425*. The CLI is at version *1.0.6*. ```bash identitytoolkit3 [options] diff --git a/gen/identitytoolkit3-cli/mkdocs.yml b/gen/identitytoolkit3-cli/mkdocs.yml index 47fb461c26..bc3d026ec5 100644 --- a/gen/identitytoolkit3-cli/mkdocs.yml +++ b/gen/identitytoolkit3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Identity Toolkit v1.0.5+20170425 +site_name: Identity Toolkit v1.0.6+20170425 site_url: http://byron.github.io/google-apis-rs/google-identitytoolkit3-cli site_description: A complete library to interact with Identity Toolkit (protocol v3) diff --git a/gen/identitytoolkit3-cli/src/cmn.rs b/gen/identitytoolkit3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/identitytoolkit3-cli/src/cmn.rs +++ b/gen/identitytoolkit3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/identitytoolkit3-cli/src/main.rs b/gen/identitytoolkit3-cli/src/main.rs index 350ea380e7..62e97704af 100644 --- a/gen/identitytoolkit3-cli/src/main.rs +++ b/gen/identitytoolkit3-cli/src/main.rs @@ -2035,7 +2035,7 @@ fn main() { let mut app = App::new("identitytoolkit3") .author("Sebastian Thiel ") - .version("1.0.5+20170425") + .version("1.0.6+20170425") .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("url") diff --git a/gen/identitytoolkit3/Cargo.toml b/gen/identitytoolkit3/Cargo.toml index 27093b45e9..db7a997e07 100644 --- a/gen/identitytoolkit3/Cargo.toml +++ b/gen/identitytoolkit3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-identitytoolkit3" -version = "1.0.5+20170425" +version = "1.0.6+20170425" 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" homepage = "https://developers.google.com/identity-toolkit/v3/" -documentation = "https://docs.rs/google-identitytoolkit3/1.0.5+20170425" +documentation = "https://docs.rs/google-identitytoolkit3/1.0.6+20170425" license = "MIT" keywords = ["identitytoolkit", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/identitytoolkit3/README.md b/gen/identitytoolkit3/README.md index 811b39001a..2d91931a55 100644 --- a/gen/identitytoolkit3/README.md +++ b/gen/identitytoolkit3/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170425*, where *20170425* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Identity Toolkit* crate version *1.0.6+20170425*, where *20170425* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Identity Toolkit* *v3* API can be found at the [official documentation site](https://developers.google.com/identity-toolkit/v3/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.IdentityToolkit.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.IdentityToolkit.html) ... -* [relyingparty](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.Relyingparty.html) - * [*create auth uri*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyCreateAuthUriCall.html), [*delete account*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyDeleteAccountCall.html), [*download account*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyDownloadAccountCall.html), [*get account info*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyGetAccountInfoCall.html), [*get oob confirmation code*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyGetOobConfirmationCodeCall.html), [*get project config*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyGetProjectConfigCall.html), [*get public keys*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyGetPublicKeyCall.html), [*get recaptcha param*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyGetRecaptchaParamCall.html), [*reset password*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyResetPasswordCall.html), [*set account info*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartySetAccountInfoCall.html), [*set project config*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartySetProjectConfigCall.html), [*sign out user*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartySignOutUserCall.html), [*signup new user*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartySignupNewUserCall.html), [*upload account*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyUploadAccountCall.html), [*verify assertion*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyVerifyAssertionCall.html), [*verify custom token*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyVerifyCustomTokenCall.html) and [*verify password*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.RelyingpartyVerifyPasswordCall.html) +* [relyingparty](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.Relyingparty.html) + * [*create auth uri*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyCreateAuthUriCall.html), [*delete account*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyDeleteAccountCall.html), [*download account*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyDownloadAccountCall.html), [*get account info*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyGetAccountInfoCall.html), [*get oob confirmation code*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyGetOobConfirmationCodeCall.html), [*get project config*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyGetProjectConfigCall.html), [*get public keys*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyGetPublicKeyCall.html), [*get recaptcha param*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyGetRecaptchaParamCall.html), [*reset password*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyResetPasswordCall.html), [*set account info*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartySetAccountInfoCall.html), [*set project config*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartySetProjectConfigCall.html), [*sign out user*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartySignOutUserCall.html), [*signup new user*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartySignupNewUserCall.html), [*upload account*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyUploadAccountCall.html), [*verify assertion*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyVerifyAssertionCall.html), [*verify custom token*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyVerifyCustomTokenCall.html) and [*verify password*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.RelyingpartyVerifyPasswordCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/struct.IdentityToolkit.html)** +* **[Hub](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/struct.IdentityToolkit.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.Part.html)** + * **[Parts](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -122,17 +122,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/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")`. @@ -142,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](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/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](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/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](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/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](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/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](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/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](https://docs.rs/google-identitytoolkit3/1.0.5+20170425/google_identitytoolkit3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-identitytoolkit3/1.0.6+20170425/google_identitytoolkit3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/identitytoolkit3/src/lib.rs b/gen/identitytoolkit3/src/lib.rs index 6b00850c0f..b029089906 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 *1.0.5+20170425*, where *20170425* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Identity Toolkit* crate version *1.0.6+20170425*, where *20170425* is the exact revision of the *identitytoolkit:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Identity Toolkit* *v3* API can be found at the //! [official documentation site](https://developers.google.com/identity-toolkit/v3/). @@ -327,7 +327,7 @@ impl<'a, C, A> IdentityToolkit IdentityToolkit { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/identitytoolkit/v3/relyingparty/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -338,7 +338,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/licensing1-cli/Cargo.toml b/gen/licensing1-cli/Cargo.toml index a5f437f5c4..1824d14d22 100644 --- a/gen/licensing1-cli/Cargo.toml +++ b/gen/licensing1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-licensing1-cli" -version = "1.0.5+20170213" +version = "1.0.6+20170213" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-licensing1] path = "../licensing1" -version = "1.0.5+20170213" +version = "1.0.6+20170213" diff --git a/gen/licensing1-cli/README.md b/gen/licensing1-cli/README.md index 7f9cdd9431..6d12b08e74 100644 --- a/gen/licensing1-cli/README.md +++ b/gen/licensing1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *licensing* API at revision *20170213*. The CLI is at version *1.0.5*. +This documentation was generated from the *licensing* API at revision *20170213*. The CLI is at version *1.0.6*. ```bash licensing1 [options] diff --git a/gen/licensing1-cli/mkdocs.yml b/gen/licensing1-cli/mkdocs.yml index 9140409d92..56fd71798b 100644 --- a/gen/licensing1-cli/mkdocs.yml +++ b/gen/licensing1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: licensing v1.0.5+20170213 +site_name: licensing v1.0.6+20170213 site_url: http://byron.github.io/google-apis-rs/google-licensing1-cli site_description: A complete library to interact with licensing (protocol v1) diff --git a/gen/licensing1-cli/src/cmn.rs b/gen/licensing1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/licensing1-cli/src/cmn.rs +++ b/gen/licensing1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/licensing1-cli/src/main.rs b/gen/licensing1-cli/src/main.rs index 17ebad77fd..af9f146339 100644 --- a/gen/licensing1-cli/src/main.rs +++ b/gen/licensing1-cli/src/main.rs @@ -890,7 +890,7 @@ fn main() { let mut app = App::new("licensing1") .author("Sebastian Thiel ") - .version("1.0.5+20170213") + .version("1.0.6+20170213") .about("Views and manages licenses 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") diff --git a/gen/licensing1/Cargo.toml b/gen/licensing1/Cargo.toml index fab6512769..ffc9224916 100644 --- a/gen/licensing1/Cargo.toml +++ b/gen/licensing1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-licensing1" -version = "1.0.5+20170213" +version = "1.0.6+20170213" 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" homepage = "https://developers.google.com/google-apps/licensing/" -documentation = "https://docs.rs/google-licensing1/1.0.5+20170213" +documentation = "https://docs.rs/google-licensing1/1.0.6+20170213" license = "MIT" keywords = ["licensing", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/licensing1/README.md b/gen/licensing1/README.md index a24e6a8dfb..b7052d4be0 100644 --- a/gen/licensing1/README.md +++ b/gen/licensing1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170213*, where *20170213* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *licensing* crate version *1.0.6+20170213*, where *20170213* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *licensing* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/licensing/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.Licensing.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.Licensing.html) ... -* [license assignments](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignment.html) - * [*delete*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentDeleteCall.html), [*get*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentGetCall.html), [*insert*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentInsertCall.html), [*list for product*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentListForProductCall.html), [*list for product and sku*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentListForProductAndSkuCall.html), [*patch*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentPatchCall.html) and [*update*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.LicenseAssignmentUpdateCall.html) +* [license assignments](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignment.html) + * [*delete*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentDeleteCall.html), [*get*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentGetCall.html), [*insert*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentInsertCall.html), [*list for product*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentListForProductCall.html), [*list for product and sku*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentListForProductAndSkuCall.html), [*patch*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentPatchCall.html) and [*update*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.LicenseAssignmentUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/struct.Licensing.html)** +* **[Hub](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/struct.Licensing.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.Part.html)** + * **[Parts](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -124,17 +124,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/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")`. @@ -144,29 +144,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/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](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/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](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/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](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/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](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/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](https://docs.rs/google-licensing1/1.0.5+20170213/google_licensing1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-licensing1/1.0.6+20170213/google_licensing1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/licensing1/src/lib.rs b/gen/licensing1/src/lib.rs index c77b05d44d..150f44dad1 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 *1.0.5+20170213*, where *20170213* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *licensing* crate version *1.0.6+20170213*, where *20170213* is the exact revision of the *licensing:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *licensing* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/licensing/). @@ -321,7 +321,7 @@ impl<'a, C, A> Licensing Licensing { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/apps/licensing/v1/product/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -332,7 +332,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/logging2-cli/Cargo.toml b/gen/logging2-cli/Cargo.toml index 051aab3c40..84b369bd70 100644 --- a/gen/logging2-cli/Cargo.toml +++ b/gen/logging2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-logging2-cli" -version = "1.0.5+20170516" +version = "1.0.6+20170516" authors = ["Sebastian Thiel "] description = "A complete library to interact with Logging (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-logging2] path = "../logging2" -version = "1.0.5+20170516" +version = "1.0.6+20170516" diff --git a/gen/logging2-cli/README.md b/gen/logging2-cli/README.md index 614e31d1f4..a8b7741799 100644 --- a/gen/logging2-cli/README.md +++ b/gen/logging2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Logging* API at revision *20170516*. The CLI is at version *1.0.5*. +This documentation was generated from the *Logging* API at revision *20170516*. The CLI is at version *1.0.6*. ```bash logging2 [options] diff --git a/gen/logging2-cli/mkdocs.yml b/gen/logging2-cli/mkdocs.yml index 6a1cb92df0..bd53b7e4ba 100644 --- a/gen/logging2-cli/mkdocs.yml +++ b/gen/logging2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Logging v1.0.5+20170516 +site_name: Logging v1.0.6+20170516 site_url: http://byron.github.io/google-apis-rs/google-logging2-cli site_description: A complete library to interact with Logging (protocol v2) diff --git a/gen/logging2-cli/src/cmn.rs b/gen/logging2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/logging2-cli/src/cmn.rs +++ b/gen/logging2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/logging2-cli/src/main.rs b/gen/logging2-cli/src/main.rs index df04f930ee..11feca233e 100644 --- a/gen/logging2-cli/src/main.rs +++ b/gen/logging2-cli/src/main.rs @@ -3752,7 +3752,7 @@ fn main() { let mut app = App::new("logging2") .author("Sebastian Thiel ") - .version("1.0.5+20170516") + .version("1.0.6+20170516") .about("Writes log entries and manages your Stackdriver Logging configuration.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_logging2_cli") .arg(Arg::with_name("url") diff --git a/gen/logging2/Cargo.toml b/gen/logging2/Cargo.toml index f4fe990870..bfae6b243c 100644 --- a/gen/logging2/Cargo.toml +++ b/gen/logging2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-logging2" -version = "1.0.5+20170516" +version = "1.0.6+20170516" authors = ["Sebastian Thiel "] description = "A complete library to interact with Logging (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/logging2" homepage = "https://cloud.google.com/logging/docs/" -documentation = "https://docs.rs/google-logging2/1.0.5+20170516" +documentation = "https://docs.rs/google-logging2/1.0.6+20170516" license = "MIT" keywords = ["logging", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/logging2/README.md b/gen/logging2/README.md index e2037a5ed7..c3f7069861 100644 --- a/gen/logging2/README.md +++ b/gen/logging2/README.md @@ -5,26 +5,26 @@ DO NOT EDIT ! --> The `google-logging2` library allows access to all features of the *Google Logging* service. -This documentation was generated from *Logging* crate version *1.0.5+20170516*, where *20170516* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Logging* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Logging* *v2* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.Logging.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.Logging.html) ... * billing accounts - * [*logs delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.BillingAccountSinkUpdateCall.html) + * [*logs delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.BillingAccountSinkUpdateCall.html) * entries - * [*list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.EntryWriteCall.html) + * [*list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.EntryWriteCall.html) * folders - * [*logs delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.FolderSinkUpdateCall.html) -* [monitored resource descriptors](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.MonitoredResourceDescriptor.html) - * [*list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.MonitoredResourceDescriptorListCall.html) + * [*logs delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.FolderSinkUpdateCall.html) +* [monitored resource descriptors](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.MonitoredResourceDescriptor.html) + * [*list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.MonitoredResourceDescriptorListCall.html) * organizations - * [*logs delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.OrganizationSinkUpdateCall.html) + * [*logs delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationLogListCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.OrganizationSinkUpdateCall.html) * projects - * [*logs delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.ProjectSinkUpdateCall.html) + * [*logs delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.ProjectSinkUpdateCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/struct.Logging.html)** +* **[Hub](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/struct.Logging.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.Part.html)** + * **[Parts](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -144,17 +144,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/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")`. @@ -164,29 +164,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/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](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/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](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/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](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/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](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/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](https://docs.rs/google-logging2/1.0.5+20170516/google_logging2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-logging2/1.0.6+20170516/google_logging2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/logging2/src/lib.rs b/gen/logging2/src/lib.rs index 964538f9c8..eeb28442df 100644 --- a/gen/logging2/src/lib.rs +++ b/gen/logging2/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 *1.0.5+20170516*, where *20170516* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Logging* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *logging:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Logging* *v2* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). @@ -362,7 +362,7 @@ impl<'a, C, A> Logging Logging { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://logging.googleapis.com/".to_string(), _root_url: "https://logging.googleapis.com/".to_string(), } @@ -388,7 +388,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/logging2_beta1-cli/Cargo.toml b/gen/logging2_beta1-cli/Cargo.toml index ee5d027c81..dc5cb70143 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 = "1.0.5+20170516" +version = "1.0.6+20170516" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-logging2_beta1] path = "../logging2_beta1" -version = "1.0.5+20170516" +version = "1.0.6+20170516" diff --git a/gen/logging2_beta1-cli/README.md b/gen/logging2_beta1-cli/README.md index 81d3e9eba4..acd70c9a50 100644 --- a/gen/logging2_beta1-cli/README.md +++ b/gen/logging2_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Logging* API at revision *20170516*. The CLI is at version *1.0.5*. +This documentation was generated from the *Logging* API at revision *20170516*. The CLI is at version *1.0.6*. ```bash logging2-beta1 [options] diff --git a/gen/logging2_beta1-cli/mkdocs.yml b/gen/logging2_beta1-cli/mkdocs.yml index a75d58b253..f727395e66 100644 --- a/gen/logging2_beta1-cli/mkdocs.yml +++ b/gen/logging2_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Logging v1.0.5+20170516 +site_name: Logging v1.0.6+20170516 site_url: http://byron.github.io/google-apis-rs/google-logging2_beta1-cli site_description: A complete library to interact with Logging (protocol v2beta1) diff --git a/gen/logging2_beta1-cli/src/cmn.rs b/gen/logging2_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/logging2_beta1-cli/src/cmn.rs +++ b/gen/logging2_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/logging2_beta1-cli/src/main.rs b/gen/logging2_beta1-cli/src/main.rs index 749ec6abec..4fd661ba66 100644 --- a/gen/logging2_beta1-cli/src/main.rs +++ b/gen/logging2_beta1-cli/src/main.rs @@ -2019,7 +2019,7 @@ fn main() { let mut app = App::new("logging2-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20170516") + .version("1.0.6+20170516") .about("Writes log entries and manages your Stackdriver Logging configuration.") .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") diff --git a/gen/logging2_beta1/Cargo.toml b/gen/logging2_beta1/Cargo.toml index 3d6b41ccb6..861d16fc9c 100644 --- a/gen/logging2_beta1/Cargo.toml +++ b/gen/logging2_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-logging2_beta1" -version = "1.0.5+20170516" +version = "1.0.6+20170516" 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" homepage = "https://cloud.google.com/logging/docs/" -documentation = "https://docs.rs/google-logging2_beta1/1.0.5+20170516" +documentation = "https://docs.rs/google-logging2_beta1/1.0.6+20170516" license = "MIT" keywords = ["logging", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/logging2_beta1/README.md b/gen/logging2_beta1/README.md index 0eb7c8cda4..8541fec72a 100644 --- a/gen/logging2_beta1/README.md +++ b/gen/logging2_beta1/README.md @@ -5,24 +5,24 @@ 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 *1.0.5+20170516*, where *20170516* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Logging* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Logging* *v2_beta1* API can be found at the [official documentation site](https://cloud.google.com/logging/docs/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.Logging.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.Logging.html) ... * billing accounts - * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.BillingAccountLogDeleteCall.html) and [*logs list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.BillingAccountLogListCall.html) + * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.BillingAccountLogDeleteCall.html) and [*logs list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.BillingAccountLogListCall.html) * entries - * [*list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.EntryWriteCall.html) -* [monitored resource descriptors](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.MonitoredResourceDescriptor.html) - * [*list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html) + * [*list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.EntryListCall.html) and [*write*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.EntryWriteCall.html) +* [monitored resource descriptors](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.MonitoredResourceDescriptor.html) + * [*list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.MonitoredResourceDescriptorListCall.html) * organizations - * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.OrganizationLogDeleteCall.html) and [*logs list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.OrganizationLogListCall.html) + * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.OrganizationLogDeleteCall.html) and [*logs list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.OrganizationLogListCall.html) * projects - * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) + * [*logs delete*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectLogDeleteCall.html), [*logs list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectLogListCall.html), [*metrics create*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectMetricCreateCall.html), [*metrics delete*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectMetricDeleteCall.html), [*metrics get*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectMetricGetCall.html), [*metrics list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectMetricListCall.html), [*metrics update*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectMetricUpdateCall.html), [*sinks create*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectSinkCreateCall.html), [*sinks delete*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectSinkDeleteCall.html), [*sinks get*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectSinkGetCall.html), [*sinks list*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectSinkListCall.html) and [*sinks update*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.ProjectSinkUpdateCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/struct.Logging.html)** +* **[Hub](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/struct.Logging.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -128,17 +128,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/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 +148,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/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](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/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](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_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](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/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](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/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](https://docs.rs/google-logging2_beta1/1.0.5+20170516/google_logging2_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-logging2_beta1/1.0.6+20170516/google_logging2_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/logging2_beta1/src/lib.rs b/gen/logging2_beta1/src/lib.rs index 670e449b58..a1b4cda892 100644 --- a/gen/logging2_beta1/src/lib.rs +++ b/gen/logging2_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 *Logging* crate version *1.0.5+20170516*, where *20170516* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Logging* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *logging:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Logging* *v2_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/logging/docs/). @@ -339,7 +339,7 @@ impl<'a, C, A> Logging Logging { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://logging.googleapis.com/".to_string(), _root_url: "https://logging.googleapis.com/".to_string(), } @@ -362,7 +362,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/manager1_beta2-cli/Cargo.toml b/gen/manager1_beta2-cli/Cargo.toml index f4884b7d3a..8a035ad6e2 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 = "1.0.5+20140915" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-manager1_beta2] path = "../manager1_beta2" -version = "1.0.5+20140915" +version = "1.0.6+20140915" diff --git a/gen/manager1_beta2-cli/README.md b/gen/manager1_beta2-cli/README.md index 6ae1f966b6..82bccfd9b8 100644 --- a/gen/manager1_beta2-cli/README.md +++ b/gen/manager1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *manager* API at revision *20140915*. The CLI is at version *1.0.5*. +This documentation was generated from the *manager* API at revision *20140915*. The CLI is at version *1.0.6*. ```bash manager1-beta2 [options] diff --git a/gen/manager1_beta2-cli/mkdocs.yml b/gen/manager1_beta2-cli/mkdocs.yml index 8e61a56a79..41b888f33a 100644 --- a/gen/manager1_beta2-cli/mkdocs.yml +++ b/gen/manager1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: manager v1.0.5+20140915 +site_name: manager v1.0.6+20140915 site_url: http://byron.github.io/google-apis-rs/google-manager1_beta2-cli site_description: A complete library to interact with manager (protocol v1beta2) diff --git a/gen/manager1_beta2-cli/src/cmn.rs b/gen/manager1_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/manager1_beta2-cli/src/cmn.rs +++ b/gen/manager1_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/manager1_beta2-cli/src/main.rs b/gen/manager1_beta2-cli/src/main.rs index 02384f4e2f..55adb1a52d 100644 --- a/gen/manager1_beta2-cli/src/main.rs +++ b/gen/manager1_beta2-cli/src/main.rs @@ -893,7 +893,7 @@ fn main() { let mut app = App::new("manager1-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20140915") + .version("1.0.6+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") diff --git a/gen/manager1_beta2/Cargo.toml b/gen/manager1_beta2/Cargo.toml index 5077063020..6623906e34 100644 --- a/gen/manager1_beta2/Cargo.toml +++ b/gen/manager1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-manager1_beta2" -version = "1.0.5+20140915" +version = "1.0.6+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" homepage = "https://developers.google.com/deployment-manager/" -documentation = "https://docs.rs/google-manager1_beta2/1.0.5+20140915" +documentation = "https://docs.rs/google-manager1_beta2/1.0.6+20140915" license = "MIT" keywords = ["manager", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/manager1_beta2/README.md b/gen/manager1_beta2/README.md index 63c9cd1a98..77d8941399 100644 --- a/gen/manager1_beta2/README.md +++ b/gen/manager1_beta2/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *manager* crate version *1.0.6+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *manager* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/deployment-manager/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.Manager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.Manager.html) ... -* [deployments](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.Deployment.html) - * [*delete*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.DeploymentGetCall.html), [*insert*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.DeploymentInsertCall.html) and [*list*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.DeploymentListCall.html) -* [templates](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.Template.html) - * [*delete*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.TemplateDeleteCall.html), [*get*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.TemplateGetCall.html), [*insert*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.TemplateInsertCall.html) and [*list*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.TemplateListCall.html) +* [deployments](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.Deployment.html) + * [*delete*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.DeploymentDeleteCall.html), [*get*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.DeploymentGetCall.html), [*insert*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.DeploymentInsertCall.html) and [*list*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.DeploymentListCall.html) +* [templates](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.Template.html) + * [*delete*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.TemplateDeleteCall.html), [*get*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.TemplateGetCall.html), [*insert*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.TemplateInsertCall.html) and [*list*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.TemplateListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/struct.Manager.html)** +* **[Hub](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/struct.Manager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -123,17 +123,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_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")`. @@ -143,29 +143,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_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](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_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](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/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](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_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](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_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](https://docs.rs/google-manager1_beta2/1.0.5+20140915/google_manager1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-manager1_beta2/1.0.6+20140915/google_manager1_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. diff --git a/gen/manager1_beta2/src/lib.rs b/gen/manager1_beta2/src/lib.rs index dcf000b0c0..245f3fb972 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 *1.0.5+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *manager* crate version *1.0.6+20140915*, where *20140915* is the exact revision of the *manager:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *manager* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/deployment-manager/). @@ -344,7 +344,7 @@ impl<'a, C, A> Manager Manager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/manager/v1beta2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -358,7 +358,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/manufacturers1-cli/Cargo.toml b/gen/manufacturers1-cli/Cargo.toml index 10b81909ed..d8938428c3 100644 --- a/gen/manufacturers1-cli/Cargo.toml +++ b/gen/manufacturers1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-manufacturers1-cli" -version = "1.0.5+20170412" +version = "1.0.6+20170412" authors = ["Sebastian Thiel "] description = "A complete library to interact with Manufacturer Center (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-manufacturers1] path = "../manufacturers1" -version = "1.0.5+20170412" +version = "1.0.6+20170412" diff --git a/gen/manufacturers1-cli/README.md b/gen/manufacturers1-cli/README.md index 7c811214a1..1ad9efda6c 100644 --- a/gen/manufacturers1-cli/README.md +++ b/gen/manufacturers1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Manufacturer Center* API at revision *20170412*. The CLI is at version *1.0.5*. +This documentation was generated from the *Manufacturer Center* API at revision *20170412*. The CLI is at version *1.0.6*. ```bash manufacturers1 [options] diff --git a/gen/manufacturers1-cli/mkdocs.yml b/gen/manufacturers1-cli/mkdocs.yml index b453886a60..7a1ea582c3 100644 --- a/gen/manufacturers1-cli/mkdocs.yml +++ b/gen/manufacturers1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Manufacturer Center v1.0.5+20170412 +site_name: Manufacturer Center v1.0.6+20170412 site_url: http://byron.github.io/google-apis-rs/google-manufacturers1-cli site_description: A complete library to interact with Manufacturer Center (protocol v1) diff --git a/gen/manufacturers1-cli/src/cmn.rs b/gen/manufacturers1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/manufacturers1-cli/src/cmn.rs +++ b/gen/manufacturers1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/manufacturers1-cli/src/main.rs b/gen/manufacturers1-cli/src/main.rs index f8d8ddd95c..21f39429c0 100644 --- a/gen/manufacturers1-cli/src/main.rs +++ b/gen/manufacturers1-cli/src/main.rs @@ -333,7 +333,7 @@ fn main() { let mut app = App::new("manufacturers1") .author("Sebastian Thiel ") - .version("1.0.5+20170412") + .version("1.0.6+20170412") .about("Public API for managing Manufacturer Center related data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_manufacturers1_cli") .arg(Arg::with_name("url") diff --git a/gen/manufacturers1/Cargo.toml b/gen/manufacturers1/Cargo.toml index b1c1d5e58c..7415f7cb4a 100644 --- a/gen/manufacturers1/Cargo.toml +++ b/gen/manufacturers1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-manufacturers1" -version = "1.0.5+20170412" +version = "1.0.6+20170412" authors = ["Sebastian Thiel "] description = "A complete library to interact with Manufacturer Center (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/manufacturers1" homepage = "https://developers.google.com/manufacturers/" -documentation = "https://docs.rs/google-manufacturers1/1.0.5+20170412" +documentation = "https://docs.rs/google-manufacturers1/1.0.6+20170412" license = "MIT" keywords = ["manufacturers", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/manufacturers1/README.md b/gen/manufacturers1/README.md index 0769ec82c5..a2cd57beb3 100644 --- a/gen/manufacturers1/README.md +++ b/gen/manufacturers1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-manufacturers1` library allows access to all features of the *Google Manufacturer Center* service. -This documentation was generated from *Manufacturer Center* crate version *1.0.5+20170412*, where *20170412* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Manufacturer Center* crate version *1.0.6+20170412*, where *20170412* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Manufacturer Center* *v1* API can be found at the [official documentation site](https://developers.google.com/manufacturers/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/struct.ManufacturerCenter.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/struct.ManufacturerCenter.html) ... * accounts - * [*products get*](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/struct.AccountProductGetCall.html) and [*products list*](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/struct.AccountProductListCall.html) + * [*products get*](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/struct.AccountProductGetCall.html) and [*products list*](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/struct.AccountProductListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/struct.ManufacturerCenter.html)** +* **[Hub](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/struct.ManufacturerCenter.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.Part.html)** + * **[Parts](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -116,17 +116,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/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")`. @@ -136,29 +136,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/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](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/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](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/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](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/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](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/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](https://docs.rs/google-manufacturers1/1.0.5+20170412/google_manufacturers1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-manufacturers1/1.0.6+20170412/google_manufacturers1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/manufacturers1/src/lib.rs b/gen/manufacturers1/src/lib.rs index 93d3c1c2dc..2056ff8ad0 100644 --- a/gen/manufacturers1/src/lib.rs +++ b/gen/manufacturers1/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 *Manufacturer Center* crate version *1.0.5+20170412*, where *20170412* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Manufacturer Center* crate version *1.0.6+20170412*, where *20170412* is the exact revision of the *manufacturers:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Manufacturer Center* *v1* API can be found at the //! [official documentation site](https://developers.google.com/manufacturers/). @@ -311,7 +311,7 @@ impl<'a, C, A> ManufacturerCenter ManufacturerCenter { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://manufacturers.googleapis.com/".to_string(), _root_url: "https://manufacturers.googleapis.com/".to_string(), } @@ -322,7 +322,7 @@ impl<'a, C, A> ManufacturerCenter } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/mirror1-cli/Cargo.toml b/gen/mirror1-cli/Cargo.toml index d2612ad751..513ea28719 100644 --- a/gen/mirror1-cli/Cargo.toml +++ b/gen/mirror1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-mirror1-cli" -version = "1.0.5+20170419" +version = "1.0.6+20170419" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-mirror1] path = "../mirror1" -version = "1.0.5+20170419" +version = "1.0.6+20170419" diff --git a/gen/mirror1-cli/README.md b/gen/mirror1-cli/README.md index a3c4982603..d2e9aa33e0 100644 --- a/gen/mirror1-cli/README.md +++ b/gen/mirror1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *mirror* API at revision *20170419*. The CLI is at version *1.0.5*. +This documentation was generated from the *mirror* API at revision *20170419*. The CLI is at version *1.0.6*. ```bash mirror1 [options] diff --git a/gen/mirror1-cli/mkdocs.yml b/gen/mirror1-cli/mkdocs.yml index 53bb358981..5249579ae3 100644 --- a/gen/mirror1-cli/mkdocs.yml +++ b/gen/mirror1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: mirror v1.0.5+20170419 +site_name: mirror v1.0.6+20170419 site_url: http://byron.github.io/google-apis-rs/google-mirror1-cli site_description: A complete library to interact with mirror (protocol v1) diff --git a/gen/mirror1-cli/src/cmn.rs b/gen/mirror1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/mirror1-cli/src/cmn.rs +++ b/gen/mirror1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/mirror1-cli/src/main.rs b/gen/mirror1-cli/src/main.rs index d594202db1..b6f8823110 100644 --- a/gen/mirror1-cli/src/main.rs +++ b/gen/mirror1-cli/src/main.rs @@ -2564,7 +2564,7 @@ fn main() { let mut app = App::new("mirror1") .author("Sebastian Thiel ") - .version("1.0.5+20170419") + .version("1.0.6+20170419") .about("Interacts 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") diff --git a/gen/mirror1/Cargo.toml b/gen/mirror1/Cargo.toml index 1c7e25be37..81c594bb9a 100644 --- a/gen/mirror1/Cargo.toml +++ b/gen/mirror1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-mirror1" -version = "1.0.5+20170419" +version = "1.0.6+20170419" 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" homepage = "https://developers.google.com/glass" -documentation = "https://docs.rs/google-mirror1/1.0.5+20170419" +documentation = "https://docs.rs/google-mirror1/1.0.6+20170419" license = "MIT" keywords = ["mirror", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/mirror1/README.md b/gen/mirror1/README.md index 8092c4ab7e..0edd7cab87 100644 --- a/gen/mirror1/README.md +++ b/gen/mirror1/README.md @@ -5,37 +5,37 @@ 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 *1.0.5+20170419*, where *20170419* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *mirror* crate version *1.0.6+20170419*, where *20170419* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *mirror* *v1* API can be found at the [official documentation site](https://developers.google.com/glass). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Mirror.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Mirror.html) ... -* [accounts](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Account.html) - * [*insert*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.AccountInsertCall.html) -* [contacts](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Contact.html) - * [*delete*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.ContactDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.ContactGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.ContactInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.ContactListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.ContactPatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.ContactUpdateCall.html) -* [locations](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Location.html) - * [*get*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.LocationGetCall.html) and [*list*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.LocationListCall.html) -* [settings](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Setting.html) - * [*get*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.SettingGetCall.html) -* [subscriptions](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Subscription.html) - * [*delete*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.SubscriptionInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.SubscriptionListCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.SubscriptionUpdateCall.html) +* [accounts](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Account.html) + * [*insert*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.AccountInsertCall.html) +* [contacts](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Contact.html) + * [*delete*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.ContactDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.ContactGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.ContactInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.ContactListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.ContactPatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.ContactUpdateCall.html) +* [locations](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Location.html) + * [*get*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.LocationGetCall.html) and [*list*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.LocationListCall.html) +* [settings](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Setting.html) + * [*get*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.SettingGetCall.html) +* [subscriptions](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Subscription.html) + * [*delete*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.SubscriptionInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.SubscriptionListCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.SubscriptionUpdateCall.html) * timeline - * [*attachments delete*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineAttachmentDeleteCall.html), [*attachments get*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineAttachmentGetCall.html), [*attachments insert*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineAttachmentInsertCall.html), [*attachments list*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineAttachmentListCall.html), [*delete*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelinePatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineUpdateCall.html) + * [*attachments delete*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineAttachmentDeleteCall.html), [*attachments get*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineAttachmentGetCall.html), [*attachments insert*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineAttachmentInsertCall.html), [*attachments list*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineAttachmentListCall.html), [*delete*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineDeleteCall.html), [*get*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineGetCall.html), [*insert*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineInsertCall.html), [*list*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineListCall.html), [*patch*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelinePatchCall.html) and [*update*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineUpdateCall.html) Upload supported by ... -* [*update timeline*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineUpdateCall.html) -* [*insert timeline*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineInsertCall.html) -* [*attachments insert timeline*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineAttachmentInsertCall.html) +* [*update timeline*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineUpdateCall.html) +* [*insert timeline*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineInsertCall.html) +* [*attachments insert timeline*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineAttachmentInsertCall.html) Download supported by ... -* [*attachments get timeline*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.TimelineAttachmentGetCall.html) +* [*attachments get timeline*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.TimelineAttachmentGetCall.html) @@ -43,17 +43,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/struct.Mirror.html)** +* **[Hub](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/struct.Mirror.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.Part.html)** + * **[Parts](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -147,17 +147,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/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")`. @@ -167,29 +167,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/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](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/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](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/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](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/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](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/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](https://docs.rs/google-mirror1/1.0.5+20170419/google_mirror1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-mirror1/1.0.6+20170419/google_mirror1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/mirror1/src/lib.rs b/gen/mirror1/src/lib.rs index 3c3a955001..924b2992a2 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 *1.0.5+20170419*, where *20170419* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *mirror* crate version *1.0.6+20170419*, where *20170419* is the exact revision of the *mirror:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *mirror* *v1* API can be found at the //! [official documentation site](https://developers.google.com/glass). @@ -352,7 +352,7 @@ impl<'a, C, A> Mirror Mirror { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/mirror/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -378,7 +378,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/ml1_beta1-cli/Cargo.toml b/gen/ml1_beta1-cli/Cargo.toml index 2d11223517..aca7874261 100644 --- a/gen/ml1_beta1-cli/Cargo.toml +++ b/gen/ml1_beta1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-ml1_beta1-cli" -version = "1.0.5+20170515" +version = "1.0.6+20170515" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Machine Learning Engine (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-ml1_beta1] path = "../ml1_beta1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" diff --git a/gen/ml1_beta1-cli/README.md b/gen/ml1_beta1-cli/README.md index a2ce977d65..bdf92f13f6 100644 --- a/gen/ml1_beta1-cli/README.md +++ b/gen/ml1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Cloud Machine Learning Engine* API at revision *20170515*. The CLI is at version *1.0.5*. +This documentation was generated from the *Cloud Machine Learning Engine* API at revision *20170515*. The CLI is at version *1.0.6*. ```bash ml1-beta1 [options] diff --git a/gen/ml1_beta1-cli/mkdocs.yml b/gen/ml1_beta1-cli/mkdocs.yml index 1a4713edc0..4d8e6aefd9 100644 --- a/gen/ml1_beta1-cli/mkdocs.yml +++ b/gen/ml1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Cloud Machine Learning Engine v1.0.5+20170515 +site_name: Cloud Machine Learning Engine v1.0.6+20170515 site_url: http://byron.github.io/google-apis-rs/google-ml1_beta1-cli site_description: A complete library to interact with Cloud Machine Learning Engine (protocol v1beta1) diff --git a/gen/ml1_beta1-cli/src/cmn.rs b/gen/ml1_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/ml1_beta1-cli/src/cmn.rs +++ b/gen/ml1_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/ml1_beta1-cli/src/main.rs b/gen/ml1_beta1-cli/src/main.rs index 93240fd4c5..1b46fcc10a 100644 --- a/gen/ml1_beta1-cli/src/main.rs +++ b/gen/ml1_beta1-cli/src/main.rs @@ -2036,7 +2036,7 @@ fn main() { let mut app = App::new("ml1-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20170515") + .version("1.0.6+20170515") .about("An API to enable creating and using machine learning models.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_ml1_beta1_cli") .arg(Arg::with_name("url") diff --git a/gen/ml1_beta1/Cargo.toml b/gen/ml1_beta1/Cargo.toml index 34f5834eb1..2e900aed7c 100644 --- a/gen/ml1_beta1/Cargo.toml +++ b/gen/ml1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-ml1_beta1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" authors = ["Sebastian Thiel "] description = "A complete library to interact with Cloud Machine Learning Engine (protocol v1beta1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/ml1_beta1" homepage = "https://cloud.google.com/ml/" -documentation = "https://docs.rs/google-ml1_beta1/1.0.5+20170515" +documentation = "https://docs.rs/google-ml1_beta1/1.0.6+20170515" license = "MIT" keywords = ["ml", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/ml1_beta1/README.md b/gen/ml1_beta1/README.md index 8b85d638cf..9bbeb3bc06 100644 --- a/gen/ml1_beta1/README.md +++ b/gen/ml1_beta1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-ml1_beta1` library allows access to all features of the *Google Cloud Machine Learning Engine* service. -This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *ml:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *ml:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Cloud Machine Learning Engine* *v1_beta1* API can be found at the [official documentation site](https://cloud.google.com/ml/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.CloudMachineLearningEngine.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.CloudMachineLearningEngine.html) ... * projects - * [*get config*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectGetConfigCall.html), [*jobs cancel*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectJobCancelCall.html), [*jobs create*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectJobCreateCall.html), [*jobs get*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectJobGetCall.html), [*jobs list*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectJobListCall.html), [*models create*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelCreateCall.html), [*models delete*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelDeleteCall.html), [*models get*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelGetCall.html), [*models list*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelListCall.html), [*models versions create*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelVersionCreateCall.html), [*models versions delete*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelVersionDeleteCall.html), [*models versions get*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelVersionGetCall.html), [*models versions list*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelVersionListCall.html), [*models versions set default*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectOperationCancelCall.html), [*operations delete*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectOperationDeleteCall.html), [*operations get*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectOperationGetCall.html), [*operations list*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectOperationListCall.html) and [*predict*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.ProjectPredictCall.html) + * [*get config*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectGetConfigCall.html), [*jobs cancel*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectJobCancelCall.html), [*jobs create*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectJobCreateCall.html), [*jobs get*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectJobGetCall.html), [*jobs list*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectJobListCall.html), [*models create*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelCreateCall.html), [*models delete*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelDeleteCall.html), [*models get*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelGetCall.html), [*models list*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelListCall.html), [*models versions create*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelVersionCreateCall.html), [*models versions delete*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelVersionDeleteCall.html), [*models versions get*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelVersionGetCall.html), [*models versions list*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelVersionListCall.html), [*models versions set default*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectModelVersionSetDefaultCall.html), [*operations cancel*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectOperationCancelCall.html), [*operations delete*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectOperationDeleteCall.html), [*operations get*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectOperationGetCall.html), [*operations list*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectOperationListCall.html) and [*predict*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.ProjectPredictCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/struct.CloudMachineLearningEngine.html)** +* **[Hub](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/struct.CloudMachineLearningEngine.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -125,17 +125,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/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")`. @@ -145,29 +145,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/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](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/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](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_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](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/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](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/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](https://docs.rs/google-ml1_beta1/1.0.5+20170515/google_ml1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-ml1_beta1/1.0.6+20170515/google_ml1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/ml1_beta1/src/lib.rs b/gen/ml1_beta1/src/lib.rs index 1d95d7a92d..348db83863 100644 --- a/gen/ml1_beta1/src/lib.rs +++ b/gen/ml1_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 *Cloud Machine Learning Engine* crate version *1.0.5+20170515*, where *20170515* is the exact revision of the *ml:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Cloud Machine Learning Engine* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *ml:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Cloud Machine Learning Engine* *v1_beta1* API can be found at the //! [official documentation site](https://cloud.google.com/ml/). @@ -326,7 +326,7 @@ impl<'a, C, A> CloudMachineLearningEngine CloudMachineLearningEngine { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://ml.googleapis.com/".to_string(), _root_url: "https://ml.googleapis.com/".to_string(), } @@ -337,7 +337,7 @@ impl<'a, C, A> CloudMachineLearningEngine } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/monitoring3-cli/Cargo.toml b/gen/monitoring3-cli/Cargo.toml index 4b5c3a9cec..0fce7a3dcb 100644 --- a/gen/monitoring3-cli/Cargo.toml +++ b/gen/monitoring3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-monitoring3-cli" -version = "1.0.5+20170519" +version = "1.0.6+20170519" authors = ["Sebastian Thiel "] description = "A complete library to interact with Monitoring (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-monitoring3] path = "../monitoring3" -version = "1.0.5+20170519" +version = "1.0.6+20170519" diff --git a/gen/monitoring3-cli/README.md b/gen/monitoring3-cli/README.md index 170c1c60ec..545efe8eb8 100644 --- a/gen/monitoring3-cli/README.md +++ b/gen/monitoring3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Monitoring* API at revision *20170519*. The CLI is at version *1.0.5*. +This documentation was generated from the *Monitoring* API at revision *20170519*. The CLI is at version *1.0.6*. ```bash monitoring3 [options] diff --git a/gen/monitoring3-cli/mkdocs.yml b/gen/monitoring3-cli/mkdocs.yml index 67aa85b24d..f87d446abc 100644 --- a/gen/monitoring3-cli/mkdocs.yml +++ b/gen/monitoring3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Monitoring v1.0.5+20170519 +site_name: Monitoring v1.0.6+20170519 site_url: http://byron.github.io/google-apis-rs/google-monitoring3-cli site_description: A complete library to interact with Monitoring (protocol v3) diff --git a/gen/monitoring3-cli/src/cmn.rs b/gen/monitoring3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/monitoring3-cli/src/cmn.rs +++ b/gen/monitoring3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/monitoring3-cli/src/main.rs b/gen/monitoring3-cli/src/main.rs index 66d10420d6..dc43a0e993 100644 --- a/gen/monitoring3-cli/src/main.rs +++ b/gen/monitoring3-cli/src/main.rs @@ -1611,7 +1611,7 @@ fn main() { let mut app = App::new("monitoring3") .author("Sebastian Thiel ") - .version("1.0.5+20170519") + .version("1.0.6+20170519") .about("Manages your Stackdriver Monitoring data and configurations. Most projects must be associated with a Stackdriver account, with a few exceptions as noted on the individual method pages.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_monitoring3_cli") .arg(Arg::with_name("url") diff --git a/gen/monitoring3/Cargo.toml b/gen/monitoring3/Cargo.toml index 363b0643d2..e030be2c8f 100644 --- a/gen/monitoring3/Cargo.toml +++ b/gen/monitoring3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-monitoring3" -version = "1.0.5+20170519" +version = "1.0.6+20170519" authors = ["Sebastian Thiel "] description = "A complete library to interact with Monitoring (protocol v3)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/monitoring3" homepage = "https://cloud.google.com/monitoring/api/" -documentation = "https://docs.rs/google-monitoring3/1.0.5+20170519" +documentation = "https://docs.rs/google-monitoring3/1.0.6+20170519" license = "MIT" keywords = ["monitoring", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/monitoring3/README.md b/gen/monitoring3/README.md index 615a846b6b..021c9608b9 100644 --- a/gen/monitoring3/README.md +++ b/gen/monitoring3/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-monitoring3` library allows access to all features of the *Google Monitoring* service. -This documentation was generated from *Monitoring* crate version *1.0.5+20170519*, where *20170519* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Monitoring* crate version *1.0.6+20170519*, where *20170519* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Monitoring* *v3* API can be found at the [official documentation site](https://cloud.google.com/monitoring/api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.Monitoring.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.Monitoring.html) ... * projects - * [*collectd time series create*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectCollectdTimeSeryCreateCall.html), [*groups create*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectGroupCreateCall.html), [*groups delete*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectGroupDeleteCall.html), [*groups get*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectGroupGetCall.html), [*groups list*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectGroupListCall.html), [*groups members list*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectGroupMemberListCall.html), [*groups update*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectGroupUpdateCall.html), [*metric descriptors create*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectMetricDescriptorCreateCall.html), [*metric descriptors delete*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectMetricDescriptorDeleteCall.html), [*metric descriptors get*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectMetricDescriptorGetCall.html), [*metric descriptors list*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectMetricDescriptorListCall.html), [*monitored resource descriptors get*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectMonitoredResourceDescriptorGetCall.html), [*monitored resource descriptors list*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectMonitoredResourceDescriptorListCall.html), [*time series create*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectTimeSeryCreateCall.html) and [*time series list*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.ProjectTimeSeryListCall.html) + * [*collectd time series create*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectCollectdTimeSeryCreateCall.html), [*groups create*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectGroupCreateCall.html), [*groups delete*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectGroupDeleteCall.html), [*groups get*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectGroupGetCall.html), [*groups list*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectGroupListCall.html), [*groups members list*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectGroupMemberListCall.html), [*groups update*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectGroupUpdateCall.html), [*metric descriptors create*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectMetricDescriptorCreateCall.html), [*metric descriptors delete*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectMetricDescriptorDeleteCall.html), [*metric descriptors get*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectMetricDescriptorGetCall.html), [*metric descriptors list*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectMetricDescriptorListCall.html), [*monitored resource descriptors get*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectMonitoredResourceDescriptorGetCall.html), [*monitored resource descriptors list*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectMonitoredResourceDescriptorListCall.html), [*time series create*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectTimeSeryCreateCall.html) and [*time series list*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.ProjectTimeSeryListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/struct.Monitoring.html)** +* **[Hub](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/struct.Monitoring.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.Part.html)** + * **[Parts](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -125,17 +125,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/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")`. @@ -145,29 +145,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/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](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/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](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/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](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/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](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/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](https://docs.rs/google-monitoring3/1.0.5+20170519/google_monitoring3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-monitoring3/1.0.6+20170519/google_monitoring3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/monitoring3/src/lib.rs b/gen/monitoring3/src/lib.rs index 2dfa36b5ca..ff6183a34c 100644 --- a/gen/monitoring3/src/lib.rs +++ b/gen/monitoring3/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 *Monitoring* crate version *1.0.5+20170519*, where *20170519* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Monitoring* crate version *1.0.6+20170519*, where *20170519* is the exact revision of the *monitoring:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Monitoring* *v3* API can be found at the //! [official documentation site](https://cloud.google.com/monitoring/api/). @@ -338,7 +338,7 @@ impl<'a, C, A> Monitoring Monitoring { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://monitoring.googleapis.com/".to_string(), _root_url: "https://monitoring.googleapis.com/".to_string(), } @@ -349,7 +349,7 @@ impl<'a, C, A> Monitoring } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/pagespeedonline2-cli/Cargo.toml b/gen/pagespeedonline2-cli/Cargo.toml index 9f7c49a1f8..6b09fda019 100644 --- a/gen/pagespeedonline2-cli/Cargo.toml +++ b/gen/pagespeedonline2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pagespeedonline2-cli" -version = "1.0.5+20161204" +version = "1.0.6+20161204" 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-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-pagespeedonline2] path = "../pagespeedonline2" -version = "1.0.5+20161204" +version = "1.0.6+20161204" diff --git a/gen/pagespeedonline2-cli/README.md b/gen/pagespeedonline2-cli/README.md index 01edce28c4..612148f688 100644 --- a/gen/pagespeedonline2-cli/README.md +++ b/gen/pagespeedonline2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *pagespeedonline* API at revision *20161204*. The CLI is at version *1.0.5*. +This documentation was generated from the *pagespeedonline* API at revision *20161204*. The CLI is at version *1.0.6*. ```bash pagespeedonline2 [options] diff --git a/gen/pagespeedonline2-cli/mkdocs.yml b/gen/pagespeedonline2-cli/mkdocs.yml index 562c66d368..0929626f53 100644 --- a/gen/pagespeedonline2-cli/mkdocs.yml +++ b/gen/pagespeedonline2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: pagespeedonline v1.0.5+20161204 +site_name: pagespeedonline v1.0.6+20161204 site_url: http://byron.github.io/google-apis-rs/google-pagespeedonline2-cli site_description: A complete library to interact with pagespeedonline (protocol v2) diff --git a/gen/pagespeedonline2-cli/src/cmn.rs b/gen/pagespeedonline2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/pagespeedonline2-cli/src/cmn.rs +++ b/gen/pagespeedonline2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/pagespeedonline2-cli/src/main.rs b/gen/pagespeedonline2-cli/src/main.rs index e1f6f7e6f4..e23ae33fd2 100644 --- a/gen/pagespeedonline2-cli/src/main.rs +++ b/gen/pagespeedonline2-cli/src/main.rs @@ -238,7 +238,7 @@ fn main() { let mut app = App::new("pagespeedonline2") .author("Sebastian Thiel ") - .version("1.0.5+20161204") + .version("1.0.6+20161204") .about("Analyzes the performance of a web page and provides 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") diff --git a/gen/pagespeedonline2/Cargo.toml b/gen/pagespeedonline2/Cargo.toml index 430b505ac4..d44d51a52b 100644 --- a/gen/pagespeedonline2/Cargo.toml +++ b/gen/pagespeedonline2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pagespeedonline2" -version = "1.0.5+20161204" +version = "1.0.6+20161204" 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" homepage = "https://developers.google.com/speed/docs/insights/v2/getting-started" -documentation = "https://docs.rs/google-pagespeedonline2/1.0.5+20161204" +documentation = "https://docs.rs/google-pagespeedonline2/1.0.6+20161204" license = "MIT" keywords = ["pagespeedonline", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/pagespeedonline2/README.md b/gen/pagespeedonline2/README.md index 3ff6f68fa0..0ff1d0f299 100644 --- a/gen/pagespeedonline2/README.md +++ b/gen/pagespeedonline2/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20161204*, where *20161204* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *pagespeedonline* crate version *1.0.6+20161204*, where *20161204* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/struct.Pagespeedonline.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/struct.Pagespeedonline.html) ... * pagespeedapi - * [*runpagespeed*](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/struct.PagespeedapiRunpagespeedCall.html) + * [*runpagespeed*](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/struct.PagespeedapiRunpagespeedCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/struct.Pagespeedonline.html)** +* **[Hub](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/struct.Pagespeedonline.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.Part.html)** + * **[Parts](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -121,17 +121,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/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")`. @@ -141,29 +141,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/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](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/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](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/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](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/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](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/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](https://docs.rs/google-pagespeedonline2/1.0.5+20161204/google_pagespeedonline2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pagespeedonline2/1.0.6+20161204/google_pagespeedonline2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/pagespeedonline2/src/lib.rs b/gen/pagespeedonline2/src/lib.rs index 495d9170c7..1322af009e 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 *1.0.5+20161204*, where *20161204* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *pagespeedonline* crate version *1.0.6+20161204*, where *20161204* is the exact revision of the *pagespeedonline:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -299,7 +299,7 @@ impl<'a, C, A> Pagespeedonline Pagespeedonline { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/pagespeedonline/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -310,7 +310,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/partners2-cli/Cargo.toml b/gen/partners2-cli/Cargo.toml index 0229964250..4e6a1353b2 100644 --- a/gen/partners2-cli/Cargo.toml +++ b/gen/partners2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-partners2-cli" -version = "1.0.5+20170503" +version = "1.0.6+20170503" 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-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-partners2] path = "../partners2" -version = "1.0.5+20170503" +version = "1.0.6+20170503" diff --git a/gen/partners2-cli/README.md b/gen/partners2-cli/README.md index 3ab09e9927..d0f3023b35 100644 --- a/gen/partners2-cli/README.md +++ b/gen/partners2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Partners* API at revision *20170503*. The CLI is at version *1.0.5*. +This documentation was generated from the *Partners* API at revision *20170503*. The CLI is at version *1.0.6*. ```bash partners2 [options] diff --git a/gen/partners2-cli/mkdocs.yml b/gen/partners2-cli/mkdocs.yml index 3e41290dab..68d3dcb992 100644 --- a/gen/partners2-cli/mkdocs.yml +++ b/gen/partners2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Partners v1.0.5+20170503 +site_name: Partners v1.0.6+20170503 site_url: http://byron.github.io/google-apis-rs/google-partners2-cli site_description: A complete library to interact with Partners (protocol v2) diff --git a/gen/partners2-cli/src/cmn.rs b/gen/partners2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/partners2-cli/src/cmn.rs +++ b/gen/partners2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/partners2-cli/src/main.rs b/gen/partners2-cli/src/main.rs index dd1e96f374..cc7a1edd62 100644 --- a/gen/partners2-cli/src/main.rs +++ b/gen/partners2-cli/src/main.rs @@ -2376,7 +2376,7 @@ fn main() { let mut app = App::new("partners2") .author("Sebastian Thiel ") - .version("1.0.5+20170503") + .version("1.0.6+20170503") .about("Searches certified companies and creates 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") diff --git a/gen/partners2/Cargo.toml b/gen/partners2/Cargo.toml index 1d7186da2b..586118fd47 100644 --- a/gen/partners2/Cargo.toml +++ b/gen/partners2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-partners2" -version = "1.0.5+20170503" +version = "1.0.6+20170503" 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" homepage = "https://developers.google.com/partners/" -documentation = "https://docs.rs/google-partners2/1.0.5+20170503" +documentation = "https://docs.rs/google-partners2/1.0.6+20170503" license = "MIT" keywords = ["partners", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/partners2/README.md b/gen/partners2/README.md index e221dd6e7c..cecd5eaf94 100644 --- a/gen/partners2/README.md +++ b/gen/partners2/README.md @@ -5,38 +5,38 @@ 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 *1.0.5+20170503*, where *20170503* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Partners* crate version *1.0.6+20170503*, where *20170503* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Partners* *v2* API can be found at the [official documentation site](https://developers.google.com/partners/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.Partners.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.Partners.html) ... * analytics - * [*list*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.AnalyticListCall.html) + * [*list*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.AnalyticListCall.html) * client messages - * [*log*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.ClientMessageLogCall.html) -* [companies](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.Company.html) - * [*get*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.CompanyGetCall.html), [*leads create*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.CompanyLeadCreateCall.html) and [*list*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.CompanyListCall.html) + * [*log*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.ClientMessageLogCall.html) +* [companies](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.Company.html) + * [*get*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.CompanyGetCall.html), [*leads create*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.CompanyLeadCreateCall.html) and [*list*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.CompanyListCall.html) * exams - * [*get token*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.ExamGetTokenCall.html) -* [leads](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.Lead.html) - * [*list*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.LeadListCall.html) + * [*get token*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.ExamGetTokenCall.html) +* [leads](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.Lead.html) + * [*list*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.LeadListCall.html) * offers - * [*history list*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.OfferHistoryListCall.html) and [*list*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.OfferListCall.html) + * [*history list*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.OfferHistoryListCall.html) and [*list*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.OfferListCall.html) * user events - * [*log*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.UserEventLogCall.html) + * [*log*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.UserEventLogCall.html) * user states - * [*list*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.UserStateListCall.html) -* [users](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.User.html) - * [*create company relation*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.UserCreateCompanyRelationCall.html), [*delete company relation*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.UserDeleteCompanyRelationCall.html), [*get*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.UserGetCall.html) and [*update profile*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.UserUpdateProfileCall.html) + * [*list*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.UserStateListCall.html) +* [users](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.User.html) + * [*create company relation*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.UserCreateCompanyRelationCall.html), [*delete company relation*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.UserDeleteCompanyRelationCall.html), [*get*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.UserGetCall.html) and [*update profile*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.UserUpdateProfileCall.html) Other activities are ... -* [get partnersstatus](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.MethodGetPartnersstatuCall.html) -* [update companies](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.MethodUpdateCompanyCall.html) -* [update leads](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.MethodUpdateLeadCall.html) +* [get partnersstatus](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.MethodGetPartnersstatuCall.html) +* [update companies](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.MethodUpdateCompanyCall.html) +* [update leads](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.MethodUpdateLeadCall.html) @@ -44,17 +44,17 @@ Other activities are ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/struct.Partners.html)** +* **[Hub](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/struct.Partners.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.Part.html)** + * **[Parts](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -153,17 +153,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/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")`. @@ -173,29 +173,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/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](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/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](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/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](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/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](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/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](https://docs.rs/google-partners2/1.0.5+20170503/google_partners2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-partners2/1.0.6+20170503/google_partners2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/partners2/src/lib.rs b/gen/partners2/src/lib.rs index 50c2d9a8bd..ee720e458e 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 *1.0.5+20170503*, where *20170503* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Partners* crate version *1.0.6+20170503*, where *20170503* is the exact revision of the *partners:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Partners* *v2* API can be found at the //! [official documentation site](https://developers.google.com/partners/). @@ -339,7 +339,7 @@ impl<'a, C, A> Partners Partners { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://partners.googleapis.com/".to_string(), _root_url: "https://partners.googleapis.com/".to_string(), } @@ -377,7 +377,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/people1-cli/Cargo.toml b/gen/people1-cli/Cargo.toml index 7a11b0636b..11edc54dfd 100644 --- a/gen/people1-cli/Cargo.toml +++ b/gen/people1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-people1-cli" -version = "1.0.5+20170518" +version = "1.0.6+20170518" authors = ["Sebastian Thiel "] description = "A complete library to interact with People Service (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/people1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-people1] path = "../people1" -version = "1.0.5+20170518" +version = "1.0.6+20170518" diff --git a/gen/people1-cli/README.md b/gen/people1-cli/README.md index 220e7de707..e166405597 100644 --- a/gen/people1-cli/README.md +++ b/gen/people1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *People Service* API at revision *20170518*. The CLI is at version *1.0.5*. +This documentation was generated from the *People Service* API at revision *20170518*. The CLI is at version *1.0.6*. ```bash people1 [options] diff --git a/gen/people1-cli/mkdocs.yml b/gen/people1-cli/mkdocs.yml index 9a1993e18b..5e2a2c2793 100644 --- a/gen/people1-cli/mkdocs.yml +++ b/gen/people1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: People Service v1.0.5+20170518 +site_name: People Service v1.0.6+20170518 site_url: http://byron.github.io/google-apis-rs/google-people1-cli site_description: A complete library to interact with People Service (protocol v1) diff --git a/gen/people1-cli/src/cmn.rs b/gen/people1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/people1-cli/src/cmn.rs +++ b/gen/people1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/people1-cli/src/main.rs b/gen/people1-cli/src/main.rs index 18f0436316..bad06c7f1d 100644 --- a/gen/people1-cli/src/main.rs +++ b/gen/people1-cli/src/main.rs @@ -416,7 +416,7 @@ fn main() { let mut app = App::new("people1") .author("Sebastian Thiel ") - .version("1.0.5+20170518") + .version("1.0.6+20170518") .about("Provides access to information about profiles and contacts.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_people1_cli") .arg(Arg::with_name("url") diff --git a/gen/people1/Cargo.toml b/gen/people1/Cargo.toml index 8172a9e808..28507f4c36 100644 --- a/gen/people1/Cargo.toml +++ b/gen/people1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-people1" -version = "1.0.5+20170518" +version = "1.0.6+20170518" authors = ["Sebastian Thiel "] description = "A complete library to interact with People Service (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/people1" homepage = "https://developers.google.com/people/" -documentation = "https://docs.rs/google-people1/1.0.5+20170518" +documentation = "https://docs.rs/google-people1/1.0.6+20170518" license = "MIT" keywords = ["people", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/people1/README.md b/gen/people1/README.md index 9ca2930169..70286e75d7 100644 --- a/gen/people1/README.md +++ b/gen/people1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-people1` library allows access to all features of the *Google People Service* service. -This documentation was generated from *People Service* crate version *1.0.5+20170518*, where *20170518* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *People Service* crate version *1.0.6+20170518*, where *20170518* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *People Service* *v1* API can be found at the [official documentation site](https://developers.google.com/people/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-people1/1.0.5+20170518/google_people1/struct.PeopleService.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-people1/1.0.6+20170518/google_people1/struct.PeopleService.html) ... * people - * [*connections list*](https://docs.rs/google-people1/1.0.5+20170518/google_people1/struct.PeopleConnectionListCall.html), [*get*](https://docs.rs/google-people1/1.0.5+20170518/google_people1/struct.PeopleGetCall.html) and [*get batch get*](https://docs.rs/google-people1/1.0.5+20170518/google_people1/struct.PeopleGetBatchGetCall.html) + * [*connections list*](https://docs.rs/google-people1/1.0.6+20170518/google_people1/struct.PeopleConnectionListCall.html), [*get*](https://docs.rs/google-people1/1.0.6+20170518/google_people1/struct.PeopleGetCall.html) and [*get batch get*](https://docs.rs/google-people1/1.0.6+20170518/google_people1/struct.PeopleGetBatchGetCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-people1/1.0.5+20170518/google_people1/struct.PeopleService.html)** +* **[Hub](https://docs.rs/google-people1/1.0.6+20170518/google_people1/struct.PeopleService.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.Part.html)** + * **[Parts](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -117,17 +117,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-people1/1.0.5+20170518/google_people1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-people1/1.0.6+20170518/google_people1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-people1/1.0.5+20170518/google_people1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-people1/1.0.6+20170518/google_people1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-people1/1.0.6+20170518/google_people1/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")`. @@ -137,29 +137,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-people1/1.0.6+20170518/google_people1/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](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-people1/1.0.6+20170518/google_people1/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](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-people1/1.0.5+20170518/google_people1/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](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-people1/1.0.6+20170518/google_people1/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](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-people1/1.0.6+20170518/google_people1/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](https://docs.rs/google-people1/1.0.5+20170518/google_people1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-people1/1.0.6+20170518/google_people1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/people1/src/lib.rs b/gen/people1/src/lib.rs index 84e75eaf9a..928b8e609e 100644 --- a/gen/people1/src/lib.rs +++ b/gen/people1/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 *People Service* crate version *1.0.5+20170518*, where *20170518* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *People Service* crate version *1.0.6+20170518*, where *20170518* is the exact revision of the *people:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *People Service* *v1* API can be found at the //! [official documentation site](https://developers.google.com/people/). @@ -345,7 +345,7 @@ impl<'a, C, A> PeopleService PeopleService { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://people.googleapis.com/".to_string(), _root_url: "https://people.googleapis.com/".to_string(), } @@ -356,7 +356,7 @@ impl<'a, C, A> PeopleService } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/playmoviespartner1-cli/Cargo.toml b/gen/playmoviespartner1-cli/Cargo.toml index 921c415e68..01aba32eb5 100644 --- a/gen/playmoviespartner1-cli/Cargo.toml +++ b/gen/playmoviespartner1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-playmoviespartner1-cli" -version = "1.0.5+20170516" +version = "1.0.6+20170516" authors = ["Sebastian Thiel "] description = "A complete library to interact with Play Movies (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/playmoviespartner1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-playmoviespartner1] path = "../playmoviespartner1" -version = "1.0.5+20170516" +version = "1.0.6+20170516" diff --git a/gen/playmoviespartner1-cli/README.md b/gen/playmoviespartner1-cli/README.md index 3e36b358d9..46e1979093 100644 --- a/gen/playmoviespartner1-cli/README.md +++ b/gen/playmoviespartner1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Play Movies* API at revision *20170516*. The CLI is at version *1.0.5*. +This documentation was generated from the *Play Movies* API at revision *20170516*. The CLI is at version *1.0.6*. ```bash playmoviespartner1 [options] diff --git a/gen/playmoviespartner1-cli/mkdocs.yml b/gen/playmoviespartner1-cli/mkdocs.yml index 16dffe9469..5e9e911151 100644 --- a/gen/playmoviespartner1-cli/mkdocs.yml +++ b/gen/playmoviespartner1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Play Movies v1.0.5+20170516 +site_name: Play Movies v1.0.6+20170516 site_url: http://byron.github.io/google-apis-rs/google-playmoviespartner1-cli site_description: A complete library to interact with Play Movies (protocol v1) diff --git a/gen/playmoviespartner1-cli/src/cmn.rs b/gen/playmoviespartner1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/playmoviespartner1-cli/src/cmn.rs +++ b/gen/playmoviespartner1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/playmoviespartner1-cli/src/main.rs b/gen/playmoviespartner1-cli/src/main.rs index 4b8b83f117..ae9eca8bfe 100644 --- a/gen/playmoviespartner1-cli/src/main.rs +++ b/gen/playmoviespartner1-cli/src/main.rs @@ -737,7 +737,7 @@ fn main() { let mut app = App::new("playmoviespartner1") .author("Sebastian Thiel ") - .version("1.0.5+20170516") + .version("1.0.6+20170516") .about("Gets the delivery status of titles for Google Play Movies Partners.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_playmoviespartner1_cli") .arg(Arg::with_name("url") diff --git a/gen/playmoviespartner1/Cargo.toml b/gen/playmoviespartner1/Cargo.toml index a473403a94..cb74fdca41 100644 --- a/gen/playmoviespartner1/Cargo.toml +++ b/gen/playmoviespartner1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-playmoviespartner1" -version = "1.0.5+20170516" +version = "1.0.6+20170516" authors = ["Sebastian Thiel "] description = "A complete library to interact with Play Movies (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/playmoviespartner1" homepage = "https://developers.google.com/playmoviespartner/" -documentation = "https://docs.rs/google-playmoviespartner1/1.0.5+20170516" +documentation = "https://docs.rs/google-playmoviespartner1/1.0.6+20170516" license = "MIT" keywords = ["playmoviespartner", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/playmoviespartner1/README.md b/gen/playmoviespartner1/README.md index 61c6b4ad93..e8d4cb8fb4 100644 --- a/gen/playmoviespartner1/README.md +++ b/gen/playmoviespartner1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-playmoviespartner1` library allows access to all features of the *Google Play Movies* service. -This documentation was generated from *Play Movies* crate version *1.0.5+20170516*, where *20170516* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Play Movies* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Play Movies* *v1* API can be found at the [official documentation site](https://developers.google.com/playmoviespartner/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.PlayMovies.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.PlayMovies.html) ... * accounts - * [*avails get*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.AccountAvailGetCall.html), [*avails list*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.AccountAvailListCall.html), [*orders get*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.AccountOrderGetCall.html), [*orders list*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.AccountOrderListCall.html), [*store infos country get*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.AccountStoreInfoCountryGetCall.html) and [*store infos list*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.AccountStoreInfoListCall.html) + * [*avails get*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.AccountAvailGetCall.html), [*avails list*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.AccountAvailListCall.html), [*orders get*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.AccountOrderGetCall.html), [*orders list*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.AccountOrderListCall.html), [*store infos country get*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.AccountStoreInfoCountryGetCall.html) and [*store infos list*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.AccountStoreInfoListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/struct.PlayMovies.html)** +* **[Hub](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/struct.PlayMovies.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.Part.html)** + * **[Parts](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -116,17 +116,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/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")`. @@ -136,29 +136,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/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](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/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](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/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](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/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](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/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](https://docs.rs/google-playmoviespartner1/1.0.5+20170516/google_playmoviespartner1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-playmoviespartner1/1.0.6+20170516/google_playmoviespartner1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/playmoviespartner1/src/lib.rs b/gen/playmoviespartner1/src/lib.rs index e1ce767fbf..434b5bd0a6 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 *Play Movies* crate version *1.0.5+20170516*, where *20170516* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Play Movies* crate version *1.0.6+20170516*, where *20170516* is the exact revision of the *playmoviespartner:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Play Movies* *v1* API can be found at the //! [official documentation site](https://developers.google.com/playmoviespartner/). @@ -311,7 +311,7 @@ impl<'a, C, A> PlayMovies PlayMovies { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://playmoviespartner.googleapis.com/".to_string(), _root_url: "https://playmoviespartner.googleapis.com/".to_string(), } @@ -322,7 +322,7 @@ impl<'a, C, A> PlayMovies } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/plus1-cli/Cargo.toml b/gen/plus1-cli/Cargo.toml index 509d774b9a..0f87071e51 100644 --- a/gen/plus1-cli/Cargo.toml +++ b/gen/plus1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plus1-cli" -version = "1.0.5+20170410" +version = "1.0.6+20170410" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-plus1] path = "../plus1" -version = "1.0.5+20170410" +version = "1.0.6+20170410" diff --git a/gen/plus1-cli/README.md b/gen/plus1-cli/README.md index 67d2bac5e4..ded7ba91cc 100644 --- a/gen/plus1-cli/README.md +++ b/gen/plus1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *plus* API at revision *20170410*. The CLI is at version *1.0.5*. +This documentation was generated from the *plus* API at revision *20170410*. The CLI is at version *1.0.6*. ```bash plus1 [options] diff --git a/gen/plus1-cli/mkdocs.yml b/gen/plus1-cli/mkdocs.yml index aac1f3bdf7..50180053ab 100644 --- a/gen/plus1-cli/mkdocs.yml +++ b/gen/plus1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plus v1.0.5+20170410 +site_name: plus v1.0.6+20170410 site_url: http://byron.github.io/google-apis-rs/google-plus1-cli site_description: A complete library to interact with plus (protocol v1) diff --git a/gen/plus1-cli/src/cmn.rs b/gen/plus1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/plus1-cli/src/cmn.rs +++ b/gen/plus1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/plus1-cli/src/main.rs b/gen/plus1-cli/src/main.rs index 93726074ea..a5042ad3be 100644 --- a/gen/plus1-cli/src/main.rs +++ b/gen/plus1-cli/src/main.rs @@ -938,7 +938,7 @@ fn main() { let mut app = App::new("plus1") .author("Sebastian Thiel ") - .version("1.0.5+20170410") + .version("1.0.6+20170410") .about("Builds 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") diff --git a/gen/plus1/Cargo.toml b/gen/plus1/Cargo.toml index 457221c3b0..054d293310 100644 --- a/gen/plus1/Cargo.toml +++ b/gen/plus1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-plus1" -version = "1.0.5+20170410" +version = "1.0.6+20170410" 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" homepage = "https://developers.google.com/+/api/" -documentation = "https://docs.rs/google-plus1/1.0.5+20170410" +documentation = "https://docs.rs/google-plus1/1.0.6+20170410" license = "MIT" keywords = ["plus", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/plus1/README.md b/gen/plus1/README.md index cb3cc5271a..1308f446fe 100644 --- a/gen/plus1/README.md +++ b/gen/plus1/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20170410*, where *20170410* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *plus* crate version *1.0.6+20170410*, where *20170410* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *plus* *v1* API can be found at the [official documentation site](https://developers.google.com/+/api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.Plus.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.Plus.html) ... -* [activities](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.Activity.html) - * [*get*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.ActivityGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.ActivityListCall.html) and [*search*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.ActivitySearchCall.html) -* [comments](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.Comment.html) - * [*get*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.CommentGetCall.html) and [*list*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.CommentListCall.html) +* [activities](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.Activity.html) + * [*get*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.ActivityGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.ActivityListCall.html) and [*search*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.ActivitySearchCall.html) +* [comments](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.Comment.html) + * [*get*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.CommentGetCall.html) and [*list*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.CommentListCall.html) * people - * [*get*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.PeopleListByActivityCall.html) and [*search*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.PeopleSearchCall.html) + * [*get*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.PeopleListByActivityCall.html) and [*search*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.PeopleSearchCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/struct.Plus.html)** +* **[Hub](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/struct.Plus.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.Part.html)** + * **[Parts](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -125,17 +125,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/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")`. @@ -145,29 +145,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/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](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/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](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/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](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/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](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/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](https://docs.rs/google-plus1/1.0.5+20170410/google_plus1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-plus1/1.0.6+20170410/google_plus1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/plus1/src/lib.rs b/gen/plus1/src/lib.rs index 41ff854178..e76e8b5d66 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 *1.0.5+20170410*, where *20170410* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *plus* crate version *1.0.6+20170410*, where *20170410* is the exact revision of the *plus:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *plus* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/api/). @@ -335,7 +335,7 @@ impl<'a, C, A> Plus Plus { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/plus/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -352,7 +352,7 @@ impl<'a, C, A> Plus } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/plusdomains1-cli/Cargo.toml b/gen/plusdomains1-cli/Cargo.toml index 196f528067..ec82652acf 100644 --- a/gen/plusdomains1-cli/Cargo.toml +++ b/gen/plusdomains1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-plusdomains1-cli" -version = "1.0.5+20170410" +version = "1.0.6+20170410" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-plusdomains1] path = "../plusdomains1" -version = "1.0.5+20170410" +version = "1.0.6+20170410" diff --git a/gen/plusdomains1-cli/README.md b/gen/plusdomains1-cli/README.md index 118c82633a..ba627dd530 100644 --- a/gen/plusdomains1-cli/README.md +++ b/gen/plusdomains1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *plusDomains* API at revision *20170410*. The CLI is at version *1.0.5*. +This documentation was generated from the *plusDomains* API at revision *20170410*. The CLI is at version *1.0.6*. ```bash plusdomains1 [options] diff --git a/gen/plusdomains1-cli/mkdocs.yml b/gen/plusdomains1-cli/mkdocs.yml index 7d6853ab03..5fa43c8088 100644 --- a/gen/plusdomains1-cli/mkdocs.yml +++ b/gen/plusdomains1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: plusDomains v1.0.5+20170410 +site_name: plusDomains v1.0.6+20170410 site_url: http://byron.github.io/google-apis-rs/google-plusdomains1-cli site_description: A complete library to interact with plusDomains (protocol v1) diff --git a/gen/plusdomains1-cli/src/cmn.rs b/gen/plusdomains1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/plusdomains1-cli/src/cmn.rs +++ b/gen/plusdomains1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/plusdomains1-cli/src/main.rs b/gen/plusdomains1-cli/src/main.rs index 7598c92eec..7ed20f7ff3 100644 --- a/gen/plusdomains1-cli/src/main.rs +++ b/gen/plusdomains1-cli/src/main.rs @@ -2164,7 +2164,7 @@ fn main() { let mut app = App::new("plusdomains1") .author("Sebastian Thiel ") - .version("1.0.5+20170410") + .version("1.0.6+20170410") .about("Builds on top of the Google+ platform for Google Apps Domains.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_plusdomains1_cli") .arg(Arg::with_name("url") diff --git a/gen/plusdomains1/Cargo.toml b/gen/plusdomains1/Cargo.toml index da30b4f49d..ef29955ce0 100644 --- a/gen/plusdomains1/Cargo.toml +++ b/gen/plusdomains1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-plusdomains1" -version = "1.0.5+20170410" +version = "1.0.6+20170410" 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" homepage = "https://developers.google.com/+/domains/" -documentation = "https://docs.rs/google-plusdomains1/1.0.5+20170410" +documentation = "https://docs.rs/google-plusdomains1/1.0.6+20170410" license = "MIT" keywords = ["plusDomains", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/plusdomains1/README.md b/gen/plusdomains1/README.md index 832be19341..e6fcad4679 100644 --- a/gen/plusdomains1/README.md +++ b/gen/plusdomains1/README.md @@ -5,31 +5,31 @@ 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 *1.0.5+20170410*, where *20170410* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *plusDomains* crate version *1.0.6+20170410*, where *20170410* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *plusDomains* *v1* API can be found at the [official documentation site](https://developers.google.com/+/domains/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.PlusDomains.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.PlusDomains.html) ... -* [activities](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.Activity.html) - * [*get*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.ActivityGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.ActivityListCall.html) -* [audiences](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.Audience.html) - * [*list*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.AudienceListCall.html) -* [circles](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.Circle.html) - * [*add people*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleAddPeopleCall.html), [*get*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleInsertCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleListCall.html), [*patch*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CirclePatchCall.html), [*remove*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleRemoveCall.html), [*remove people*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleRemovePeopleCall.html) and [*update*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CircleUpdateCall.html) -* [comments](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.Comment.html) - * [*get*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CommentInsertCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.CommentListCall.html) -* [media](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.Media.html) - * [*insert*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.MediaInsertCall.html) +* [activities](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.Activity.html) + * [*get*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.ActivityGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.ActivityListCall.html) +* [audiences](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.Audience.html) + * [*list*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.AudienceListCall.html) +* [circles](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.Circle.html) + * [*add people*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleAddPeopleCall.html), [*get*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleInsertCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleListCall.html), [*patch*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CirclePatchCall.html), [*remove*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleRemoveCall.html), [*remove people*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleRemovePeopleCall.html) and [*update*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CircleUpdateCall.html) +* [comments](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.Comment.html) + * [*get*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CommentGetCall.html), [*insert*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CommentInsertCall.html) and [*list*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.CommentListCall.html) +* [media](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.Media.html) + * [*insert*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.MediaInsertCall.html) * people - * [*get*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.PeopleListByActivityCall.html) and [*list by circle*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.PeopleListByCircleCall.html) + * [*get*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.PeopleGetCall.html), [*list*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.PeopleListCall.html), [*list by activity*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.PeopleListByActivityCall.html) and [*list by circle*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.PeopleListByCircleCall.html) Upload supported by ... -* [*insert media*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.MediaInsertCall.html) +* [*insert media*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.MediaInsertCall.html) @@ -37,17 +37,17 @@ Upload supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/struct.PlusDomains.html)** +* **[Hub](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/struct.PlusDomains.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.Part.html)** + * **[Parts](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/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")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/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](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/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](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/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](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/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](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/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](https://docs.rs/google-plusdomains1/1.0.5+20170410/google_plusdomains1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-plusdomains1/1.0.6+20170410/google_plusdomains1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/plusdomains1/src/lib.rs b/gen/plusdomains1/src/lib.rs index b7d8897673..3a5411fa92 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 *1.0.5+20170410*, where *20170410* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *plusDomains* crate version *1.0.6+20170410*, where *20170410* is the exact revision of the *plusDomains:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *plusDomains* *v1* API can be found at the //! [official documentation site](https://developers.google.com/+/domains/). @@ -372,7 +372,7 @@ impl<'a, C, A> PlusDomains PlusDomains { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/plusDomains/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -398,7 +398,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/prediction1d6-cli/Cargo.toml b/gen/prediction1d6-cli/Cargo.toml index 911af5fd1e..098e111897 100644 --- a/gen/prediction1d6-cli/Cargo.toml +++ b/gen/prediction1d6-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-prediction1d6-cli" -version = "1.0.5+20160511" +version = "1.0.6+20160511" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-prediction1d6] path = "../prediction1d6" -version = "1.0.5+20160511" +version = "1.0.6+20160511" diff --git a/gen/prediction1d6-cli/README.md b/gen/prediction1d6-cli/README.md index 45eec9f9d3..fe5d1d7f2c 100644 --- a/gen/prediction1d6-cli/README.md +++ b/gen/prediction1d6-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *prediction* API at revision *20160511*. The CLI is at version *1.0.5*. +This documentation was generated from the *prediction* API at revision *20160511*. The CLI is at version *1.0.6*. ```bash prediction1d6 [options] diff --git a/gen/prediction1d6-cli/mkdocs.yml b/gen/prediction1d6-cli/mkdocs.yml index e054951137..adb1884490 100644 --- a/gen/prediction1d6-cli/mkdocs.yml +++ b/gen/prediction1d6-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: prediction v1.0.5+20160511 +site_name: prediction v1.0.6+20160511 site_url: http://byron.github.io/google-apis-rs/google-prediction1d6-cli site_description: A complete library to interact with prediction (protocol v1.6) diff --git a/gen/prediction1d6-cli/src/cmn.rs b/gen/prediction1d6-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/prediction1d6-cli/src/cmn.rs +++ b/gen/prediction1d6-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/prediction1d6-cli/src/main.rs b/gen/prediction1d6-cli/src/main.rs index 14f6183873..c812f8020b 100644 --- a/gen/prediction1d6-cli/src/main.rs +++ b/gen/prediction1d6-cli/src/main.rs @@ -963,7 +963,7 @@ fn main() { let mut app = App::new("prediction1d6") .author("Sebastian Thiel ") - .version("1.0.5+20160511") + .version("1.0.6+20160511") .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") diff --git a/gen/prediction1d6/Cargo.toml b/gen/prediction1d6/Cargo.toml index c7c7811950..43eb7638f0 100644 --- a/gen/prediction1d6/Cargo.toml +++ b/gen/prediction1d6/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-prediction1d6" -version = "1.0.5+20160511" +version = "1.0.6+20160511" 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" homepage = "https://developers.google.com/prediction/docs/developer-guide" -documentation = "https://docs.rs/google-prediction1d6/1.0.5+20160511" +documentation = "https://docs.rs/google-prediction1d6/1.0.6+20160511" license = "MIT" keywords = ["prediction", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/prediction1d6/README.md b/gen/prediction1d6/README.md index 900ae7a74e..41d9ff5e7a 100644 --- a/gen/prediction1d6/README.md +++ b/gen/prediction1d6/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20160511*, where *20160511* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *prediction* crate version *1.0.6+20160511*, where *20160511* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *prediction* *v1d6* API can be found at the [official documentation site](https://developers.google.com/prediction/docs/developer-guide). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.Prediction.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.Prediction.html) ... * hostedmodels - * [*predict*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.HostedmodelPredictCall.html) + * [*predict*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.HostedmodelPredictCall.html) * trainedmodels - * [*analyze*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelAnalyzeCall.html), [*delete*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelDeleteCall.html), [*get*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelGetCall.html), [*insert*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelInsertCall.html), [*list*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelListCall.html), [*predict*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelPredictCall.html) and [*update*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.TrainedmodelUpdateCall.html) + * [*analyze*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelAnalyzeCall.html), [*delete*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelDeleteCall.html), [*get*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelGetCall.html), [*insert*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelInsertCall.html), [*list*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelListCall.html), [*predict*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelPredictCall.html) and [*update*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.TrainedmodelUpdateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/struct.Prediction.html)** +* **[Hub](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/struct.Prediction.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.Part.html)** + * **[Parts](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/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")`. @@ -146,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](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/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](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/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](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.RequestValue.html) and -[decodable](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/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](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.RequestValue.html) and +[decodable](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/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](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/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](https://docs.rs/google-prediction1d6/1.0.5+20160511/google_prediction1d6/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-prediction1d6/1.0.6+20160511/google_prediction1d6/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/prediction1d6/src/lib.rs b/gen/prediction1d6/src/lib.rs index 6c2227ee6c..45fc0c5a03 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 *1.0.5+20160511*, where *20160511* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *prediction* crate version *1.0.6+20160511*, where *20160511* is the exact revision of the *prediction:v1.6* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *prediction* *v1d6* API can be found at the //! [official documentation site](https://developers.google.com/prediction/docs/developer-guide). @@ -343,7 +343,7 @@ impl<'a, C, A> Prediction Prediction { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/prediction/v1.6/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -357,7 +357,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/proximitybeacon1_beta1-cli/Cargo.toml b/gen/proximitybeacon1_beta1-cli/Cargo.toml index c1f42569f0..17fcae5634 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 = "1.0.5+20170517" +version = "1.0.6+20170517" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-proximitybeacon1_beta1] path = "../proximitybeacon1_beta1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/proximitybeacon1_beta1-cli/README.md b/gen/proximitybeacon1_beta1-cli/README.md index 16b88ac911..e0d40fe18b 100644 --- a/gen/proximitybeacon1_beta1-cli/README.md +++ b/gen/proximitybeacon1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *proximitybeacon* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *proximitybeacon* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash proximitybeacon1-beta1 [options] diff --git a/gen/proximitybeacon1_beta1-cli/mkdocs.yml b/gen/proximitybeacon1_beta1-cli/mkdocs.yml index d21a6865a9..6a76f130cb 100644 --- a/gen/proximitybeacon1_beta1-cli/mkdocs.yml +++ b/gen/proximitybeacon1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: proximitybeacon v1.0.5+20170517 +site_name: proximitybeacon v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-proximitybeacon1_beta1-cli site_description: A complete library to interact with proximitybeacon (protocol v1beta1) diff --git a/gen/proximitybeacon1_beta1-cli/src/cmn.rs b/gen/proximitybeacon1_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/proximitybeacon1_beta1-cli/src/cmn.rs +++ b/gen/proximitybeacon1_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/proximitybeacon1_beta1-cli/src/main.rs b/gen/proximitybeacon1_beta1-cli/src/main.rs index f297953a1a..838037f6e3 100644 --- a/gen/proximitybeacon1_beta1-cli/src/main.rs +++ b/gen/proximitybeacon1_beta1-cli/src/main.rs @@ -1961,7 +1961,7 @@ fn main() { let mut app = App::new("proximitybeacon1-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .about("Registers, manages, indexes, and searches 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("url") diff --git a/gen/proximitybeacon1_beta1/Cargo.toml b/gen/proximitybeacon1_beta1/Cargo.toml index 18f157d4a2..75bf8074fd 100644 --- a/gen/proximitybeacon1_beta1/Cargo.toml +++ b/gen/proximitybeacon1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-proximitybeacon1_beta1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" homepage = "https://developers.google.com/beacons/proximity/" -documentation = "https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517" +documentation = "https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517" license = "MIT" keywords = ["proximitybeacon", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/proximitybeacon1_beta1/README.md b/gen/proximitybeacon1_beta1/README.md index 4a59228736..be21065cdb 100644 --- a/gen/proximitybeacon1_beta1/README.md +++ b/gen/proximitybeacon1_beta1/README.md @@ -5,24 +5,24 @@ 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *proximitybeacon* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *proximitybeacon* *v1_beta1* API can be found at the [official documentation site](https://developers.google.com/beacons/proximity/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.Proximitybeacon.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.Proximitybeacon.html) ... * beaconinfo - * [*getforobserved*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconinfoGetforobservedCall.html) -* [beacons](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.Beacon.html) - * [*activate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconActivateCall.html), [*attachments batch delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentBatchDeleteCall.html), [*attachments create*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentCreateCall.html), [*attachments delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentDeleteCall.html), [*attachments list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentListCall.html), [*deactivate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconDeactivateCall.html), [*decommission*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconDecommissionCall.html), [*delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconDeleteCall.html), [*diagnostics list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconDiagnosticListCall.html), [*get*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconGetCall.html), [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconListCall.html), [*register*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconRegisterCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.BeaconUpdateCall.html) -* [namespaces](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.Namespace.html) - * [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.NamespaceListCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.NamespaceUpdateCall.html) + * [*getforobserved*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconinfoGetforobservedCall.html) +* [beacons](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.Beacon.html) + * [*activate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconActivateCall.html), [*attachments batch delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentBatchDeleteCall.html), [*attachments create*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentCreateCall.html), [*attachments delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentDeleteCall.html), [*attachments list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconAttachmentListCall.html), [*deactivate*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconDeactivateCall.html), [*decommission*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconDecommissionCall.html), [*delete*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconDeleteCall.html), [*diagnostics list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconDiagnosticListCall.html), [*get*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconGetCall.html), [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconListCall.html), [*register*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconRegisterCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.BeaconUpdateCall.html) +* [namespaces](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.Namespace.html) + * [*list*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.NamespaceListCall.html) and [*update*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.NamespaceUpdateCall.html) Other activities are ... -* [get eidparams](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.MethodGetEidparamCall.html) +* [get eidparams](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.MethodGetEidparamCall.html) @@ -30,17 +30,17 @@ Other activities are ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/struct.Proximitybeacon.html)** +* **[Hub](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/struct.Proximitybeacon.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -139,17 +139,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/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")`. @@ -159,29 +159,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/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](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/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](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_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](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/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](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/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](https://docs.rs/google-proximitybeacon1_beta1/1.0.5+20170517/google_proximitybeacon1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-proximitybeacon1_beta1/1.0.6+20170517/google_proximitybeacon1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/proximitybeacon1_beta1/src/lib.rs b/gen/proximitybeacon1_beta1/src/lib.rs index bd27c04b3d..70ed17c9d3 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *proximitybeacon* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *proximitybeacon:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *proximitybeacon* *v1_beta1* API can be found at the //! [official documentation site](https://developers.google.com/beacons/proximity/). @@ -338,7 +338,7 @@ impl<'a, C, A> Proximitybeacon Proximitybeacon { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://proximitybeacon.googleapis.com/".to_string(), _root_url: "https://proximitybeacon.googleapis.com/".to_string(), } @@ -358,7 +358,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/pubsub1-cli/Cargo.toml b/gen/pubsub1-cli/Cargo.toml index eac7f7d73c..2cf550c166 100644 --- a/gen/pubsub1-cli/Cargo.toml +++ b/gen/pubsub1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-pubsub1-cli" -version = "1.0.5+20170502" +version = "1.0.6+20170502" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-pubsub1] path = "../pubsub1" -version = "1.0.5+20170502" +version = "1.0.6+20170502" diff --git a/gen/pubsub1-cli/README.md b/gen/pubsub1-cli/README.md index 764decdf33..816d531b21 100644 --- a/gen/pubsub1-cli/README.md +++ b/gen/pubsub1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Pubsub* API at revision *20170502*. The CLI is at version *1.0.5*. +This documentation was generated from the *Pubsub* API at revision *20170502*. The CLI is at version *1.0.6*. ```bash pubsub1 [options] diff --git a/gen/pubsub1-cli/mkdocs.yml b/gen/pubsub1-cli/mkdocs.yml index afe974c1d7..3fc5903d0c 100644 --- a/gen/pubsub1-cli/mkdocs.yml +++ b/gen/pubsub1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Pubsub v1.0.5+20170502 +site_name: Pubsub v1.0.6+20170502 site_url: http://byron.github.io/google-apis-rs/google-pubsub1-cli site_description: A complete library to interact with Pubsub (protocol v1) diff --git a/gen/pubsub1-cli/src/cmn.rs b/gen/pubsub1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/pubsub1-cli/src/cmn.rs +++ b/gen/pubsub1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/pubsub1-cli/src/main.rs b/gen/pubsub1-cli/src/main.rs index c1850b11c0..d373ee5ed9 100644 --- a/gen/pubsub1-cli/src/main.rs +++ b/gen/pubsub1-cli/src/main.rs @@ -2555,7 +2555,7 @@ fn main() { let mut app = App::new("pubsub1") .author("Sebastian Thiel ") - .version("1.0.5+20170502") + .version("1.0.6+20170502") .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") diff --git a/gen/pubsub1/Cargo.toml b/gen/pubsub1/Cargo.toml index 363e215399..ecf025e304 100644 --- a/gen/pubsub1/Cargo.toml +++ b/gen/pubsub1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pubsub1" -version = "1.0.5+20170502" +version = "1.0.6+20170502" 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" homepage = "https://cloud.google.com/pubsub/docs" -documentation = "https://docs.rs/google-pubsub1/1.0.5+20170502" +documentation = "https://docs.rs/google-pubsub1/1.0.6+20170502" license = "MIT" keywords = ["pubsub", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/pubsub1/README.md b/gen/pubsub1/README.md index d724ad0495..509afc74c1 100644 --- a/gen/pubsub1/README.md +++ b/gen/pubsub1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170502*, where *20170502* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Pubsub* crate version *1.0.6+20170502*, where *20170502* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Pubsub* *v1* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.Pubsub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.Pubsub.html) ... * projects - * [*snapshots get iam policy*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSnapshotGetIamPolicyCall.html), [*snapshots set iam policy*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSnapshotSetIamPolicyCall.html), [*snapshots test iam permissions*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSnapshotTestIamPermissionCall.html), [*subscriptions acknowledge*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicListCall.html), [*topics publish*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.ProjectTopicTestIamPermissionCall.html) + * [*snapshots get iam policy*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSnapshotGetIamPolicyCall.html), [*snapshots set iam policy*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSnapshotSetIamPolicyCall.html), [*snapshots test iam permissions*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSnapshotTestIamPermissionCall.html), [*subscriptions acknowledge*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicListCall.html), [*topics publish*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.ProjectTopicTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/struct.Pubsub.html)** +* **[Hub](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/struct.Pubsub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.Part.html)** + * **[Parts](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/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")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/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](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/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](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/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](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/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](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/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](https://docs.rs/google-pubsub1/1.0.5+20170502/google_pubsub1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pubsub1/1.0.6+20170502/google_pubsub1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/pubsub1/src/lib.rs b/gen/pubsub1/src/lib.rs index f7eb7275a5..9367a5b913 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 *1.0.5+20170502*, where *20170502* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Pubsub* crate version *1.0.6+20170502*, where *20170502* is the exact revision of the *pubsub:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Pubsub* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). @@ -332,7 +332,7 @@ impl<'a, C, A> Pubsub Pubsub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://pubsub.googleapis.com/".to_string(), _root_url: "https://pubsub.googleapis.com/".to_string(), } @@ -343,7 +343,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/pubsub1_beta2-cli/Cargo.toml b/gen/pubsub1_beta2-cli/Cargo.toml index de383ebeb5..2b438bb329 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 = "1.0.5+20170502" +version = "1.0.6+20170502" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-pubsub1_beta2] path = "../pubsub1_beta2" -version = "1.0.5+20170502" +version = "1.0.6+20170502" diff --git a/gen/pubsub1_beta2-cli/README.md b/gen/pubsub1_beta2-cli/README.md index 1a8583b685..17eaae9e59 100644 --- a/gen/pubsub1_beta2-cli/README.md +++ b/gen/pubsub1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Pubsub* API at revision *20170502*. The CLI is at version *1.0.5*. +This documentation was generated from the *Pubsub* API at revision *20170502*. The CLI is at version *1.0.6*. ```bash pubsub1-beta2 [options] diff --git a/gen/pubsub1_beta2-cli/mkdocs.yml b/gen/pubsub1_beta2-cli/mkdocs.yml index f731c0a095..0950d146bd 100644 --- a/gen/pubsub1_beta2-cli/mkdocs.yml +++ b/gen/pubsub1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Pubsub v1.0.5+20170502 +site_name: Pubsub v1.0.6+20170502 site_url: http://byron.github.io/google-apis-rs/google-pubsub1_beta2-cli site_description: A complete library to interact with Pubsub (protocol v1beta2) diff --git a/gen/pubsub1_beta2-cli/src/cmn.rs b/gen/pubsub1_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/pubsub1_beta2-cli/src/cmn.rs +++ b/gen/pubsub1_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/pubsub1_beta2-cli/src/main.rs b/gen/pubsub1_beta2-cli/src/main.rs index ac2523f4ec..9c1955ac6e 100644 --- a/gen/pubsub1_beta2-cli/src/main.rs +++ b/gen/pubsub1_beta2-cli/src/main.rs @@ -2219,7 +2219,7 @@ fn main() { let mut app = App::new("pubsub1-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20170502") + .version("1.0.6+20170502") .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") diff --git a/gen/pubsub1_beta2/Cargo.toml b/gen/pubsub1_beta2/Cargo.toml index c595ad63da..cccbe4446e 100644 --- a/gen/pubsub1_beta2/Cargo.toml +++ b/gen/pubsub1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-pubsub1_beta2" -version = "1.0.5+20170502" +version = "1.0.6+20170502" 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" homepage = "https://cloud.google.com/pubsub/docs" -documentation = "https://docs.rs/google-pubsub1_beta2/1.0.5+20170502" +documentation = "https://docs.rs/google-pubsub1_beta2/1.0.6+20170502" license = "MIT" keywords = ["pubsub", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/pubsub1_beta2/README.md b/gen/pubsub1_beta2/README.md index ebf50a02ad..b36799af04 100644 --- a/gen/pubsub1_beta2/README.md +++ b/gen/pubsub1_beta2/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170502*, where *20170502* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Pubsub* crate version *1.0.6+20170502*, where *20170502* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Pubsub* *v1_beta2* API can be found at the [official documentation site](https://cloud.google.com/pubsub/docs). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.Pubsub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.Pubsub.html) ... * projects - * [*subscriptions acknowledge*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicListCall.html), [*topics publish*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.ProjectTopicTestIamPermissionCall.html) + * [*subscriptions acknowledge*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionAcknowledgeCall.html), [*subscriptions create*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionCreateCall.html), [*subscriptions delete*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionDeleteCall.html), [*subscriptions get*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionGetCall.html), [*subscriptions get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionGetIamPolicyCall.html), [*subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionListCall.html), [*subscriptions modify ack deadline*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionModifyAckDeadlineCall.html), [*subscriptions modify push config*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionModifyPushConfigCall.html), [*subscriptions pull*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionPullCall.html), [*subscriptions set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionSetIamPolicyCall.html), [*subscriptions test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectSubscriptionTestIamPermissionCall.html), [*topics create*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicCreateCall.html), [*topics delete*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicDeleteCall.html), [*topics get*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicGetCall.html), [*topics get iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicGetIamPolicyCall.html), [*topics list*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicListCall.html), [*topics publish*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicPublishCall.html), [*topics set iam policy*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicSetIamPolicyCall.html), [*topics subscriptions list*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicSubscriptionListCall.html) and [*topics test iam permissions*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.ProjectTopicTestIamPermissionCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/struct.Pubsub.html)** +* **[Hub](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/struct.Pubsub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_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")`. @@ -146,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](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_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](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_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](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/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](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_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](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_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](https://docs.rs/google-pubsub1_beta2/1.0.5+20170502/google_pubsub1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-pubsub1_beta2/1.0.6+20170502/google_pubsub1_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. diff --git a/gen/pubsub1_beta2/src/lib.rs b/gen/pubsub1_beta2/src/lib.rs index 72e8ec6205..c9e0df1884 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 *1.0.5+20170502*, where *20170502* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Pubsub* crate version *1.0.6+20170502*, where *20170502* is the exact revision of the *pubsub:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Pubsub* *v1_beta2* API can be found at the //! [official documentation site](https://cloud.google.com/pubsub/docs). @@ -331,7 +331,7 @@ impl<'a, C, A> Pubsub Pubsub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://pubsub.googleapis.com/".to_string(), _root_url: "https://pubsub.googleapis.com/".to_string(), } @@ -342,7 +342,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/qpxexpress1-cli/Cargo.toml b/gen/qpxexpress1-cli/Cargo.toml index ac8f7f05da..d03d94ac0c 100644 --- a/gen/qpxexpress1-cli/Cargo.toml +++ b/gen/qpxexpress1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-qpxexpress1-cli" -version = "1.0.5+20160708" +version = "1.0.6+20160708" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-qpxexpress1] path = "../qpxexpress1" -version = "1.0.5+20160708" +version = "1.0.6+20160708" diff --git a/gen/qpxexpress1-cli/README.md b/gen/qpxexpress1-cli/README.md index 541d9748ea..b0381d4ef5 100644 --- a/gen/qpxexpress1-cli/README.md +++ b/gen/qpxexpress1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *QPX Express* API at revision *20160708*. The CLI is at version *1.0.5*. +This documentation was generated from the *QPX Express* API at revision *20160708*. The CLI is at version *1.0.6*. ```bash qpxexpress1 [options] diff --git a/gen/qpxexpress1-cli/mkdocs.yml b/gen/qpxexpress1-cli/mkdocs.yml index b0fde24d2c..9f55e27641 100644 --- a/gen/qpxexpress1-cli/mkdocs.yml +++ b/gen/qpxexpress1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: QPX Express v1.0.5+20160708 +site_name: QPX Express v1.0.6+20160708 site_url: http://byron.github.io/google-apis-rs/google-qpxexpress1-cli site_description: A complete library to interact with QPX Express (protocol v1) diff --git a/gen/qpxexpress1-cli/src/cmn.rs b/gen/qpxexpress1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/qpxexpress1-cli/src/cmn.rs +++ b/gen/qpxexpress1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/qpxexpress1-cli/src/main.rs b/gen/qpxexpress1-cli/src/main.rs index fd1508b302..e3e887143e 100644 --- a/gen/qpxexpress1-cli/src/main.rs +++ b/gen/qpxexpress1-cli/src/main.rs @@ -265,7 +265,7 @@ fn main() { let mut app = App::new("qpxexpress1") .author("Sebastian Thiel ") - .version("1.0.5+20160708") + .version("1.0.6+20160708") .about("Finds 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") diff --git a/gen/qpxexpress1/Cargo.toml b/gen/qpxexpress1/Cargo.toml index 2f23d32dae..e8c22cf086 100644 --- a/gen/qpxexpress1/Cargo.toml +++ b/gen/qpxexpress1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-qpxexpress1" -version = "1.0.5+20160708" +version = "1.0.6+20160708" 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" homepage = "http://developers.google.com/qpx-express" -documentation = "https://docs.rs/google-qpxexpress1/1.0.5+20160708" +documentation = "https://docs.rs/google-qpxexpress1/1.0.6+20160708" license = "MIT" keywords = ["qpxExpress", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/qpxexpress1/README.md b/gen/qpxexpress1/README.md index 83548415b2..e7994afb8c 100644 --- a/gen/qpxexpress1/README.md +++ b/gen/qpxexpress1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20160708*, where *20160708* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *QPX Express* crate version *1.0.6+20160708*, where *20160708* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *QPX Express* *v1* API can be found at the [official documentation site](http://developers.google.com/qpx-express). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/struct.QPXExpress.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/struct.QPXExpress.html) ... * trips - * [*search*](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/struct.TripSearchCall.html) + * [*search*](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/struct.TripSearchCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/struct.QPXExpress.html)** +* **[Hub](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/struct.QPXExpress.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.Part.html)** + * **[Parts](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -122,17 +122,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/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")`. @@ -142,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](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/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](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/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](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/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](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/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](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/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](https://docs.rs/google-qpxexpress1/1.0.5+20160708/google_qpxexpress1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-qpxexpress1/1.0.6+20160708/google_qpxexpress1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/qpxexpress1/src/lib.rs b/gen/qpxexpress1/src/lib.rs index b10f6f82f8..6ea1713c0a 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 *1.0.5+20160708*, where *20160708* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *QPX Express* crate version *1.0.6+20160708*, where *20160708* is the exact revision of the *qpxExpress:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *QPX Express* *v1* API can be found at the //! [official documentation site](http://developers.google.com/qpx-express). @@ -301,7 +301,7 @@ impl<'a, C, A> QPXExpress QPXExpress { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/qpxExpress/v1/trips/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -312,7 +312,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/replicapool1_beta2-cli/Cargo.toml b/gen/replicapool1_beta2-cli/Cargo.toml index 25cc00a97d..99c65d2437 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 = "1.0.5+20160512" +version = "1.0.6+20160512" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-replicapool1_beta2] path = "../replicapool1_beta2" -version = "1.0.5+20160512" +version = "1.0.6+20160512" diff --git a/gen/replicapool1_beta2-cli/README.md b/gen/replicapool1_beta2-cli/README.md index 175b848bf0..afc099a369 100644 --- a/gen/replicapool1_beta2-cli/README.md +++ b/gen/replicapool1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *replicapool* API at revision *20160512*. The CLI is at version *1.0.5*. +This documentation was generated from the *replicapool* API at revision *20160512*. The CLI is at version *1.0.6*. ```bash replicapool1-beta2 [options] diff --git a/gen/replicapool1_beta2-cli/mkdocs.yml b/gen/replicapool1_beta2-cli/mkdocs.yml index f01f663974..51843e7aa8 100644 --- a/gen/replicapool1_beta2-cli/mkdocs.yml +++ b/gen/replicapool1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: replicapool v1.0.5+20160512 +site_name: replicapool v1.0.6+20160512 site_url: http://byron.github.io/google-apis-rs/google-replicapool1_beta2-cli site_description: A complete library to interact with replicapool (protocol v1beta2) diff --git a/gen/replicapool1_beta2-cli/src/cmn.rs b/gen/replicapool1_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/replicapool1_beta2-cli/src/cmn.rs +++ b/gen/replicapool1_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/replicapool1_beta2-cli/src/main.rs b/gen/replicapool1_beta2-cli/src/main.rs index 9c4886a208..9fa9db8391 100644 --- a/gen/replicapool1_beta2-cli/src/main.rs +++ b/gen/replicapool1_beta2-cli/src/main.rs @@ -1490,7 +1490,7 @@ fn main() { let mut app = App::new("replicapool1-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20160512") + .version("1.0.6+20160512") .about("[Deprecated. Please use Instance Group Manager in Compute 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") diff --git a/gen/replicapool1_beta2/Cargo.toml b/gen/replicapool1_beta2/Cargo.toml index 153f36003a..a4f971f6d2 100644 --- a/gen/replicapool1_beta2/Cargo.toml +++ b/gen/replicapool1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-replicapool1_beta2" -version = "1.0.5+20160512" +version = "1.0.6+20160512" 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" homepage = "https://developers.google.com/compute/docs/instance-groups/manager/v1beta2" -documentation = "https://docs.rs/google-replicapool1_beta2/1.0.5+20160512" +documentation = "https://docs.rs/google-replicapool1_beta2/1.0.6+20160512" license = "MIT" keywords = ["replicapool", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/replicapool1_beta2/README.md b/gen/replicapool1_beta2/README.md index c21bdd4669..6f0cb4200c 100644 --- a/gen/replicapool1_beta2/README.md +++ b/gen/replicapool1_beta2/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20160512*, where *20160512* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *replicapool* crate version *1.0.6+20160512*, where *20160512* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.Replicapool.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.Replicapool.html) ... -* [instance group managers](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManager.html) - * [*abandon instances*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerAbandonInstanceCall.html), [*delete*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerListCall.html), [*recreate instances*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerSetTargetPoolCall.html) +* [instance group managers](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManager.html) + * [*abandon instances*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerAbandonInstanceCall.html), [*delete*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerDeleteCall.html), [*delete instances*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerDeleteInstanceCall.html), [*get*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerGetCall.html), [*insert*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerInsertCall.html), [*list*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerListCall.html), [*recreate instances*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerRecreateInstanceCall.html), [*resize*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerResizeCall.html), [*set instance template*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerSetInstanceTemplateCall.html) and [*set target pools*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.InstanceGroupManagerSetTargetPoolCall.html) * zone operations - * [*get*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.ZoneOperationListCall.html) + * [*get*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.ZoneOperationListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/struct.Replicapool.html)** +* **[Hub](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/struct.Replicapool.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_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")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_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](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_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](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/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](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_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](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_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](https://docs.rs/google-replicapool1_beta2/1.0.5+20160512/google_replicapool1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-replicapool1_beta2/1.0.6+20160512/google_replicapool1_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. diff --git a/gen/replicapool1_beta2/src/lib.rs b/gen/replicapool1_beta2/src/lib.rs index e8a07fbf34..ed53cc676b 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 *1.0.5+20160512*, where *20160512* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *replicapool* crate version *1.0.6+20160512*, where *20160512* is the exact revision of the *replicapool:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -340,7 +340,7 @@ impl<'a, C, A> Replicapool Replicapool { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/replicapool/v1beta2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -354,7 +354,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/replicapoolupdater1_beta1-cli/Cargo.toml b/gen/replicapoolupdater1_beta1-cli/Cargo.toml index 29011a4db1..8964b6df37 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 = "1.0.5+20161003" +version = "1.0.6+20161003" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-replicapoolupdater1_beta1] path = "../replicapoolupdater1_beta1" -version = "1.0.5+20161003" +version = "1.0.6+20161003" diff --git a/gen/replicapoolupdater1_beta1-cli/README.md b/gen/replicapoolupdater1_beta1-cli/README.md index c1e912f5c4..8d2ad76617 100644 --- a/gen/replicapoolupdater1_beta1-cli/README.md +++ b/gen/replicapoolupdater1_beta1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *replicapoolupdater* API at revision *20161003*. The CLI is at version *1.0.5*. +This documentation was generated from the *replicapoolupdater* API at revision *20161003*. The CLI is at version *1.0.6*. ```bash replicapoolupdater1-beta1 [options] diff --git a/gen/replicapoolupdater1_beta1-cli/mkdocs.yml b/gen/replicapoolupdater1_beta1-cli/mkdocs.yml index 15d199201b..8dde45c2a4 100644 --- a/gen/replicapoolupdater1_beta1-cli/mkdocs.yml +++ b/gen/replicapoolupdater1_beta1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: replicapoolupdater v1.0.5+20161003 +site_name: replicapoolupdater v1.0.6+20161003 site_url: http://byron.github.io/google-apis-rs/google-replicapoolupdater1_beta1-cli site_description: A complete library to interact with replicapoolupdater (protocol v1beta1) diff --git a/gen/replicapoolupdater1_beta1-cli/src/cmn.rs b/gen/replicapoolupdater1_beta1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/replicapoolupdater1_beta1-cli/src/cmn.rs +++ b/gen/replicapoolupdater1_beta1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/replicapoolupdater1_beta1-cli/src/main.rs b/gen/replicapoolupdater1_beta1-cli/src/main.rs index bafb133db1..a5736677d1 100644 --- a/gen/replicapoolupdater1_beta1-cli/src/main.rs +++ b/gen/replicapoolupdater1_beta1-cli/src/main.rs @@ -1118,7 +1118,7 @@ fn main() { let mut app = App::new("replicapoolupdater1-beta1") .author("Sebastian Thiel ") - .version("1.0.5+20161003") + .version("1.0.6+20161003") .about("[Deprecated. Please use compute.instanceGroupManagers.update method. replicapoolupdater API will be disabled after December 30th, 2016] Updates 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") diff --git a/gen/replicapoolupdater1_beta1/Cargo.toml b/gen/replicapoolupdater1_beta1/Cargo.toml index eb2f41760e..9856e59fb2 100644 --- a/gen/replicapoolupdater1_beta1/Cargo.toml +++ b/gen/replicapoolupdater1_beta1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-replicapoolupdater1_beta1" -version = "1.0.5+20161003" +version = "1.0.6+20161003" 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" homepage = "https://cloud.google.com/compute/docs/instance-groups/manager/#applying_rolling_updates_using_the_updater_service" -documentation = "https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003" +documentation = "https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003" license = "MIT" keywords = ["replicapoolupdater", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/replicapoolupdater1_beta1/README.md b/gen/replicapoolupdater1_beta1/README.md index 0ef496aeaf..d24f179a86 100644 --- a/gen/replicapoolupdater1_beta1/README.md +++ b/gen/replicapoolupdater1_beta1/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20161003*, where *20161003* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *replicapoolupdater* crate version *1.0.6+20161003*, where *20161003* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.Replicapoolupdater.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.Replicapoolupdater.html) ... -* [rolling updates](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdate.html) - * [*cancel*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateCancelCall.html), [*get*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateGetCall.html), [*insert*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateInsertCall.html), [*list*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateListCall.html), [*list instance updates*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateListInstanceUpdateCall.html), [*pause*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdatePauseCall.html), [*resume*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateResumeCall.html) and [*rollback*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateRollbackCall.html) +* [rolling updates](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdate.html) + * [*cancel*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateCancelCall.html), [*get*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateGetCall.html), [*insert*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateInsertCall.html), [*list*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateListCall.html), [*list instance updates*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateListInstanceUpdateCall.html), [*pause*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdatePauseCall.html), [*resume*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateResumeCall.html) and [*rollback*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.RollingUpdateRollbackCall.html) * zone operations - * [*get*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.ZoneOperationListCall.html) + * [*get*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.ZoneOperationListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/struct.Replicapoolupdater.html)** +* **[Hub](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/struct.Replicapoolupdater.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.Part.html)** + * **[Parts](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -128,17 +128,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/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 +148,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/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](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/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](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_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](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/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](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/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](https://docs.rs/google-replicapoolupdater1_beta1/1.0.5+20161003/google_replicapoolupdater1_beta1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-replicapoolupdater1_beta1/1.0.6+20161003/google_replicapoolupdater1_beta1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/replicapoolupdater1_beta1/src/lib.rs b/gen/replicapoolupdater1_beta1/src/lib.rs index 254daf851f..111cfc5084 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 *1.0.5+20161003*, where *20161003* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *replicapoolupdater* crate version *1.0.6+20161003*, where *20161003* is the exact revision of the *replicapoolupdater:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -338,7 +338,7 @@ impl<'a, C, A> Replicapoolupdater Replicapoolupdater { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/replicapoolupdater/v1beta1/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -352,7 +352,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/reseller1_sandbox-cli/Cargo.toml b/gen/reseller1_sandbox-cli/Cargo.toml index ab65809d97..663be4f768 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 = "1.0.5+20160329" +version = "1.0.6+20160329" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-reseller1_sandbox] path = "../reseller1_sandbox" -version = "1.0.5+20160329" +version = "1.0.6+20160329" diff --git a/gen/reseller1_sandbox-cli/README.md b/gen/reseller1_sandbox-cli/README.md index 01dea16ef1..60d59c4c4d 100644 --- a/gen/reseller1_sandbox-cli/README.md +++ b/gen/reseller1_sandbox-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *reseller* API at revision *20160329*. The CLI is at version *1.0.5*. +This documentation was generated from the *reseller* API at revision *20160329*. The CLI is at version *1.0.6*. ```bash reseller1-sandbox [options] diff --git a/gen/reseller1_sandbox-cli/mkdocs.yml b/gen/reseller1_sandbox-cli/mkdocs.yml index c9a0ce50b7..9f447064b0 100644 --- a/gen/reseller1_sandbox-cli/mkdocs.yml +++ b/gen/reseller1_sandbox-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: reseller v1.0.5+20160329 +site_name: reseller v1.0.6+20160329 site_url: http://byron.github.io/google-apis-rs/google-reseller1_sandbox-cli site_description: A complete library to interact with reseller (protocol v1sandbox) diff --git a/gen/reseller1_sandbox-cli/src/cmn.rs b/gen/reseller1_sandbox-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/reseller1_sandbox-cli/src/cmn.rs +++ b/gen/reseller1_sandbox-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/reseller1_sandbox-cli/src/main.rs b/gen/reseller1_sandbox-cli/src/main.rs index ea8d5c1cf2..315e2c2bbc 100644 --- a/gen/reseller1_sandbox-cli/src/main.rs +++ b/gen/reseller1_sandbox-cli/src/main.rs @@ -1646,7 +1646,7 @@ fn main() { let mut app = App::new("reseller1-sandbox") .author("Sebastian Thiel ") - .version("1.0.5+20160329") + .version("1.0.6+20160329") .about("Creates and manages 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") diff --git a/gen/reseller1_sandbox/Cargo.toml b/gen/reseller1_sandbox/Cargo.toml index 8b1b70954e..25677bef35 100644 --- a/gen/reseller1_sandbox/Cargo.toml +++ b/gen/reseller1_sandbox/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-reseller1_sandbox" -version = "1.0.5+20160329" +version = "1.0.6+20160329" 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" homepage = "https://developers.google.com/google-apps/reseller/" -documentation = "https://docs.rs/google-reseller1_sandbox/1.0.5+20160329" +documentation = "https://docs.rs/google-reseller1_sandbox/1.0.6+20160329" license = "MIT" keywords = ["reseller", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/reseller1_sandbox/README.md b/gen/reseller1_sandbox/README.md index 0aa2d3594a..ebb012b856 100644 --- a/gen/reseller1_sandbox/README.md +++ b/gen/reseller1_sandbox/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20160329*, where *20160329* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *reseller* crate version *1.0.6+20160329*, where *20160329* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *reseller* *v1_sandbox* API can be found at the [official documentation site](https://developers.google.com/google-apps/reseller/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.Reseller.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.Reseller.html) ... -* [customers](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.Customer.html) - * [*get*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.CustomerGetCall.html), [*insert*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.CustomerInsertCall.html), [*patch*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.CustomerPatchCall.html) and [*update*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.CustomerUpdateCall.html) -* [subscriptions](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.Subscription.html) - * [*activate*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionActivateCall.html), [*change plan*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionChangePlanCall.html), [*change renewal settings*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionChangeRenewalSettingCall.html), [*change seats*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionChangeSeatCall.html), [*delete*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionDeleteCall.html), [*get*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionGetCall.html), [*insert*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionInsertCall.html), [*list*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionListCall.html), [*start paid service*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionStartPaidServiceCall.html) and [*suspend*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.SubscriptionSuspendCall.html) +* [customers](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.Customer.html) + * [*get*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.CustomerGetCall.html), [*insert*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.CustomerInsertCall.html), [*patch*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.CustomerPatchCall.html) and [*update*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.CustomerUpdateCall.html) +* [subscriptions](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.Subscription.html) + * [*activate*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionActivateCall.html), [*change plan*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionChangePlanCall.html), [*change renewal settings*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionChangeRenewalSettingCall.html), [*change seats*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionChangeSeatCall.html), [*delete*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionDeleteCall.html), [*get*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionGetCall.html), [*insert*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionInsertCall.html), [*list*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionListCall.html), [*start paid service*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionStartPaidServiceCall.html) and [*suspend*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.SubscriptionSuspendCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/struct.Reseller.html)** +* **[Hub](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/struct.Reseller.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.Part.html)** + * **[Parts](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -132,17 +132,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/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")`. @@ -152,29 +152,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/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](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/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](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.RequestValue.html) and -[decodable](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/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](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.RequestValue.html) and +[decodable](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/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](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/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](https://docs.rs/google-reseller1_sandbox/1.0.5+20160329/google_reseller1_sandbox/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-reseller1_sandbox/1.0.6+20160329/google_reseller1_sandbox/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/reseller1_sandbox/src/lib.rs b/gen/reseller1_sandbox/src/lib.rs index 099ee1a250..d15f04507d 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 *1.0.5+20160329*, where *20160329* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *reseller* crate version *1.0.6+20160329*, where *20160329* is the exact revision of the *reseller:v1sandbox* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *reseller* *v1_sandbox* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/reseller/). @@ -336,7 +336,7 @@ impl<'a, C, A> Reseller Reseller { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/apps/reseller/v1sandbox/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -350,7 +350,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/resourceviews1_beta2-cli/Cargo.toml b/gen/resourceviews1_beta2-cli/Cargo.toml index f5d4d1bc0c..1f8a4cf61e 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 = "1.0.5+20160512" +version = "1.0.6+20160512" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-resourceviews1_beta2] path = "../resourceviews1_beta2" -version = "1.0.5+20160512" +version = "1.0.6+20160512" diff --git a/gen/resourceviews1_beta2-cli/README.md b/gen/resourceviews1_beta2-cli/README.md index 91240a9d80..1d18eb97cd 100644 --- a/gen/resourceviews1_beta2-cli/README.md +++ b/gen/resourceviews1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *resourceviews* API at revision *20160512*. The CLI is at version *1.0.5*. +This documentation was generated from the *resourceviews* API at revision *20160512*. The CLI is at version *1.0.6*. ```bash resourceviews1-beta2 [options] diff --git a/gen/resourceviews1_beta2-cli/mkdocs.yml b/gen/resourceviews1_beta2-cli/mkdocs.yml index 5ff47e427f..b1c470cfcd 100644 --- a/gen/resourceviews1_beta2-cli/mkdocs.yml +++ b/gen/resourceviews1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: resourceviews v1.0.5+20160512 +site_name: resourceviews v1.0.6+20160512 site_url: http://byron.github.io/google-apis-rs/google-resourceviews1_beta2-cli site_description: A complete library to interact with resourceviews (protocol v1beta2) diff --git a/gen/resourceviews1_beta2-cli/src/cmn.rs b/gen/resourceviews1_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/resourceviews1_beta2-cli/src/cmn.rs +++ b/gen/resourceviews1_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/resourceviews1_beta2-cli/src/main.rs b/gen/resourceviews1_beta2-cli/src/main.rs index b429bbfd5a..2a8a800bd5 100644 --- a/gen/resourceviews1_beta2-cli/src/main.rs +++ b/gen/resourceviews1_beta2-cli/src/main.rs @@ -1323,7 +1323,7 @@ fn main() { let mut app = App::new("resourceviews1-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20160512") + .version("1.0.6+20160512") .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") diff --git a/gen/resourceviews1_beta2/Cargo.toml b/gen/resourceviews1_beta2/Cargo.toml index 6240122cc3..a3515b9a45 100644 --- a/gen/resourceviews1_beta2/Cargo.toml +++ b/gen/resourceviews1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-resourceviews1_beta2" -version = "1.0.5+20160512" +version = "1.0.6+20160512" 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" homepage = "https://developers.google.com/compute/" -documentation = "https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512" +documentation = "https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512" license = "MIT" keywords = ["resourceviews", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/resourceviews1_beta2/README.md b/gen/resourceviews1_beta2/README.md index ac7e30c892..e49abae702 100644 --- a/gen/resourceviews1_beta2/README.md +++ b/gen/resourceviews1_beta2/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20160512*, where *20160512* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *resourceviews* crate version *1.0.6+20160512*, where *20160512* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *resourceviews* *v1_beta2* API can be found at the [official documentation site](https://developers.google.com/compute/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.Resourceviews.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.Resourceviews.html) ... * zone operations - * [*get*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneOperationListCall.html) + * [*get*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneOperationGetCall.html) and [*list*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneOperationListCall.html) * zone views - * [*add resources*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewAddResourceCall.html), [*delete*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewDeleteCall.html), [*get*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewGetCall.html), [*get service*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewGetServiceCall.html), [*insert*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewInsertCall.html), [*list*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewListCall.html), [*list resources*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewListResourceCall.html), [*remove resources*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewRemoveResourceCall.html) and [*set service*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.ZoneViewSetServiceCall.html) + * [*add resources*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewAddResourceCall.html), [*delete*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewDeleteCall.html), [*get*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewGetCall.html), [*get service*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewGetServiceCall.html), [*insert*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewInsertCall.html), [*list*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewListCall.html), [*list resources*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewListResourceCall.html), [*remove resources*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewRemoveResourceCall.html) and [*set service*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.ZoneViewSetServiceCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/struct.Resourceviews.html)** +* **[Hub](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/struct.Resourceviews.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -129,17 +129,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_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")`. @@ -149,29 +149,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_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](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_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](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/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](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_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](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_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](https://docs.rs/google-resourceviews1_beta2/1.0.5+20160512/google_resourceviews1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-resourceviews1_beta2/1.0.6+20160512/google_resourceviews1_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. diff --git a/gen/resourceviews1_beta2/src/lib.rs b/gen/resourceviews1_beta2/src/lib.rs index c6217d9f1d..9f4fc80101 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 *1.0.5+20160512*, where *20160512* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *resourceviews* crate version *1.0.6+20160512*, where *20160512* is the exact revision of the *resourceviews:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *resourceviews* *v1_beta2* API can be found at the //! [official documentation site](https://developers.google.com/compute/). @@ -350,7 +350,7 @@ impl<'a, C, A> Resourceviews Resourceviews { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/resourceviews/v1beta2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -364,7 +364,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/safebrowsing4-cli/Cargo.toml b/gen/safebrowsing4-cli/Cargo.toml index 625801d5fd..5b8828e10d 100644 --- a/gen/safebrowsing4-cli/Cargo.toml +++ b/gen/safebrowsing4-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-safebrowsing4-cli" -version = "1.0.5+20170509" +version = "1.0.6+20170509" authors = ["Sebastian Thiel "] description = "A complete library to interact with safebrowsing (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/safebrowsing4-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-safebrowsing4] path = "../safebrowsing4" -version = "1.0.5+20170509" +version = "1.0.6+20170509" diff --git a/gen/safebrowsing4-cli/README.md b/gen/safebrowsing4-cli/README.md index bac6ead53b..3fd0313c66 100644 --- a/gen/safebrowsing4-cli/README.md +++ b/gen/safebrowsing4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *safebrowsing* API at revision *20170509*. The CLI is at version *1.0.5*. +This documentation was generated from the *safebrowsing* API at revision *20170509*. The CLI is at version *1.0.6*. ```bash safebrowsing4 [options] diff --git a/gen/safebrowsing4-cli/mkdocs.yml b/gen/safebrowsing4-cli/mkdocs.yml index f3e12d7eee..7d7d560b15 100644 --- a/gen/safebrowsing4-cli/mkdocs.yml +++ b/gen/safebrowsing4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: safebrowsing v1.0.5+20170509 +site_name: safebrowsing v1.0.6+20170509 site_url: http://byron.github.io/google-apis-rs/google-safebrowsing4-cli site_description: A complete library to interact with safebrowsing (protocol v4) diff --git a/gen/safebrowsing4-cli/src/cmn.rs b/gen/safebrowsing4-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/safebrowsing4-cli/src/cmn.rs +++ b/gen/safebrowsing4-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/safebrowsing4-cli/src/main.rs b/gen/safebrowsing4-cli/src/main.rs index dd81f83cf3..fcfc84a4b4 100644 --- a/gen/safebrowsing4-cli/src/main.rs +++ b/gen/safebrowsing4-cli/src/main.rs @@ -771,7 +771,7 @@ fn main() { let mut app = App::new("safebrowsing4") .author("Sebastian Thiel ") - .version("1.0.5+20170509") + .version("1.0.6+20170509") .about("The Safe Browsing API is an experimental API that allows client applications to check URLs against Google's constantly-updated blacklists of suspected phishing and malware pages. Your client application can use the API to download an encrypted table for local, client-side lookups of URLs.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_safebrowsing4_cli") .arg(Arg::with_name("folder") diff --git a/gen/safebrowsing4/Cargo.toml b/gen/safebrowsing4/Cargo.toml index 889e2369c6..1004607efd 100644 --- a/gen/safebrowsing4/Cargo.toml +++ b/gen/safebrowsing4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-safebrowsing4" -version = "1.0.5+20170509" +version = "1.0.6+20170509" authors = ["Sebastian Thiel "] description = "A complete library to interact with safebrowsing (protocol v4)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/safebrowsing4" homepage = "https://developers.google.com/safe-browsing/" -documentation = "https://docs.rs/google-safebrowsing4/1.0.5+20170509" +documentation = "https://docs.rs/google-safebrowsing4/1.0.6+20170509" license = "MIT" keywords = ["safebrowsing", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/safebrowsing4/README.md b/gen/safebrowsing4/README.md index 433bb6530f..af5c87b3f1 100644 --- a/gen/safebrowsing4/README.md +++ b/gen/safebrowsing4/README.md @@ -5,26 +5,26 @@ DO NOT EDIT ! --> The `google-safebrowsing4` library allows access to all features of the *Google safebrowsing* service. -This documentation was generated from *safebrowsing* crate version *1.0.5+20170509*, where *20170509* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *safebrowsing* crate version *1.0.6+20170509*, where *20170509* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *safebrowsing* *v4* API can be found at the [official documentation site](https://developers.google.com/safe-browsing/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.Safebrowsing.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.Safebrowsing.html) ... * encoded full hashes - * [*get*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.EncodedFullHasheGetCall.html) + * [*get*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.EncodedFullHasheGetCall.html) * encoded updates - * [*get*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.EncodedUpdateGetCall.html) + * [*get*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.EncodedUpdateGetCall.html) * full hashes - * [*find*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.FullHasheFindCall.html) + * [*find*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.FullHasheFindCall.html) * threat list updates - * [*fetch*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.ThreatListUpdateFetchCall.html) + * [*fetch*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.ThreatListUpdateFetchCall.html) * threat lists - * [*list*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.ThreatListListCall.html) + * [*list*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.ThreatListListCall.html) * threat matches - * [*find*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.ThreatMatcheFindCall.html) + * [*find*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.ThreatMatcheFindCall.html) @@ -33,17 +33,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/struct.Safebrowsing.html)** +* **[Hub](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/struct.Safebrowsing.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.Part.html)** + * **[Parts](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -129,17 +129,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/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")`. @@ -149,29 +149,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/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](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/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](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/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](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/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](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/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](https://docs.rs/google-safebrowsing4/1.0.5+20170509/google_safebrowsing4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-safebrowsing4/1.0.6+20170509/google_safebrowsing4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/safebrowsing4/src/lib.rs b/gen/safebrowsing4/src/lib.rs index 8e366b7dc4..c350e24b49 100644 --- a/gen/safebrowsing4/src/lib.rs +++ b/gen/safebrowsing4/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 *safebrowsing* crate version *1.0.5+20170509*, where *20170509* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *safebrowsing* crate version *1.0.6+20170509*, where *20170509* is the exact revision of the *safebrowsing:v4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *safebrowsing* *v4* API can be found at the //! [official documentation site](https://developers.google.com/safe-browsing/). @@ -304,7 +304,7 @@ impl<'a, C, A> Safebrowsing Safebrowsing { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://safebrowsing.googleapis.com/".to_string(), _root_url: "https://safebrowsing.googleapis.com/".to_string(), } @@ -330,7 +330,7 @@ impl<'a, C, A> Safebrowsing } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/searchconsole1-cli/Cargo.toml b/gen/searchconsole1-cli/Cargo.toml index 0eed01a43a..393e92b3ba 100644 --- a/gen/searchconsole1-cli/Cargo.toml +++ b/gen/searchconsole1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-searchconsole1-cli" -version = "1.0.5+20170520" +version = "1.0.6+20170520" authors = ["Sebastian Thiel "] description = "A complete library to interact with Search Console (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/searchconsole1-cli" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-searchconsole1] path = "../searchconsole1" -version = "1.0.5+20170520" +version = "1.0.6+20170520" diff --git a/gen/searchconsole1-cli/README.md b/gen/searchconsole1-cli/README.md index 78a4f04def..8ad626eeda 100644 --- a/gen/searchconsole1-cli/README.md +++ b/gen/searchconsole1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Search Console* API at revision *20170520*. The CLI is at version *1.0.5*. +This documentation was generated from the *Search Console* API at revision *20170520*. The CLI is at version *1.0.6*. ```bash searchconsole1 [options] diff --git a/gen/searchconsole1-cli/mkdocs.yml b/gen/searchconsole1-cli/mkdocs.yml index dda3100489..4af82e4028 100644 --- a/gen/searchconsole1-cli/mkdocs.yml +++ b/gen/searchconsole1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Search Console v1.0.5+20170520 +site_name: Search Console v1.0.6+20170520 site_url: http://byron.github.io/google-apis-rs/google-searchconsole1-cli site_description: A complete library to interact with Search Console (protocol v1) diff --git a/gen/searchconsole1-cli/src/cmn.rs b/gen/searchconsole1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/searchconsole1-cli/src/cmn.rs +++ b/gen/searchconsole1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/searchconsole1-cli/src/main.rs b/gen/searchconsole1-cli/src/main.rs index 182142dc8a..3ef38a623c 100644 --- a/gen/searchconsole1-cli/src/main.rs +++ b/gen/searchconsole1-cli/src/main.rs @@ -260,7 +260,7 @@ fn main() { let mut app = App::new("searchconsole1") .author("Sebastian Thiel ") - .version("1.0.5+20170520") + .version("1.0.6+20170520") .about("Provides tools for running validation tests against single URLs") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_searchconsole1_cli") .arg(Arg::with_name("folder") diff --git a/gen/searchconsole1/Cargo.toml b/gen/searchconsole1/Cargo.toml index 97e7cb7e00..1bf984cad4 100644 --- a/gen/searchconsole1/Cargo.toml +++ b/gen/searchconsole1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-searchconsole1" -version = "1.0.5+20170520" +version = "1.0.6+20170520" authors = ["Sebastian Thiel "] description = "A complete library to interact with Search Console (protocol v1)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/searchconsole1" homepage = "https://developers.google.com/webmaster-tools/search-console-api/" -documentation = "https://docs.rs/google-searchconsole1/1.0.5+20170520" +documentation = "https://docs.rs/google-searchconsole1/1.0.6+20170520" license = "MIT" keywords = ["searchconsole", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/searchconsole1/README.md b/gen/searchconsole1/README.md index b6ce34b904..ba5b3df4f5 100644 --- a/gen/searchconsole1/README.md +++ b/gen/searchconsole1/README.md @@ -5,16 +5,16 @@ DO NOT EDIT ! --> The `google-searchconsole1` library allows access to all features of the *Google Search Console* service. -This documentation was generated from *Search Console* crate version *1.0.5+20170520*, where *20170520* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Search Console* crate version *1.0.6+20170520*, where *20170520* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Search Console* *v1* API can be found at the [official documentation site](https://developers.google.com/webmaster-tools/search-console-api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/struct.SearchConsole.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/struct.SearchConsole.html) ... * url testing tools - * [*mobile friendly test run*](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/struct.UrlTestingToolMobileFriendlyTestRunCall.html) + * [*mobile friendly test run*](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/struct.UrlTestingToolMobileFriendlyTestRunCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/struct.SearchConsole.html)** +* **[Hub](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/struct.SearchConsole.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.Part.html)** + * **[Parts](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -122,17 +122,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/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")`. @@ -142,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](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/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](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/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](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/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](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/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](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/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](https://docs.rs/google-searchconsole1/1.0.5+20170520/google_searchconsole1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-searchconsole1/1.0.6+20170520/google_searchconsole1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/searchconsole1/src/lib.rs b/gen/searchconsole1/src/lib.rs index 4a7660f86f..becf7ffc0f 100644 --- a/gen/searchconsole1/src/lib.rs +++ b/gen/searchconsole1/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 *Search Console* crate version *1.0.5+20170520*, where *20170520* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Search Console* crate version *1.0.6+20170520*, where *20170520* is the exact revision of the *searchconsole:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Search Console* *v1* API can be found at the //! [official documentation site](https://developers.google.com/webmaster-tools/search-console-api/). @@ -301,7 +301,7 @@ impl<'a, C, A> SearchConsole SearchConsole { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://searchconsole.googleapis.com/".to_string(), _root_url: "https://searchconsole.googleapis.com/".to_string(), } @@ -312,7 +312,7 @@ impl<'a, C, A> SearchConsole } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/serviceregistryalpha-cli/Cargo.toml b/gen/serviceregistryalpha-cli/Cargo.toml index bd50ca15e4..c45812d782 100644 --- a/gen/serviceregistryalpha-cli/Cargo.toml +++ b/gen/serviceregistryalpha-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-serviceregistryalpha-cli" -version = "1.0.5+20160401" +version = "1.0.6+20160401" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-serviceregistryalpha] path = "../serviceregistryalpha" -version = "1.0.5+20160401" +version = "1.0.6+20160401" diff --git a/gen/serviceregistryalpha-cli/README.md b/gen/serviceregistryalpha-cli/README.md index 2fded8e237..02eb5cca10 100644 --- a/gen/serviceregistryalpha-cli/README.md +++ b/gen/serviceregistryalpha-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Service Registry* API at revision *20160401*. The CLI is at version *1.0.5*. +This documentation was generated from the *Service Registry* API at revision *20160401*. The CLI is at version *1.0.6*. ```bash serviceregistryalpha [options] diff --git a/gen/serviceregistryalpha-cli/mkdocs.yml b/gen/serviceregistryalpha-cli/mkdocs.yml index 464f015a11..9797f2c3a8 100644 --- a/gen/serviceregistryalpha-cli/mkdocs.yml +++ b/gen/serviceregistryalpha-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Service Registry v1.0.5+20160401 +site_name: Service Registry v1.0.6+20160401 site_url: http://byron.github.io/google-apis-rs/google-serviceregistryalpha-cli site_description: A complete library to interact with Service Registry (protocol alpha) diff --git a/gen/serviceregistryalpha-cli/src/cmn.rs b/gen/serviceregistryalpha-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/serviceregistryalpha-cli/src/cmn.rs +++ b/gen/serviceregistryalpha-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/serviceregistryalpha-cli/src/main.rs b/gen/serviceregistryalpha-cli/src/main.rs index c6f4e1b756..273feb8ea5 100644 --- a/gen/serviceregistryalpha-cli/src/main.rs +++ b/gen/serviceregistryalpha-cli/src/main.rs @@ -975,7 +975,7 @@ fn main() { let mut app = App::new("serviceregistryalpha") .author("Sebastian Thiel ") - .version("1.0.5+20160401") + .version("1.0.6+20160401") .about("Manages service endpoints in Service Registry and provides integration with DNS for service discovery and 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") diff --git a/gen/serviceregistryalpha/Cargo.toml b/gen/serviceregistryalpha/Cargo.toml index 47698578ae..388a01b9dc 100644 --- a/gen/serviceregistryalpha/Cargo.toml +++ b/gen/serviceregistryalpha/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-serviceregistryalpha" -version = "1.0.5+20160401" +version = "1.0.6+20160401" 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 = "https://docs.rs/google-serviceregistryalpha/1.0.5+20160401" +documentation = "https://docs.rs/google-serviceregistryalpha/1.0.6+20160401" license = "MIT" keywords = ["serviceregistry", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/serviceregistryalpha/README.md b/gen/serviceregistryalpha/README.md index e8b986dfd1..0f52d544f1 100644 --- a/gen/serviceregistryalpha/README.md +++ b/gen/serviceregistryalpha/README.md @@ -5,18 +5,18 @@ DO NOT EDIT ! --> The `google-serviceregistryalpha` library allows access to all features of the *Google Service Registry* service. -This documentation was generated from *Service Registry* crate version *1.0.5+20160401*, where *20160401* is the exact revision of the *serviceregistry:alpha* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Service Registry* crate version *1.0.6+20160401*, where *20160401* is the exact revision of the *serviceregistry:alpha* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.ServiceRegistry.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.ServiceRegistry.html) ... -* [endpoints](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.Endpoint.html) - * [*delete*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.EndpointDeleteCall.html), [*get*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.EndpointGetCall.html), [*insert*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.EndpointInsertCall.html), [*list*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.EndpointListCall.html), [*patch*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.EndpointPatchCall.html) and [*update*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.EndpointUpdateCall.html) -* [operations](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.Operation.html) - * [*get*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.OperationListCall.html) +* [endpoints](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.Endpoint.html) + * [*delete*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.EndpointDeleteCall.html), [*get*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.EndpointGetCall.html), [*insert*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.EndpointInsertCall.html), [*list*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.EndpointListCall.html), [*patch*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.EndpointPatchCall.html) and [*update*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.EndpointUpdateCall.html) +* [operations](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.Operation.html) + * [*get*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.OperationListCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/struct.ServiceRegistry.html)** +* **[Hub](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/struct.ServiceRegistry.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.Part.html)** + * **[Parts](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.RequestValue.html) and -[decodable](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/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](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/google_serviceregistryalpha/trait.RequestValue.html) and +[decodable](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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](https://docs.rs/google-serviceregistryalpha/1.0.5+20160401/google_serviceregistryalpha/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-serviceregistryalpha/1.0.6+20160401/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. diff --git a/gen/serviceregistryalpha/src/lib.rs b/gen/serviceregistryalpha/src/lib.rs index a293c05d0b..541b8baea3 100644 --- a/gen/serviceregistryalpha/src/lib.rs +++ b/gen/serviceregistryalpha/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 *Service Registry* crate version *1.0.5+20160401*, where *20160401* is the exact revision of the *serviceregistry:alpha* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Service Registry* crate version *1.0.6+20160401*, where *20160401* is the exact revision of the *serviceregistry:alpha* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Service Registry* *alpha* API can be found at the //! [official documentation site](https://developers.google.com/cloud-serviceregistry/). @@ -338,7 +338,7 @@ impl<'a, C, A> ServiceRegistry ServiceRegistry { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/serviceregistry/alpha/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -352,7 +352,7 @@ impl<'a, C, A> ServiceRegistry } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/siteverification1-cli/Cargo.toml b/gen/siteverification1-cli/Cargo.toml index 2397ca037f..56992e09af 100644 --- a/gen/siteverification1-cli/Cargo.toml +++ b/gen/siteverification1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-siteverification1-cli" -version = "1.0.5+20161114" +version = "1.0.6+20161114" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-siteverification1] path = "../siteverification1" -version = "1.0.5+20161114" +version = "1.0.6+20161114" diff --git a/gen/siteverification1-cli/README.md b/gen/siteverification1-cli/README.md index 22a6408201..4eb5515596 100644 --- a/gen/siteverification1-cli/README.md +++ b/gen/siteverification1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *siteVerification* API at revision *20161114*. The CLI is at version *1.0.5*. +This documentation was generated from the *siteVerification* API at revision *20161114*. The CLI is at version *1.0.6*. ```bash siteverification1 [options] diff --git a/gen/siteverification1-cli/mkdocs.yml b/gen/siteverification1-cli/mkdocs.yml index 81f1c750ac..ecfc8328da 100644 --- a/gen/siteverification1-cli/mkdocs.yml +++ b/gen/siteverification1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: siteVerification v1.0.5+20161114 +site_name: siteVerification v1.0.6+20161114 site_url: http://byron.github.io/google-apis-rs/google-siteverification1-cli site_description: A complete library to interact with siteVerification (protocol v1) diff --git a/gen/siteverification1-cli/src/cmn.rs b/gen/siteverification1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/siteverification1-cli/src/cmn.rs +++ b/gen/siteverification1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/siteverification1-cli/src/main.rs b/gen/siteverification1-cli/src/main.rs index 405ea5af95..ea558ed65b 100644 --- a/gen/siteverification1-cli/src/main.rs +++ b/gen/siteverification1-cli/src/main.rs @@ -828,7 +828,7 @@ fn main() { let mut app = App::new("siteverification1") .author("Sebastian Thiel ") - .version("1.0.5+20161114") + .version("1.0.6+20161114") .about("Verifies 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") diff --git a/gen/siteverification1/Cargo.toml b/gen/siteverification1/Cargo.toml index 958d78c809..422700af5d 100644 --- a/gen/siteverification1/Cargo.toml +++ b/gen/siteverification1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-siteverification1" -version = "1.0.5+20161114" +version = "1.0.6+20161114" 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" homepage = "https://developers.google.com/site-verification/" -documentation = "https://docs.rs/google-siteverification1/1.0.5+20161114" +documentation = "https://docs.rs/google-siteverification1/1.0.6+20161114" license = "MIT" keywords = ["siteVerification", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/siteverification1/README.md b/gen/siteverification1/README.md index 4a680f46d9..4454fd9244 100644 --- a/gen/siteverification1/README.md +++ b/gen/siteverification1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20161114*, where *20161114* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *siteVerification* crate version *1.0.6+20161114*, where *20161114* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *siteVerification* *v1* API can be found at the [official documentation site](https://developers.google.com/site-verification/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.SiteVerification.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.SiteVerification.html) ... * web resource - * [*delete*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourceDeleteCall.html), [*get*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourceGetCall.html), [*get token*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourceGetTokenCall.html), [*insert*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourceInsertCall.html), [*list*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourceListCall.html), [*patch*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourcePatchCall.html) and [*update*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.WebResourceUpdateCall.html) + * [*delete*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourceDeleteCall.html), [*get*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourceGetCall.html), [*get token*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourceGetTokenCall.html), [*insert*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourceInsertCall.html), [*list*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourceListCall.html), [*patch*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourcePatchCall.html) and [*update*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.WebResourceUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/struct.SiteVerification.html)** +* **[Hub](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/struct.SiteVerification.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.Part.html)** + * **[Parts](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -125,17 +125,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/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")`. @@ -145,29 +145,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/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](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/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](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/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](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/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](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/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](https://docs.rs/google-siteverification1/1.0.5+20161114/google_siteverification1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-siteverification1/1.0.6+20161114/google_siteverification1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/siteverification1/src/lib.rs b/gen/siteverification1/src/lib.rs index d04d57b98c..5e342f402a 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 *1.0.5+20161114*, where *20161114* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *siteVerification* crate version *1.0.6+20161114*, where *20161114* is the exact revision of the *siteVerification:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *siteVerification* *v1* API can be found at the //! [official documentation site](https://developers.google.com/site-verification/). @@ -330,7 +330,7 @@ impl<'a, C, A> SiteVerification SiteVerification { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/siteVerification/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -341,7 +341,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/spectrum1_explorer-cli/Cargo.toml b/gen/spectrum1_explorer-cli/Cargo.toml index a6a2fcad12..e2339a23c8 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 = "1.0.5+20170306" +version = "1.0.6+20170306" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-spectrum1_explorer] path = "../spectrum1_explorer" -version = "1.0.5+20170306" +version = "1.0.6+20170306" diff --git a/gen/spectrum1_explorer-cli/README.md b/gen/spectrum1_explorer-cli/README.md index 92af859442..ce1ed4f3af 100644 --- a/gen/spectrum1_explorer-cli/README.md +++ b/gen/spectrum1_explorer-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *spectrum* API at revision *20170306*. The CLI is at version *1.0.5*. +This documentation was generated from the *spectrum* API at revision *20170306*. The CLI is at version *1.0.6*. ```bash spectrum1-explorer [options] diff --git a/gen/spectrum1_explorer-cli/mkdocs.yml b/gen/spectrum1_explorer-cli/mkdocs.yml index ce3421b5a8..589efbe126 100644 --- a/gen/spectrum1_explorer-cli/mkdocs.yml +++ b/gen/spectrum1_explorer-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: spectrum v1.0.5+20170306 +site_name: spectrum v1.0.6+20170306 site_url: http://byron.github.io/google-apis-rs/google-spectrum1_explorer-cli site_description: A complete library to interact with spectrum (protocol v1explorer) diff --git a/gen/spectrum1_explorer-cli/src/cmn.rs b/gen/spectrum1_explorer-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/spectrum1_explorer-cli/src/cmn.rs +++ b/gen/spectrum1_explorer-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/spectrum1_explorer-cli/src/main.rs b/gen/spectrum1_explorer-cli/src/main.rs index 7c9ed86deb..8a810e40d0 100644 --- a/gen/spectrum1_explorer-cli/src/main.rs +++ b/gen/spectrum1_explorer-cli/src/main.rs @@ -961,7 +961,7 @@ fn main() { let mut app = App::new("spectrum1-explorer") .author("Sebastian Thiel ") - .version("1.0.5+20170306") + .version("1.0.6+20170306") .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") diff --git a/gen/spectrum1_explorer/Cargo.toml b/gen/spectrum1_explorer/Cargo.toml index a151cfd3aa..189cb9e756 100644 --- a/gen/spectrum1_explorer/Cargo.toml +++ b/gen/spectrum1_explorer/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-spectrum1_explorer" -version = "1.0.5+20170306" +version = "1.0.6+20170306" 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" homepage = "http://developers.google.com/spectrum" -documentation = "https://docs.rs/google-spectrum1_explorer/1.0.5+20170306" +documentation = "https://docs.rs/google-spectrum1_explorer/1.0.6+20170306" license = "MIT" keywords = ["spectrum", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/spectrum1_explorer/README.md b/gen/spectrum1_explorer/README.md index 80ce027b11..7fba22c40b 100644 --- a/gen/spectrum1_explorer/README.md +++ b/gen/spectrum1_explorer/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20170306*, where *20170306* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *spectrum* crate version *1.0.6+20170306*, where *20170306* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *spectrum* *v1_explorer* API can be found at the [official documentation site](http://developers.google.com/spectrum). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.Spectrum.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.Spectrum.html) ... * paws - * [*get spectrum*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.PawGetSpectrumCall.html), [*get spectrum batch*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.PawGetSpectrumBatchCall.html), [*init*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.PawInitCall.html), [*notify spectrum use*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.PawNotifySpectrumUseCall.html), [*register*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.PawRegisterCall.html) and [*verify device*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.PawVerifyDeviceCall.html) + * [*get spectrum*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.PawGetSpectrumCall.html), [*get spectrum batch*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.PawGetSpectrumBatchCall.html), [*init*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.PawInitCall.html), [*notify spectrum use*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.PawNotifySpectrumUseCall.html), [*register*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.PawRegisterCall.html) and [*verify device*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.PawVerifyDeviceCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/struct.Spectrum.html)** +* **[Hub](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/struct.Spectrum.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.Part.html)** + * **[Parts](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -122,17 +122,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/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")`. @@ -142,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](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/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](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/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](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.RequestValue.html) and -[decodable](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/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](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.RequestValue.html) and +[decodable](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/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](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/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](https://docs.rs/google-spectrum1_explorer/1.0.5+20170306/google_spectrum1_explorer/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-spectrum1_explorer/1.0.6+20170306/google_spectrum1_explorer/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/spectrum1_explorer/src/lib.rs b/gen/spectrum1_explorer/src/lib.rs index 58e622d898..cf65608efd 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 *1.0.5+20170306*, where *20170306* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *spectrum* crate version *1.0.6+20170306*, where *20170306* is the exact revision of the *spectrum:v1explorer* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *spectrum* *v1_explorer* API can be found at the //! [official documentation site](http://developers.google.com/spectrum). @@ -301,7 +301,7 @@ impl<'a, C, A> Spectrum Spectrum { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/spectrum/v1explorer/paws/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -312,7 +312,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/sqladmin1_beta4-cli/Cargo.toml b/gen/sqladmin1_beta4-cli/Cargo.toml index 5b57ca0847..a5e2e8d245 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 = "1.0.5+20170502" +version = "1.0.6+20170502" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-sqladmin1_beta4] path = "../sqladmin1_beta4" -version = "1.0.5+20170502" +version = "1.0.6+20170502" diff --git a/gen/sqladmin1_beta4-cli/README.md b/gen/sqladmin1_beta4-cli/README.md index de7f869b46..fb7762d3a8 100644 --- a/gen/sqladmin1_beta4-cli/README.md +++ b/gen/sqladmin1_beta4-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *SQL Admin* API at revision *20170502*. The CLI is at version *1.0.5*. +This documentation was generated from the *SQL Admin* API at revision *20170502*. The CLI is at version *1.0.6*. ```bash sqladmin1-beta4 [options] diff --git a/gen/sqladmin1_beta4-cli/mkdocs.yml b/gen/sqladmin1_beta4-cli/mkdocs.yml index ceb4f0978a..1b37d484eb 100644 --- a/gen/sqladmin1_beta4-cli/mkdocs.yml +++ b/gen/sqladmin1_beta4-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: SQL Admin v1.0.5+20170502 +site_name: SQL Admin v1.0.6+20170502 site_url: http://byron.github.io/google-apis-rs/google-sqladmin1_beta4-cli site_description: A complete library to interact with SQL Admin (protocol v1beta4) diff --git a/gen/sqladmin1_beta4-cli/src/cmn.rs b/gen/sqladmin1_beta4-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/sqladmin1_beta4-cli/src/cmn.rs +++ b/gen/sqladmin1_beta4-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/sqladmin1_beta4-cli/src/main.rs b/gen/sqladmin1_beta4-cli/src/main.rs index 55dd0b1c0f..d9a83785a7 100644 --- a/gen/sqladmin1_beta4-cli/src/main.rs +++ b/gen/sqladmin1_beta4-cli/src/main.rs @@ -4553,7 +4553,7 @@ fn main() { let mut app = App::new("sqladmin1-beta4") .author("Sebastian Thiel ") - .version("1.0.5+20170502") + .version("1.0.6+20170502") .about("Creates and configures Cloud SQL instances, which provide fully-managed MySQL databases.") .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") diff --git a/gen/sqladmin1_beta4/Cargo.toml b/gen/sqladmin1_beta4/Cargo.toml index 22b93f777c..e20f2fb0f2 100644 --- a/gen/sqladmin1_beta4/Cargo.toml +++ b/gen/sqladmin1_beta4/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-sqladmin1_beta4" -version = "1.0.5+20170502" +version = "1.0.6+20170502" 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" homepage = "https://cloud.google.com/sql/docs/reference/latest" -documentation = "https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502" +documentation = "https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502" license = "MIT" keywords = ["sqladmin", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/sqladmin1_beta4/README.md b/gen/sqladmin1_beta4/README.md index f50de66e49..2aae1dfb22 100644 --- a/gen/sqladmin1_beta4/README.md +++ b/gen/sqladmin1_beta4/README.md @@ -5,30 +5,30 @@ 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 *1.0.5+20170502*, where *20170502* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *SQL Admin* crate version *1.0.6+20170502*, where *20170502* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SQLAdmin.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SQLAdmin.html) ... -* [backup runs](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.BackupRun.html) - * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.BackupRunDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.BackupRunGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.BackupRunInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.BackupRunListCall.html) -* [databases](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.Database.html) - * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.DatabaseDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.DatabaseGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.DatabaseInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.DatabaseListCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.DatabasePatchCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.DatabaseUpdateCall.html) -* [flags](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.Flag.html) - * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.FlagListCall.html) +* [backup runs](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.BackupRun.html) + * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.BackupRunDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.BackupRunGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.BackupRunInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.BackupRunListCall.html) +* [databases](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.Database.html) + * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.DatabaseDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.DatabaseGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.DatabaseInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.DatabaseListCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.DatabasePatchCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.DatabaseUpdateCall.html) +* [flags](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.Flag.html) + * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.FlagListCall.html) * instances - * [*clone*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceCloneCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceDeleteCall.html), [*export*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceExportCall.html), [*failover*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceFailoverCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceGetCall.html), [*import*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceImportCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceListCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstancePatchCall.html), [*promote replica*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstancePromoteReplicaCall.html), [*reset ssl config*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceResetSslConfigCall.html), [*restart*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceRestartCall.html), [*restore backup*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceRestoreBackupCall.html), [*start replica*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceStartReplicaCall.html), [*stop replica*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceStopReplicaCall.html), [*truncate log*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceTruncateLogCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.InstanceUpdateCall.html) -* [operations](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.Operation.html) - * [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.OperationListCall.html) -* [ssl certs](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SslCert.html) - * [*create ephemeral*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SslCertCreateEphemeralCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SslCertDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SslCertGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SslCertInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SslCertListCall.html) -* [tiers](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.Tier.html) - * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.TierListCall.html) -* [users](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.User.html) - * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.UserDeleteCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.UserInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.UserListCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.UserUpdateCall.html) + * [*clone*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceCloneCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceDeleteCall.html), [*export*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceExportCall.html), [*failover*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceFailoverCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceGetCall.html), [*import*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceImportCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceListCall.html), [*patch*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstancePatchCall.html), [*promote replica*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstancePromoteReplicaCall.html), [*reset ssl config*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceResetSslConfigCall.html), [*restart*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceRestartCall.html), [*restore backup*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceRestoreBackupCall.html), [*start replica*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceStartReplicaCall.html), [*stop replica*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceStopReplicaCall.html), [*truncate log*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceTruncateLogCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.InstanceUpdateCall.html) +* [operations](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.Operation.html) + * [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.OperationGetCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.OperationListCall.html) +* [ssl certs](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SslCert.html) + * [*create ephemeral*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SslCertCreateEphemeralCall.html), [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SslCertDeleteCall.html), [*get*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SslCertGetCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SslCertInsertCall.html) and [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SslCertListCall.html) +* [tiers](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.Tier.html) + * [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.TierListCall.html) +* [users](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.User.html) + * [*delete*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.UserDeleteCall.html), [*insert*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.UserInsertCall.html), [*list*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.UserListCall.html) and [*update*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.UserUpdateCall.html) @@ -37,17 +37,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/struct.SQLAdmin.html)** +* **[Hub](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/struct.SQLAdmin.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.Part.html)** + * **[Parts](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -162,17 +162,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/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")`. @@ -182,29 +182,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/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](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/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](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.RequestValue.html) and -[decodable](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/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](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.RequestValue.html) and +[decodable](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/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](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/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](https://docs.rs/google-sqladmin1_beta4/1.0.5+20170502/google_sqladmin1_beta4/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-sqladmin1_beta4/1.0.6+20170502/google_sqladmin1_beta4/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/sqladmin1_beta4/src/lib.rs b/gen/sqladmin1_beta4/src/lib.rs index eeb80e342f..f54af653b9 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 *1.0.5+20170502*, where *20170502* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *SQL Admin* crate version *1.0.6+20170502*, where *20170502* is the exact revision of the *sqladmin:v1beta4* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -367,7 +367,7 @@ impl<'a, C, A> SQLAdmin SQLAdmin { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/sql/v1beta4/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -399,7 +399,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/storage1-cli/Cargo.toml b/gen/storage1-cli/Cargo.toml index d6a5baf2f8..d81b93cb52 100644 --- a/gen/storage1-cli/Cargo.toml +++ b/gen/storage1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storage1-cli" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-storage1] path = "../storage1" -version = "1.0.5+20170504" +version = "1.0.6+20170504" diff --git a/gen/storage1-cli/README.md b/gen/storage1-cli/README.md index 49cde03311..97805f6b43 100644 --- a/gen/storage1-cli/README.md +++ b/gen/storage1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *storage* API at revision *20170504*. The CLI is at version *1.0.5*. +This documentation was generated from the *storage* API at revision *20170504*. The CLI is at version *1.0.6*. ```bash storage1 [options] diff --git a/gen/storage1-cli/mkdocs.yml b/gen/storage1-cli/mkdocs.yml index 3eeb66c231..073df57856 100644 --- a/gen/storage1-cli/mkdocs.yml +++ b/gen/storage1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: storage v1.0.5+20170504 +site_name: storage v1.0.6+20170504 site_url: http://byron.github.io/google-apis-rs/google-storage1-cli site_description: A complete library to interact with storage (protocol v1) diff --git a/gen/storage1-cli/src/cmn.rs b/gen/storage1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/storage1-cli/src/cmn.rs +++ b/gen/storage1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/storage1-cli/src/main.rs b/gen/storage1-cli/src/main.rs index 3f942e425c..77a91cfbed 100644 --- a/gen/storage1-cli/src/main.rs +++ b/gen/storage1-cli/src/main.rs @@ -5671,7 +5671,7 @@ fn main() { let mut app = App::new("storage1") .author("Sebastian Thiel ") - .version("1.0.5+20170504") + .version("1.0.6+20170504") .about("Stores and retrieves 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") diff --git a/gen/storage1/Cargo.toml b/gen/storage1/Cargo.toml index a5defe8aab..ab0331230d 100644 --- a/gen/storage1/Cargo.toml +++ b/gen/storage1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-storage1" -version = "1.0.5+20170504" +version = "1.0.6+20170504" 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" homepage = "https://developers.google.com/storage/docs/json_api/" -documentation = "https://docs.rs/google-storage1/1.0.5+20170504" +documentation = "https://docs.rs/google-storage1/1.0.6+20170504" license = "MIT" keywords = ["storage", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/storage1/README.md b/gen/storage1/README.md index cda20f064b..eec40b3ab4 100644 --- a/gen/storage1/README.md +++ b/gen/storage1/README.md @@ -5,48 +5,48 @@ 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *storage* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *storage* *v1* API can be found at the [official documentation site](https://developers.google.com/storage/docs/json_api/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.Storage.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.Storage.html) ... -* [bucket access controls](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControl.html) - * [*delete*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketAccessControlUpdateCall.html) -* [buckets](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.Bucket.html) - * [*delete*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketPatchCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketTestIamPermissionCall.html) and [*update*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.BucketUpdateCall.html) -* [channels](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.Channel.html) - * [*stop*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ChannelStopCall.html) +* [bucket access controls](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControl.html) + * [*delete*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketAccessControlUpdateCall.html) +* [buckets](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.Bucket.html) + * [*delete*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketPatchCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketTestIamPermissionCall.html) and [*update*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.BucketUpdateCall.html) +* [channels](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.Channel.html) + * [*stop*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ChannelStopCall.html) * default object access controls - * [*delete*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.DefaultObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.DefaultObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.DefaultObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.DefaultObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.DefaultObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.DefaultObjectAccessControlUpdateCall.html) -* [notifications](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.Notification.html) - * [*delete*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.NotificationGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.NotificationInsertCall.html) and [*list*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.NotificationListCall.html) -* [object access controls](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControl.html) - * [*delete*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectAccessControlUpdateCall.html) -* [objects](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.Object.html) - * [*compose*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectComposeCall.html), [*copy*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectCopyCall.html), [*delete*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectPatchCall.html), [*rewrite*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectRewriteCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectTestIamPermissionCall.html), [*update*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectUpdateCall.html) and [*watch all*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectWatchAllCall.html) + * [*delete*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.DefaultObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.DefaultObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.DefaultObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.DefaultObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.DefaultObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.DefaultObjectAccessControlUpdateCall.html) +* [notifications](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.Notification.html) + * [*delete*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.NotificationDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.NotificationGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.NotificationInsertCall.html) and [*list*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.NotificationListCall.html) +* [object access controls](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControl.html) + * [*delete*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControlDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControlGetCall.html), [*insert*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControlInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControlListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControlPatchCall.html) and [*update*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectAccessControlUpdateCall.html) +* [objects](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.Object.html) + * [*compose*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectComposeCall.html), [*copy*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectCopyCall.html), [*delete*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectDeleteCall.html), [*get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectGetCall.html), [*get iam policy*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectGetIamPolicyCall.html), [*insert*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectInsertCall.html), [*list*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectListCall.html), [*patch*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectPatchCall.html), [*rewrite*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectRewriteCall.html), [*set iam policy*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectSetIamPolicyCall.html), [*test iam permissions*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectTestIamPermissionCall.html), [*update*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectUpdateCall.html) and [*watch all*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectWatchAllCall.html) * projects - * [*service account get*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ProjectServiceAccountGetCall.html) + * [*service account get*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ProjectServiceAccountGetCall.html) Upload supported by ... -* [*insert objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectInsertCall.html) +* [*insert objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectInsertCall.html) Download supported by ... -* [*get objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectGetCall.html) -* [*update objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectUpdateCall.html) -* [*insert objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectInsertCall.html) -* [*compose objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectComposeCall.html) -* [*copy objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectCopyCall.html) +* [*get objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectGetCall.html) +* [*update objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectUpdateCall.html) +* [*insert objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectInsertCall.html) +* [*compose objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectComposeCall.html) +* [*copy objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectCopyCall.html) Subscription supported by ... -* [*watch all objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectWatchAllCall.html) -* [*list objects*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.ObjectListCall.html) +* [*watch all objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectWatchAllCall.html) +* [*list objects*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.ObjectListCall.html) @@ -54,17 +54,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/struct.Storage.html)** +* **[Hub](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/struct.Storage.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.Part.html)** + * **[Parts](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -179,17 +179,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/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")`. @@ -199,29 +199,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/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](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/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](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/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](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/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](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/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](https://docs.rs/google-storage1/1.0.5+20170504/google_storage1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-storage1/1.0.6+20170504/google_storage1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/storage1/src/lib.rs b/gen/storage1/src/lib.rs index fb35cd9bcc..6118a7abc5 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 *1.0.5+20170504*, where *20170504* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *storage* crate version *1.0.6+20170504*, where *20170504* is the exact revision of the *storage:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *storage* *v1* API can be found at the //! [official documentation site](https://developers.google.com/storage/docs/json_api/). @@ -410,7 +410,7 @@ impl<'a, C, A> Storage Storage { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/storage/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -442,7 +442,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/storagetransfer1-cli/Cargo.toml b/gen/storagetransfer1-cli/Cargo.toml index 7ee5d1b879..7a64431dfd 100644 --- a/gen/storagetransfer1-cli/Cargo.toml +++ b/gen/storagetransfer1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-storagetransfer1-cli" -version = "1.0.5+20170515" +version = "1.0.6+20170515" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-storagetransfer1] path = "../storagetransfer1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" diff --git a/gen/storagetransfer1-cli/README.md b/gen/storagetransfer1-cli/README.md index ef59fd6e82..ffb86184c2 100644 --- a/gen/storagetransfer1-cli/README.md +++ b/gen/storagetransfer1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *storagetransfer* API at revision *20170515*. The CLI is at version *1.0.5*. +This documentation was generated from the *storagetransfer* API at revision *20170515*. The CLI is at version *1.0.6*. ```bash storagetransfer1 [options] diff --git a/gen/storagetransfer1-cli/mkdocs.yml b/gen/storagetransfer1-cli/mkdocs.yml index 851cd6763c..fab13c60ab 100644 --- a/gen/storagetransfer1-cli/mkdocs.yml +++ b/gen/storagetransfer1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: storagetransfer v1.0.5+20170515 +site_name: storagetransfer v1.0.6+20170515 site_url: http://byron.github.io/google-apis-rs/google-storagetransfer1-cli site_description: A complete library to interact with storagetransfer (protocol v1) diff --git a/gen/storagetransfer1-cli/src/cmn.rs b/gen/storagetransfer1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/storagetransfer1-cli/src/cmn.rs +++ b/gen/storagetransfer1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/storagetransfer1-cli/src/main.rs b/gen/storagetransfer1-cli/src/main.rs index 302ba2084f..7f5c8a7826 100644 --- a/gen/storagetransfer1-cli/src/main.rs +++ b/gen/storagetransfer1-cli/src/main.rs @@ -1268,7 +1268,7 @@ fn main() { let mut app = App::new("storagetransfer1") .author("Sebastian Thiel ") - .version("1.0.5+20170515") + .version("1.0.6+20170515") .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") diff --git a/gen/storagetransfer1/Cargo.toml b/gen/storagetransfer1/Cargo.toml index 2ad0a8fd03..c8d8007544 100644 --- a/gen/storagetransfer1/Cargo.toml +++ b/gen/storagetransfer1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-storagetransfer1" -version = "1.0.5+20170515" +version = "1.0.6+20170515" 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" homepage = "https://cloud.google.com/storage/transfer" -documentation = "https://docs.rs/google-storagetransfer1/1.0.5+20170515" +documentation = "https://docs.rs/google-storagetransfer1/1.0.6+20170515" license = "MIT" keywords = ["storagetransfer", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/storagetransfer1/README.md b/gen/storagetransfer1/README.md index aca8de1adf..ce4a93f729 100644 --- a/gen/storagetransfer1/README.md +++ b/gen/storagetransfer1/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20170515*, where *20170515* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *storagetransfer* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *storagetransfer* *v1* API can be found at the [official documentation site](https://cloud.google.com/storage/transfer). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.Storagetransfer.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.Storagetransfer.html) ... -* [google service accounts](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.GoogleServiceAccount.html) - * [*get*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.GoogleServiceAccountGetCall.html) -* [transfer jobs](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferJob.html) - * [*create*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferJobCreateCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferJobGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferJobListCall.html) and [*patch*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferJobPatchCall.html) -* [transfer operations](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperation.html) - * [*cancel*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperationCancelCall.html), [*delete*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperationDeleteCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperationGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperationListCall.html), [*pause*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperationPauseCall.html) and [*resume*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.TransferOperationResumeCall.html) +* [google service accounts](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.GoogleServiceAccount.html) + * [*get*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.GoogleServiceAccountGetCall.html) +* [transfer jobs](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferJob.html) + * [*create*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferJobCreateCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferJobGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferJobListCall.html) and [*patch*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferJobPatchCall.html) +* [transfer operations](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperation.html) + * [*cancel*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperationCancelCall.html), [*delete*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperationDeleteCall.html), [*get*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperationGetCall.html), [*list*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperationListCall.html), [*pause*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperationPauseCall.html) and [*resume*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.TransferOperationResumeCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/struct.Storagetransfer.html)** +* **[Hub](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/struct.Storagetransfer.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.Part.html)** + * **[Parts](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -128,17 +128,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/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 +148,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/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](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/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](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/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](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/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](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/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](https://docs.rs/google-storagetransfer1/1.0.5+20170515/google_storagetransfer1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-storagetransfer1/1.0.6+20170515/google_storagetransfer1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/storagetransfer1/src/lib.rs b/gen/storagetransfer1/src/lib.rs index 17bba8e450..e46095c81a 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 *1.0.5+20170515*, where *20170515* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *storagetransfer* crate version *1.0.6+20170515*, where *20170515* is the exact revision of the *storagetransfer:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *storagetransfer* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/storage/transfer). @@ -326,7 +326,7 @@ impl<'a, C, A> Storagetransfer Storagetransfer { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://storagetransfer.googleapis.com/".to_string(), _root_url: "https://storagetransfer.googleapis.com/".to_string(), } @@ -343,7 +343,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/surveys2-cli/Cargo.toml b/gen/surveys2-cli/Cargo.toml index 05d811afdc..c56a1e9c9e 100644 --- a/gen/surveys2-cli/Cargo.toml +++ b/gen/surveys2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-surveys2-cli" -version = "1.0.5+20170407" +version = "1.0.6+20170407" authors = ["Sebastian Thiel "] description = "A complete library to interact with Surveys (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/surveys2-cli" @@ -21,9 +21,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -36,4 +36,4 @@ clap = "^2.0" [dependencies.google-surveys2] path = "../surveys2" -version = "1.0.5+20170407" +version = "1.0.6+20170407" diff --git a/gen/surveys2-cli/README.md b/gen/surveys2-cli/README.md index dbaaf6e02c..0f3b10f5fe 100644 --- a/gen/surveys2-cli/README.md +++ b/gen/surveys2-cli/README.md @@ -22,7 +22,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Surveys* API at revision *20170407*. The CLI is at version *1.0.5*. +This documentation was generated from the *Surveys* API at revision *20170407*. The CLI is at version *1.0.6*. ```bash surveys2 [options] diff --git a/gen/surveys2-cli/mkdocs.yml b/gen/surveys2-cli/mkdocs.yml index 13db14cff8..d8b9902691 100644 --- a/gen/surveys2-cli/mkdocs.yml +++ b/gen/surveys2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Surveys v1.0.5+20170407 +site_name: Surveys v1.0.6+20170407 site_url: http://byron.github.io/google-apis-rs/google-surveys2-cli site_description: A complete library to interact with Surveys (protocol v2) diff --git a/gen/surveys2-cli/src/cmn.rs b/gen/surveys2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/surveys2-cli/src/cmn.rs +++ b/gen/surveys2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/surveys2-cli/src/main.rs b/gen/surveys2-cli/src/main.rs index a369bb1701..763ab5961b 100644 --- a/gen/surveys2-cli/src/main.rs +++ b/gen/surveys2-cli/src/main.rs @@ -1266,7 +1266,7 @@ fn main() { let mut app = App::new("surveys2") .author("Sebastian Thiel ") - .version("1.0.5+20170407") + .version("1.0.6+20170407") .about("Creates and conducts surveys, lists the surveys that an authenticated user owns, and retrieves survey results and information about specified surveys.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_surveys2_cli") .arg(Arg::with_name("url") diff --git a/gen/surveys2/Cargo.toml b/gen/surveys2/Cargo.toml index 1d00d93f92..22ed8904c8 100644 --- a/gen/surveys2/Cargo.toml +++ b/gen/surveys2/Cargo.toml @@ -4,11 +4,11 @@ [package] name = "google-surveys2" -version = "1.0.5+20170407" +version = "1.0.6+20170407" authors = ["Sebastian Thiel "] description = "A complete library to interact with Surveys (protocol v2)" repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/surveys2" -documentation = "https://docs.rs/google-surveys2/1.0.5+20170407" +documentation = "https://docs.rs/google-surveys2/1.0.6+20170407" license = "MIT" keywords = ["surveys", "google", "protocol", "web", "api"] @@ -19,9 +19,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/surveys2/README.md b/gen/surveys2/README.md index a0c0ab9a87..276905524a 100644 --- a/gen/surveys2/README.md +++ b/gen/surveys2/README.md @@ -5,22 +5,22 @@ DO NOT EDIT ! --> The `google-surveys2` library allows access to all features of the *Google Surveys* service. -This documentation was generated from *Surveys* crate version *1.0.5+20170407*, where *20170407* is the exact revision of the *surveys:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Surveys* crate version *1.0.6+20170407*, where *20170407* is the exact revision of the *surveys:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.Surveys.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.Surveys.html) ... * mobileapppanels - * [*get*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.MobileapppanelGetCall.html), [*list*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.MobileapppanelListCall.html) and [*update*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.MobileapppanelUpdateCall.html) + * [*get*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.MobileapppanelGetCall.html), [*list*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.MobileapppanelListCall.html) and [*update*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.MobileapppanelUpdateCall.html) * results - * [*get*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.ResultGetCall.html) -* [surveys](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.Survey.html) - * [*delete*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyDeleteCall.html), [*get*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyGetCall.html), [*insert*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyInsertCall.html), [*list*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyListCall.html), [*start*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyStartCall.html), [*stop*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyStopCall.html) and [*update*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.SurveyUpdateCall.html) + * [*get*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.ResultGetCall.html) +* [surveys](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.Survey.html) + * [*delete*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyDeleteCall.html), [*get*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyGetCall.html), [*insert*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyInsertCall.html), [*list*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyListCall.html), [*start*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyStartCall.html), [*stop*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyStopCall.html) and [*update*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.SurveyUpdateCall.html) Download supported by ... -* [*get results*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.ResultGetCall.html) +* [*get results*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.ResultGetCall.html) @@ -28,17 +28,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/struct.Surveys.html)** +* **[Hub](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/struct.Surveys.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.Part.html)** + * **[Parts](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -130,17 +130,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/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")`. @@ -150,29 +150,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/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](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/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](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/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](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/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](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/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](https://docs.rs/google-surveys2/1.0.5+20170407/google_surveys2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-surveys2/1.0.6+20170407/google_surveys2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/surveys2/src/lib.rs b/gen/surveys2/src/lib.rs index 1bff1b8d5a..cca0e0c2c2 100644 --- a/gen/surveys2/src/lib.rs +++ b/gen/surveys2/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 *Surveys* crate version *1.0.5+20170407*, where *20170407* is the exact revision of the *surveys:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Surveys* crate version *1.0.6+20170407*, where *20170407* is the exact revision of the *surveys:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/surveys2). //! # Features //! @@ -336,7 +336,7 @@ impl<'a, C, A> Surveys Surveys { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/surveys/v2/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -353,7 +353,7 @@ impl<'a, C, A> Surveys } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/tagmanager1-cli/Cargo.toml b/gen/tagmanager1-cli/Cargo.toml index c0df7129be..6269210d3c 100644 --- a/gen/tagmanager1-cli/Cargo.toml +++ b/gen/tagmanager1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tagmanager1-cli" -version = "1.0.5+20160310" +version = "1.0.6+20160310" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-tagmanager1] path = "../tagmanager1" -version = "1.0.5+20160310" +version = "1.0.6+20160310" diff --git a/gen/tagmanager1-cli/README.md b/gen/tagmanager1-cli/README.md index 1736995a4e..a05a2b3213 100644 --- a/gen/tagmanager1-cli/README.md +++ b/gen/tagmanager1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *Tag Manager* API at revision *20160310*. The CLI is at version *1.0.5*. +This documentation was generated from the *Tag Manager* API at revision *20160310*. The CLI is at version *1.0.6*. ```bash tagmanager1 [options] diff --git a/gen/tagmanager1-cli/mkdocs.yml b/gen/tagmanager1-cli/mkdocs.yml index 93b4474787..00be16dfd0 100644 --- a/gen/tagmanager1-cli/mkdocs.yml +++ b/gen/tagmanager1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Tag Manager v1.0.5+20160310 +site_name: Tag Manager v1.0.6+20160310 site_url: http://byron.github.io/google-apis-rs/google-tagmanager1-cli site_description: A complete library to interact with Tag Manager (protocol v1) diff --git a/gen/tagmanager1-cli/src/cmn.rs b/gen/tagmanager1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/tagmanager1-cli/src/cmn.rs +++ b/gen/tagmanager1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/tagmanager1-cli/src/main.rs b/gen/tagmanager1-cli/src/main.rs index 0ba9fe31aa..2babb7dcd6 100644 --- a/gen/tagmanager1-cli/src/main.rs +++ b/gen/tagmanager1-cli/src/main.rs @@ -5339,7 +5339,7 @@ fn main() { let mut app = App::new("tagmanager1") .author("Sebastian Thiel ") - .version("1.0.5+20160310") + .version("1.0.6+20160310") .about("Accesses 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") diff --git a/gen/tagmanager1/Cargo.toml b/gen/tagmanager1/Cargo.toml index 38b4e3a91b..aa58ea6749 100644 --- a/gen/tagmanager1/Cargo.toml +++ b/gen/tagmanager1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tagmanager1" -version = "1.0.5+20160310" +version = "1.0.6+20160310" 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" homepage = "https://developers.google.com/tag-manager/api/v1/" -documentation = "https://docs.rs/google-tagmanager1/1.0.5+20160310" +documentation = "https://docs.rs/google-tagmanager1/1.0.6+20160310" license = "MIT" keywords = ["tagmanager", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/tagmanager1/README.md b/gen/tagmanager1/README.md index 5894aa8df4..2712a27f85 100644 --- a/gen/tagmanager1/README.md +++ b/gen/tagmanager1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20160310*, where *20160310* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *Tag Manager* crate version *1.0.6+20160310*, where *20160310* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *Tag Manager* *v1* API can be found at the [official documentation site](https://developers.google.com/tag-manager/api/v1/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.TagManager.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.TagManager.html) ... -* [accounts](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.Account.html) - * [*containers create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerCreateCall.html), [*containers delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerDeleteCall.html), [*containers environments create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerEnvironmentListCall.html), [*containers environments patch*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerEnvironmentPatchCall.html), [*containers environments update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerEnvironmentUpdateCall.html), [*containers folders create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerFolderCreateCall.html), [*containers folders delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerFolderDeleteCall.html), [*containers folders entities list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerFolderEntityListCall.html), [*containers folders get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerFolderGetCall.html), [*containers folders list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerFolderListCall.html), [*containers folders update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerFolderUpdateCall.html), [*containers get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerGetCall.html), [*containers list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerListCall.html), [*containers move_folders update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerMoveFolderUpdateCall.html), [*containers reauthorize_environments update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerReauthorizeEnvironmentUpdateCall.html), [*containers tags create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTagCreateCall.html), [*containers tags delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTagDeleteCall.html), [*containers tags get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTagGetCall.html), [*containers tags list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTagListCall.html), [*containers tags update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTagUpdateCall.html), [*containers triggers create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTriggerCreateCall.html), [*containers triggers delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTriggerDeleteCall.html), [*containers triggers get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTriggerGetCall.html), [*containers triggers list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTriggerListCall.html), [*containers triggers update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerTriggerUpdateCall.html), [*containers update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerUpdateCall.html), [*containers variables create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVariableCreateCall.html), [*containers variables delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVariableDeleteCall.html), [*containers variables get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVariableGetCall.html), [*containers variables list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVariableListCall.html), [*containers variables update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVariableUpdateCall.html), [*containers versions create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionCreateCall.html), [*containers versions delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionGetCall.html), [*containers versions list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionListCall.html), [*containers versions publish*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionPublishCall.html), [*containers versions restore*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionRestoreCall.html), [*containers versions undelete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountContainerVersionUpdateCall.html), [*get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountListCall.html), [*permissions create*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountPermissionCreateCall.html), [*permissions delete*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountPermissionDeleteCall.html), [*permissions get*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountPermissionGetCall.html), [*permissions list*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountPermissionListCall.html), [*permissions update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountPermissionUpdateCall.html) and [*update*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.AccountUpdateCall.html) +* [accounts](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.Account.html) + * [*containers create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerCreateCall.html), [*containers delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerDeleteCall.html), [*containers environments create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerEnvironmentCreateCall.html), [*containers environments delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerEnvironmentDeleteCall.html), [*containers environments get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerEnvironmentGetCall.html), [*containers environments list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerEnvironmentListCall.html), [*containers environments patch*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerEnvironmentPatchCall.html), [*containers environments update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerEnvironmentUpdateCall.html), [*containers folders create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerFolderCreateCall.html), [*containers folders delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerFolderDeleteCall.html), [*containers folders entities list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerFolderEntityListCall.html), [*containers folders get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerFolderGetCall.html), [*containers folders list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerFolderListCall.html), [*containers folders update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerFolderUpdateCall.html), [*containers get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerGetCall.html), [*containers list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerListCall.html), [*containers move_folders update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerMoveFolderUpdateCall.html), [*containers reauthorize_environments update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerReauthorizeEnvironmentUpdateCall.html), [*containers tags create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTagCreateCall.html), [*containers tags delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTagDeleteCall.html), [*containers tags get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTagGetCall.html), [*containers tags list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTagListCall.html), [*containers tags update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTagUpdateCall.html), [*containers triggers create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTriggerCreateCall.html), [*containers triggers delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTriggerDeleteCall.html), [*containers triggers get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTriggerGetCall.html), [*containers triggers list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTriggerListCall.html), [*containers triggers update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerTriggerUpdateCall.html), [*containers update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerUpdateCall.html), [*containers variables create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVariableCreateCall.html), [*containers variables delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVariableDeleteCall.html), [*containers variables get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVariableGetCall.html), [*containers variables list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVariableListCall.html), [*containers variables update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVariableUpdateCall.html), [*containers versions create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionCreateCall.html), [*containers versions delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionDeleteCall.html), [*containers versions get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionGetCall.html), [*containers versions list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionListCall.html), [*containers versions publish*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionPublishCall.html), [*containers versions restore*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionRestoreCall.html), [*containers versions undelete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionUndeleteCall.html), [*containers versions update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountContainerVersionUpdateCall.html), [*get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountGetCall.html), [*list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountListCall.html), [*permissions create*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountPermissionCreateCall.html), [*permissions delete*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountPermissionDeleteCall.html), [*permissions get*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountPermissionGetCall.html), [*permissions list*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountPermissionListCall.html), [*permissions update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountPermissionUpdateCall.html) and [*update*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.AccountUpdateCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/struct.TagManager.html)** +* **[Hub](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/struct.TagManager.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.Part.html)** + * **[Parts](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -174,17 +174,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/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")`. @@ -194,29 +194,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/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](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/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](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/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](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/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](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/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](https://docs.rs/google-tagmanager1/1.0.5+20160310/google_tagmanager1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tagmanager1/1.0.6+20160310/google_tagmanager1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tagmanager1/src/lib.rs b/gen/tagmanager1/src/lib.rs index 050f3ce8d8..89f05fbd39 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 *1.0.5+20160310*, where *20160310* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *Tag Manager* crate version *1.0.6+20160310*, where *20160310* is the exact revision of the *tagmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *Tag Manager* *v1* API can be found at the //! [official documentation site](https://developers.google.com/tag-manager/api/v1/). @@ -402,7 +402,7 @@ impl<'a, C, A> TagManager TagManager { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/tagmanager/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -413,7 +413,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/taskqueue1_beta2-cli/Cargo.toml b/gen/taskqueue1_beta2-cli/Cargo.toml index ded4665f4a..c9e6fcd480 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 = "1.0.5+20160428" +version = "1.0.6+20160428" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-taskqueue1_beta2] path = "../taskqueue1_beta2" -version = "1.0.5+20160428" +version = "1.0.6+20160428" diff --git a/gen/taskqueue1_beta2-cli/README.md b/gen/taskqueue1_beta2-cli/README.md index e691578334..71490deb77 100644 --- a/gen/taskqueue1_beta2-cli/README.md +++ b/gen/taskqueue1_beta2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *taskqueue* API at revision *20160428*. The CLI is at version *1.0.5*. +This documentation was generated from the *taskqueue* API at revision *20160428*. The CLI is at version *1.0.6*. ```bash taskqueue1-beta2 [options] diff --git a/gen/taskqueue1_beta2-cli/mkdocs.yml b/gen/taskqueue1_beta2-cli/mkdocs.yml index a0bc43e05d..259df5d376 100644 --- a/gen/taskqueue1_beta2-cli/mkdocs.yml +++ b/gen/taskqueue1_beta2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: taskqueue v1.0.5+20160428 +site_name: taskqueue v1.0.6+20160428 site_url: http://byron.github.io/google-apis-rs/google-taskqueue1_beta2-cli site_description: A complete library to interact with taskqueue (protocol v1beta2) diff --git a/gen/taskqueue1_beta2-cli/src/cmn.rs b/gen/taskqueue1_beta2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/taskqueue1_beta2-cli/src/cmn.rs +++ b/gen/taskqueue1_beta2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/taskqueue1_beta2-cli/src/main.rs b/gen/taskqueue1_beta2-cli/src/main.rs index 48303202f0..ba88b6cfbf 100644 --- a/gen/taskqueue1_beta2-cli/src/main.rs +++ b/gen/taskqueue1_beta2-cli/src/main.rs @@ -1010,7 +1010,7 @@ fn main() { let mut app = App::new("taskqueue1-beta2") .author("Sebastian Thiel ") - .version("1.0.5+20160428") + .version("1.0.6+20160428") .about("Accesses 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") diff --git a/gen/taskqueue1_beta2/Cargo.toml b/gen/taskqueue1_beta2/Cargo.toml index 9dfc55182c..ec3947163d 100644 --- a/gen/taskqueue1_beta2/Cargo.toml +++ b/gen/taskqueue1_beta2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-taskqueue1_beta2" -version = "1.0.5+20160428" +version = "1.0.6+20160428" 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" homepage = "https://developers.google.com/appengine/docs/python/taskqueue/rest" -documentation = "https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428" +documentation = "https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428" license = "MIT" keywords = ["taskqueue", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/taskqueue1_beta2/README.md b/gen/taskqueue1_beta2/README.md index 71d95801e7..9b74ba2bb7 100644 --- a/gen/taskqueue1_beta2/README.md +++ b/gen/taskqueue1_beta2/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20160428*, where *20160428* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *taskqueue* crate version *1.0.6+20160428*, where *20160428* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. 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). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.Taskqueue.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.Taskqueue.html) ... * taskqueues - * [*get*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskqueueGetCall.html) -* [tasks](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.Task.html) - * [*delete*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskGetCall.html), [*insert*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskInsertCall.html), [*lease*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskLeaseCall.html), [*list*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskListCall.html), [*patch*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskPatchCall.html) and [*update*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.TaskUpdateCall.html) + * [*get*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskqueueGetCall.html) +* [tasks](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.Task.html) + * [*delete*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskGetCall.html), [*insert*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskInsertCall.html), [*lease*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskLeaseCall.html), [*list*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskListCall.html), [*patch*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskPatchCall.html) and [*update*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.TaskUpdateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/struct.Taskqueue.html)** +* **[Hub](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/struct.Taskqueue.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.Part.html)** + * **[Parts](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -126,17 +126,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_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")`. @@ -146,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](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_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](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_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](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/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](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_beta2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_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](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_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](https://docs.rs/google-taskqueue1_beta2/1.0.5+20160428/google_taskqueue1_beta2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-taskqueue1_beta2/1.0.6+20160428/google_taskqueue1_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. diff --git a/gen/taskqueue1_beta2/src/lib.rs b/gen/taskqueue1_beta2/src/lib.rs index 1f88ea13e4..4d62c3be2c 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 *1.0.5+20160428*, where *20160428* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *taskqueue* crate version *1.0.6+20160428*, where *20160428* is the exact revision of the *taskqueue:v1beta2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! 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). @@ -327,7 +327,7 @@ impl<'a, C, A> Taskqueue Taskqueue { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/taskqueue/v1beta2/projects/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -341,7 +341,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/tasks1-cli/Cargo.toml b/gen/tasks1-cli/Cargo.toml index 1ff89db8f1..b186ae4837 100644 --- a/gen/tasks1-cli/Cargo.toml +++ b/gen/tasks1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-tasks1-cli" -version = "1.0.5+20141121" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-tasks1] path = "../tasks1" -version = "1.0.5+20141121" +version = "1.0.6+20141121" diff --git a/gen/tasks1-cli/README.md b/gen/tasks1-cli/README.md index dbb8b6859f..538ad94244 100644 --- a/gen/tasks1-cli/README.md +++ b/gen/tasks1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *tasks* API at revision *20141121*. The CLI is at version *1.0.5*. +This documentation was generated from the *tasks* API at revision *20141121*. The CLI is at version *1.0.6*. ```bash tasks1 [options] diff --git a/gen/tasks1-cli/mkdocs.yml b/gen/tasks1-cli/mkdocs.yml index bf1e3e415a..a532333ad1 100644 --- a/gen/tasks1-cli/mkdocs.yml +++ b/gen/tasks1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: tasks v1.0.5+20141121 +site_name: tasks v1.0.6+20141121 site_url: http://byron.github.io/google-apis-rs/google-tasks1-cli site_description: A complete library to interact with tasks (protocol v1) diff --git a/gen/tasks1-cli/src/cmn.rs b/gen/tasks1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/tasks1-cli/src/cmn.rs +++ b/gen/tasks1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/tasks1-cli/src/main.rs b/gen/tasks1-cli/src/main.rs index 504f9ddd1d..c65941e239 100644 --- a/gen/tasks1-cli/src/main.rs +++ b/gen/tasks1-cli/src/main.rs @@ -1553,7 +1553,7 @@ fn main() { let mut app = App::new("tasks1") .author("Sebastian Thiel ") - .version("1.0.5+20141121") + .version("1.0.6+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") diff --git a/gen/tasks1/Cargo.toml b/gen/tasks1/Cargo.toml index b2536e86f1..47de688d19 100644 --- a/gen/tasks1/Cargo.toml +++ b/gen/tasks1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-tasks1" -version = "1.0.5+20141121" +version = "1.0.6+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" homepage = "https://developers.google.com/google-apps/tasks/firstapp" -documentation = "https://docs.rs/google-tasks1/1.0.5+20141121" +documentation = "https://docs.rs/google-tasks1/1.0.6+20141121" license = "MIT" keywords = ["tasks", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/tasks1/README.md b/gen/tasks1/README.md index 5a80f441cf..67549ea9b0 100644 --- a/gen/tasks1/README.md +++ b/gen/tasks1/README.md @@ -5,18 +5,18 @@ 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 *1.0.5+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *tasks* crate version *1.0.6+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *tasks* *v1* API can be found at the [official documentation site](https://developers.google.com/google-apps/tasks/firstapp). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasksHub.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasksHub.html) ... * tasklists - * [*delete*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasklistDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasklistGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasklistInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasklistListCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasklistPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasklistUpdateCall.html) -* [tasks](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.Task.html) - * [*clear*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskClearCall.html), [*delete*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskListCall.html), [*move*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskMoveCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TaskUpdateCall.html) + * [*delete*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasklistDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasklistGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasklistInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasklistListCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasklistPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasklistUpdateCall.html) +* [tasks](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.Task.html) + * [*clear*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskClearCall.html), [*delete*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskDeleteCall.html), [*get*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskGetCall.html), [*insert*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskInsertCall.html), [*list*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskListCall.html), [*move*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskMoveCall.html), [*patch*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskPatchCall.html) and [*update*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TaskUpdateCall.html) @@ -25,17 +25,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/struct.TasksHub.html)** +* **[Hub](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/struct.TasksHub.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.Part.html)** + * **[Parts](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/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")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/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](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/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](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/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](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/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](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/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](https://docs.rs/google-tasks1/1.0.5+20141121/google_tasks1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-tasks1/1.0.6+20141121/google_tasks1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/tasks1/src/lib.rs b/gen/tasks1/src/lib.rs index 1978e0d8f1..5c75c0209e 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 *1.0.5+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *tasks* crate version *1.0.6+20141121*, where *20141121* is the exact revision of the *tasks:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *tasks* *v1* API can be found at the //! [official documentation site](https://developers.google.com/google-apps/tasks/firstapp). @@ -344,7 +344,7 @@ impl<'a, C, A> TasksHub TasksHub { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/tasks/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -358,7 +358,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/translate2-cli/Cargo.toml b/gen/translate2-cli/Cargo.toml index e9cf6af2cd..41d98dc714 100644 --- a/gen/translate2-cli/Cargo.toml +++ b/gen/translate2-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-translate2-cli" -version = "1.0.5+20160627" +version = "1.0.6+20160627" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-translate2] path = "../translate2" -version = "1.0.5+20160627" +version = "1.0.6+20160627" diff --git a/gen/translate2-cli/README.md b/gen/translate2-cli/README.md index 980026041d..f59b368596 100644 --- a/gen/translate2-cli/README.md +++ b/gen/translate2-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *translate* API at revision *20160627*. The CLI is at version *1.0.5*. +This documentation was generated from the *translate* API at revision *20160627*. The CLI is at version *1.0.6*. ```bash translate2 [options] diff --git a/gen/translate2-cli/mkdocs.yml b/gen/translate2-cli/mkdocs.yml index 0566876114..8b91bf65b9 100644 --- a/gen/translate2-cli/mkdocs.yml +++ b/gen/translate2-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: translate v1.0.5+20160627 +site_name: translate v1.0.6+20160627 site_url: http://byron.github.io/google-apis-rs/google-translate2-cli site_description: A complete library to interact with translate (protocol v2) diff --git a/gen/translate2-cli/src/cmn.rs b/gen/translate2-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/translate2-cli/src/cmn.rs +++ b/gen/translate2-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/translate2-cli/src/main.rs b/gen/translate2-cli/src/main.rs index 32ec32e9e3..79dfaa77d5 100644 --- a/gen/translate2-cli/src/main.rs +++ b/gen/translate2-cli/src/main.rs @@ -406,7 +406,7 @@ fn main() { let mut app = App::new("translate2") .author("Sebastian Thiel ") - .version("1.0.5+20160627") + .version("1.0.6+20160627") .about("Translates 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") diff --git a/gen/translate2/Cargo.toml b/gen/translate2/Cargo.toml index 891c7084fa..6a9697883d 100644 --- a/gen/translate2/Cargo.toml +++ b/gen/translate2/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-translate2" -version = "1.0.5+20160627" +version = "1.0.6+20160627" 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" homepage = "https://developers.google.com/translate/v2/using_rest" -documentation = "https://docs.rs/google-translate2/1.0.5+20160627" +documentation = "https://docs.rs/google-translate2/1.0.6+20160627" license = "MIT" keywords = ["translate", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/translate2/README.md b/gen/translate2/README.md index 11a4717e44..9ff8b3ceed 100644 --- a/gen/translate2/README.md +++ b/gen/translate2/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20160627*, where *20160627* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *translate* crate version *1.0.6+20160627*, where *20160627* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *translate* *v2* API can be found at the [official documentation site](https://developers.google.com/translate/v2/using_rest). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/struct.Translate.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/struct.Translate.html) ... * detections - * [*list*](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/struct.DetectionListCall.html) + * [*list*](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/struct.DetectionListCall.html) * languages - * [*list*](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/struct.LanguageListCall.html) + * [*list*](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/struct.LanguageListCall.html) * translations - * [*list*](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/struct.TranslationListCall.html) + * [*list*](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/struct.TranslationListCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/struct.Translate.html)** +* **[Hub](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/struct.Translate.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.Part.html)** + * **[Parts](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -120,17 +120,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/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")`. @@ -140,29 +140,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/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](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/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](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.RequestValue.html) and -[decodable](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/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](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.RequestValue.html) and +[decodable](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/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](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/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](https://docs.rs/google-translate2/1.0.5+20160627/google_translate2/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-translate2/1.0.6+20160627/google_translate2/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/translate2/src/lib.rs b/gen/translate2/src/lib.rs index 1351a3ee29..dec066a732 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 *1.0.5+20160627*, where *20160627* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *translate* crate version *1.0.6+20160627*, where *20160627* is the exact revision of the *translate:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *translate* *v2* API can be found at the //! [official documentation site](https://developers.google.com/translate/v2/using_rest). @@ -293,7 +293,7 @@ impl<'a, C, A> Translate Translate { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/language/translate/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -310,7 +310,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/urlshortener1-cli/Cargo.toml b/gen/urlshortener1-cli/Cargo.toml index aede498676..6e0d2d83a6 100644 --- a/gen/urlshortener1-cli/Cargo.toml +++ b/gen/urlshortener1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-urlshortener1-cli" -version = "1.0.5+20150519" +version = "1.0.6+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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-urlshortener1] path = "../urlshortener1" -version = "1.0.5+20150519" +version = "1.0.6+20150519" diff --git a/gen/urlshortener1-cli/README.md b/gen/urlshortener1-cli/README.md index 66d11bf224..7c336d2217 100644 --- a/gen/urlshortener1-cli/README.md +++ b/gen/urlshortener1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *urlshortener* API at revision *20150519*. The CLI is at version *1.0.5*. +This documentation was generated from the *urlshortener* API at revision *20150519*. The CLI is at version *1.0.6*. ```bash urlshortener1 [options] diff --git a/gen/urlshortener1-cli/mkdocs.yml b/gen/urlshortener1-cli/mkdocs.yml index e5ca7da391..a403dadce0 100644 --- a/gen/urlshortener1-cli/mkdocs.yml +++ b/gen/urlshortener1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: urlshortener v1.0.5+20150519 +site_name: urlshortener v1.0.6+20150519 site_url: http://byron.github.io/google-apis-rs/google-urlshortener1-cli site_description: A complete library to interact with urlshortener (protocol v1) diff --git a/gen/urlshortener1-cli/src/cmn.rs b/gen/urlshortener1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/urlshortener1-cli/src/cmn.rs +++ b/gen/urlshortener1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/urlshortener1-cli/src/main.rs b/gen/urlshortener1-cli/src/main.rs index f10b72f3bb..31993f62eb 100644 --- a/gen/urlshortener1-cli/src/main.rs +++ b/gen/urlshortener1-cli/src/main.rs @@ -431,7 +431,7 @@ fn main() { let mut app = App::new("urlshortener1") .author("Sebastian Thiel ") - .version("1.0.5+20150519") + .version("1.0.6+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") diff --git a/gen/urlshortener1/Cargo.toml b/gen/urlshortener1/Cargo.toml index 344591366e..f69cba03e6 100644 --- a/gen/urlshortener1/Cargo.toml +++ b/gen/urlshortener1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-urlshortener1" -version = "1.0.5+20150519" +version = "1.0.6+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" homepage = "https://developers.google.com/url-shortener/v1/getting_started" -documentation = "https://docs.rs/google-urlshortener1/1.0.5+20150519" +documentation = "https://docs.rs/google-urlshortener1/1.0.6+20150519" license = "MIT" keywords = ["urlshortener", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/urlshortener1/README.md b/gen/urlshortener1/README.md index 36bc750eab..32c3118f6e 100644 --- a/gen/urlshortener1/README.md +++ b/gen/urlshortener1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *urlshortener* crate version *1.0.6+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *urlshortener* *v1* API can be found at the [official documentation site](https://developers.google.com/url-shortener/v1/getting_started). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/struct.Urlshortener.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/struct.Urlshortener.html) ... -* [url](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/struct.Url.html) - * [*get*](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/struct.UrlGetCall.html), [*insert*](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/struct.UrlInsertCall.html) and [*list*](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/struct.UrlListCall.html) +* [url](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/struct.Url.html) + * [*get*](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/struct.UrlGetCall.html), [*insert*](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/struct.UrlInsertCall.html) and [*list*](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/struct.UrlListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/struct.Urlshortener.html)** +* **[Hub](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/struct.Urlshortener.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.Part.html)** + * **[Parts](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -118,17 +118,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/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")`. @@ -138,29 +138,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/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](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/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](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/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](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/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](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/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](https://docs.rs/google-urlshortener1/1.0.5+20150519/google_urlshortener1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-urlshortener1/1.0.6+20150519/google_urlshortener1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/urlshortener1/src/lib.rs b/gen/urlshortener1/src/lib.rs index c5c51d0995..131d869154 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 *1.0.5+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *urlshortener* crate version *1.0.6+20150519*, where *20150519* is the exact revision of the *urlshortener:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *urlshortener* *v1* API can be found at the //! [official documentation site](https://developers.google.com/url-shortener/v1/getting_started). @@ -314,7 +314,7 @@ impl<'a, C, A> Urlshortener Urlshortener { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/urlshortener/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -325,7 +325,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/webfonts1-cli/Cargo.toml b/gen/webfonts1-cli/Cargo.toml index 8e91ea8917..f4aa3d2a94 100644 --- a/gen/webfonts1-cli/Cargo.toml +++ b/gen/webfonts1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-webfonts1-cli" -version = "1.0.5+20160302" +version = "1.0.6+20160302" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-webfonts1] path = "../webfonts1" -version = "1.0.5+20160302" +version = "1.0.6+20160302" diff --git a/gen/webfonts1-cli/README.md b/gen/webfonts1-cli/README.md index 2cb33474ea..7b6b6f513e 100644 --- a/gen/webfonts1-cli/README.md +++ b/gen/webfonts1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *webfonts* API at revision *20160302*. The CLI is at version *1.0.5*. +This documentation was generated from the *webfonts* API at revision *20160302*. The CLI is at version *1.0.6*. ```bash webfonts1 [options] diff --git a/gen/webfonts1-cli/mkdocs.yml b/gen/webfonts1-cli/mkdocs.yml index efa0a673b0..858c0381b7 100644 --- a/gen/webfonts1-cli/mkdocs.yml +++ b/gen/webfonts1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: webfonts v1.0.5+20160302 +site_name: webfonts v1.0.6+20160302 site_url: http://byron.github.io/google-apis-rs/google-webfonts1-cli site_description: A complete library to interact with webfonts (protocol v1) diff --git a/gen/webfonts1-cli/src/cmn.rs b/gen/webfonts1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/webfonts1-cli/src/cmn.rs +++ b/gen/webfonts1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/webfonts1-cli/src/main.rs b/gen/webfonts1-cli/src/main.rs index 42c2ed5cef..1dbe8aa77f 100644 --- a/gen/webfonts1-cli/src/main.rs +++ b/gen/webfonts1-cli/src/main.rs @@ -220,7 +220,7 @@ fn main() { let mut app = App::new("webfonts1") .author("Sebastian Thiel ") - .version("1.0.5+20160302") + .version("1.0.6+20160302") .about("Accesses the metadata for all families served by Google Fonts, providing a list of families currently available (including available styles and a list of supported script subsets).") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_webfonts1_cli") .arg(Arg::with_name("folder") diff --git a/gen/webfonts1/Cargo.toml b/gen/webfonts1/Cargo.toml index 793949dab8..b307f05f69 100644 --- a/gen/webfonts1/Cargo.toml +++ b/gen/webfonts1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-webfonts1" -version = "1.0.5+20160302" +version = "1.0.6+20160302" 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" homepage = "https://developers.google.com/fonts/docs/developer_api" -documentation = "https://docs.rs/google-webfonts1/1.0.5+20160302" +documentation = "https://docs.rs/google-webfonts1/1.0.6+20160302" license = "MIT" keywords = ["webfonts", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/webfonts1/README.md b/gen/webfonts1/README.md index 60bb976d0d..456456018c 100644 --- a/gen/webfonts1/README.md +++ b/gen/webfonts1/README.md @@ -5,16 +5,16 @@ 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 *1.0.5+20160302*, where *20160302* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *webfonts* crate version *1.0.6+20160302*, where *20160302* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *webfonts* *v1* API can be found at the [official documentation site](https://developers.google.com/fonts/docs/developer_api). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/struct.Webfonts.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/struct.Webfonts.html) ... -* [webfonts](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/struct.Webfont.html) - * [*list*](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/struct.WebfontListCall.html) +* [webfonts](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/struct.Webfont.html) + * [*list*](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/struct.WebfontListCall.html) @@ -23,17 +23,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/struct.Webfonts.html)** +* **[Hub](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/struct.Webfonts.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.Part.html)** + * **[Parts](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -117,17 +117,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/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")`. @@ -137,29 +137,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/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](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/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](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/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](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/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](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/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](https://docs.rs/google-webfonts1/1.0.5+20160302/google_webfonts1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-webfonts1/1.0.6+20160302/google_webfonts1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/webfonts1/src/lib.rs b/gen/webfonts1/src/lib.rs index 59fb73608e..a54cb4182c 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 *1.0.5+20160302*, where *20160302* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *webfonts* crate version *1.0.6+20160302*, where *20160302* is the exact revision of the *webfonts:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *webfonts* *v1* API can be found at the //! [official documentation site](https://developers.google.com/fonts/docs/developer_api). @@ -291,7 +291,7 @@ impl<'a, C, A> Webfonts Webfonts { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/webfonts/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -302,7 +302,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/webmasters3-cli/Cargo.toml b/gen/webmasters3-cli/Cargo.toml index 3d7360a864..59d1e94d7a 100644 --- a/gen/webmasters3-cli/Cargo.toml +++ b/gen/webmasters3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-webmasters3-cli" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-webmasters3] path = "../webmasters3" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/webmasters3-cli/README.md b/gen/webmasters3-cli/README.md index 9379557247..12461b236e 100644 --- a/gen/webmasters3-cli/README.md +++ b/gen/webmasters3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *webmasters* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *webmasters* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash webmasters3 [options] diff --git a/gen/webmasters3-cli/mkdocs.yml b/gen/webmasters3-cli/mkdocs.yml index 86bc138682..04e8f9fa7d 100644 --- a/gen/webmasters3-cli/mkdocs.yml +++ b/gen/webmasters3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: webmasters v1.0.5+20170517 +site_name: webmasters v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-webmasters3-cli site_description: A complete library to interact with webmasters (protocol v3) diff --git a/gen/webmasters3-cli/src/cmn.rs b/gen/webmasters3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/webmasters3-cli/src/cmn.rs +++ b/gen/webmasters3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/webmasters3-cli/src/main.rs b/gen/webmasters3-cli/src/main.rs index 268fa3fb9b..a06b3f56a7 100644 --- a/gen/webmasters3-cli/src/main.rs +++ b/gen/webmasters3-cli/src/main.rs @@ -1244,7 +1244,7 @@ fn main() { let mut app = App::new("webmasters3") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .about("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") diff --git a/gen/webmasters3/Cargo.toml b/gen/webmasters3/Cargo.toml index f3f117948d..0c21fd3777 100644 --- a/gen/webmasters3/Cargo.toml +++ b/gen/webmasters3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-webmasters3" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" homepage = "https://developers.google.com/webmaster-tools/" -documentation = "https://docs.rs/google-webmasters3/1.0.5+20170517" +documentation = "https://docs.rs/google-webmasters3/1.0.6+20170517" license = "MIT" keywords = ["webmasters", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/webmasters3/README.md b/gen/webmasters3/README.md index accd5539f7..76421ef1bb 100644 --- a/gen/webmasters3/README.md +++ b/gen/webmasters3/README.md @@ -5,24 +5,24 @@ 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *webmasters* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *webmasters* *v3* API can be found at the [official documentation site](https://developers.google.com/webmaster-tools/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.Webmasters.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.Webmasters.html) ... * searchanalytics - * [*query*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SearchanalyticQueryCall.html) + * [*query*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SearchanalyticQueryCall.html) * sitemaps - * [*delete*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SitemapDeleteCall.html), [*get*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SitemapGetCall.html), [*list*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SitemapListCall.html) and [*submit*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SitemapSubmitCall.html) + * [*delete*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SitemapDeleteCall.html), [*get*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SitemapGetCall.html), [*list*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SitemapListCall.html) and [*submit*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SitemapSubmitCall.html) * sites - * [*add*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SiteAddCall.html), [*delete*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SiteDeleteCall.html), [*get*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SiteGetCall.html) and [*list*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.SiteListCall.html) + * [*add*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SiteAddCall.html), [*delete*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SiteDeleteCall.html), [*get*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SiteGetCall.html) and [*list*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.SiteListCall.html) * urlcrawlerrorscounts - * [*query*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.UrlcrawlerrorscountQueryCall.html) + * [*query*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.UrlcrawlerrorscountQueryCall.html) * urlcrawlerrorssamples - * [*get*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.UrlcrawlerrorssampleGetCall.html), [*list*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.UrlcrawlerrorssampleListCall.html) and [*mark as fixed*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.UrlcrawlerrorssampleMarkAsFixedCall.html) + * [*get*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.UrlcrawlerrorssampleGetCall.html), [*list*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.UrlcrawlerrorssampleListCall.html) and [*mark as fixed*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.UrlcrawlerrorssampleMarkAsFixedCall.html) @@ -31,17 +31,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/struct.Webmasters.html)** +* **[Hub](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/struct.Webmasters.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.Part.html)** + * **[Parts](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -124,17 +124,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/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")`. @@ -144,29 +144,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/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](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/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](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/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](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/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](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/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](https://docs.rs/google-webmasters3/1.0.5+20170517/google_webmasters3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-webmasters3/1.0.6+20170517/google_webmasters3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/webmasters3/src/lib.rs b/gen/webmasters3/src/lib.rs index 9ba6139e6d..8ad5b85c65 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *webmasters* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *webmasters:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *webmasters* *v3* API can be found at the //! [official documentation site](https://developers.google.com/webmaster-tools/). @@ -323,7 +323,7 @@ impl<'a, C, A> Webmasters Webmasters { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/webmasters/v3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -346,7 +346,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/youtube3-cli/Cargo.toml b/gen/youtube3-cli/Cargo.toml index 1418f1ce4d..cd15eb490b 100644 --- a/gen/youtube3-cli/Cargo.toml +++ b/gen/youtube3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtube3-cli" -version = "1.0.5+20170130" +version = "1.0.6+20170130" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-youtube3] path = "../youtube3" -version = "1.0.5+20170130" +version = "1.0.6+20170130" diff --git a/gen/youtube3-cli/README.md b/gen/youtube3-cli/README.md index 15c355969b..09ed9c5dcb 100644 --- a/gen/youtube3-cli/README.md +++ b/gen/youtube3-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube* API at revision *20170130*. The CLI is at version *1.0.5*. +This documentation was generated from the *YouTube* API at revision *20170130*. The CLI is at version *1.0.6*. ```bash youtube3 [options] diff --git a/gen/youtube3-cli/mkdocs.yml b/gen/youtube3-cli/mkdocs.yml index cd4228bd0d..bac6a1e43a 100644 --- a/gen/youtube3-cli/mkdocs.yml +++ b/gen/youtube3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube v1.0.5+20170130 +site_name: YouTube v1.0.6+20170130 site_url: http://byron.github.io/google-apis-rs/google-youtube3-cli site_description: A complete library to interact with YouTube (protocol v3) diff --git a/gen/youtube3-cli/src/cmn.rs b/gen/youtube3-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/youtube3-cli/src/cmn.rs +++ b/gen/youtube3-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/youtube3-cli/src/main.rs b/gen/youtube3-cli/src/main.rs index cc496c11b7..31a82ea70d 100644 --- a/gen/youtube3-cli/src/main.rs +++ b/gen/youtube3-cli/src/main.rs @@ -8472,7 +8472,7 @@ fn main() { let mut app = App::new("youtube3") .author("Sebastian Thiel ") - .version("1.0.5+20170130") + .version("1.0.6+20170130") .about("Supports core YouTube features, such as uploading videos, creating and managing playlists, searching for content, and much more.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtube3_cli") .arg(Arg::with_name("url") diff --git a/gen/youtube3/Cargo.toml b/gen/youtube3/Cargo.toml index 2b81d84380..38cd1abdbb 100644 --- a/gen/youtube3/Cargo.toml +++ b/gen/youtube3/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtube3" -version = "1.0.5+20170130" +version = "1.0.6+20170130" 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" homepage = "https://developers.google.com/youtube/v3" -documentation = "https://docs.rs/google-youtube3/1.0.5+20170130" +documentation = "https://docs.rs/google-youtube3/1.0.6+20170130" license = "MIT" keywords = ["youtube", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 2244fcb642..32a1f9e3e9 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -5,86 +5,86 @@ 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 *1.0.5+20170130*, where *20170130* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *YouTube* crate version *1.0.6+20170130*, where *20170130* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *YouTube* *v3* API can be found at the [official documentation site](https://developers.google.com/youtube/v3). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.YouTube.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.YouTube.html) ... -* [activities](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Activity.html) - * [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ActivityListCall.html) -* [captions](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Caption.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionDeleteCall.html), [*download*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionDownloadCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionUpdateCall.html) +* [activities](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Activity.html) + * [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ActivityInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ActivityListCall.html) +* [captions](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Caption.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionDeleteCall.html), [*download*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionDownloadCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionUpdateCall.html) * channel banners - * [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelBannerInsertCall.html) -* [channel sections](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelSection.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelSectionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelSectionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelSectionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelSectionUpdateCall.html) -* [channels](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Channel.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelUpdateCall.html) -* [comment threads](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentThread.html) - * [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentThreadInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentThreadListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentThreadUpdateCall.html) -* [comments](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Comment.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentListCall.html), [*mark as spam*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentMarkAsSpamCall.html), [*set moderation status*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentSetModerationStatuCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CommentUpdateCall.html) -* [fan funding events](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.FanFundingEvent.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.FanFundingEventListCall.html) -* [guide categories](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.GuideCategory.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.GuideCategoryListCall.html) -* [i18n languages](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.I18nLanguage.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.I18nLanguageListCall.html) -* [i18n regions](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.I18nRegion.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.I18nRegionListCall.html) -* [live broadcasts](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcast.html) - * [*bind*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastBindCall.html), [*control*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastControlCall.html), [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastListCall.html), [*transition*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastTransitionCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveBroadcastUpdateCall.html) -* [live chat bans](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatBan.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatBanDeleteCall.html) and [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatBanInsertCall.html) -* [live chat messages](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatMessage.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatMessageDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatMessageInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatMessageListCall.html) -* [live chat moderators](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatModerator.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatModeratorDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatModeratorInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveChatModeratorListCall.html) -* [live streams](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveStream.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveStreamDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveStreamInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveStreamListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.LiveStreamUpdateCall.html) -* [playlist items](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistItem.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistItemDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistItemInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistItemListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistItemUpdateCall.html) -* [playlists](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Playlist.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistUpdateCall.html) + * [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelBannerInsertCall.html) +* [channel sections](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelSection.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelSectionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelSectionInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelSectionListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelSectionUpdateCall.html) +* [channels](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Channel.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelUpdateCall.html) +* [comment threads](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentThread.html) + * [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentThreadInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentThreadListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentThreadUpdateCall.html) +* [comments](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Comment.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentListCall.html), [*mark as spam*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentMarkAsSpamCall.html), [*set moderation status*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentSetModerationStatuCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CommentUpdateCall.html) +* [fan funding events](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.FanFundingEvent.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.FanFundingEventListCall.html) +* [guide categories](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.GuideCategory.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.GuideCategoryListCall.html) +* [i18n languages](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.I18nLanguage.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.I18nLanguageListCall.html) +* [i18n regions](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.I18nRegion.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.I18nRegionListCall.html) +* [live broadcasts](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcast.html) + * [*bind*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastBindCall.html), [*control*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastControlCall.html), [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastListCall.html), [*transition*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastTransitionCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveBroadcastUpdateCall.html) +* [live chat bans](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatBan.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatBanDeleteCall.html) and [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatBanInsertCall.html) +* [live chat messages](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatMessage.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatMessageDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatMessageInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatMessageListCall.html) +* [live chat moderators](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatModerator.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatModeratorDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatModeratorInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveChatModeratorListCall.html) +* [live streams](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveStream.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveStreamDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveStreamInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveStreamListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.LiveStreamUpdateCall.html) +* [playlist items](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistItem.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistItemDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistItemInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistItemListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistItemUpdateCall.html) +* [playlists](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Playlist.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistListCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistUpdateCall.html) * search - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SearchListCall.html) -* [sponsors](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Sponsor.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SponsorListCall.html) -* [subscriptions](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Subscription.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SubscriptionInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SubscriptionListCall.html) -* [super chat events](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SuperChatEvent.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.SuperChatEventListCall.html) -* [thumbnails](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Thumbnail.html) - * [*set*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ThumbnailSetCall.html) -* [video abuse report reasons](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoAbuseReportReason.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoAbuseReportReasonListCall.html) -* [video categories](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoCategory.html) - * [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoCategoryListCall.html) -* [videos](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.Video.html) - * [*delete*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoDeleteCall.html), [*get rating*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoGetRatingCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoListCall.html), [*rate*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoRateCall.html), [*report abuse*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoReportAbuseCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoUpdateCall.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SearchListCall.html) +* [sponsors](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Sponsor.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SponsorListCall.html) +* [subscriptions](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Subscription.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SubscriptionDeleteCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SubscriptionInsertCall.html) and [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SubscriptionListCall.html) +* [super chat events](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SuperChatEvent.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.SuperChatEventListCall.html) +* [thumbnails](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Thumbnail.html) + * [*set*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ThumbnailSetCall.html) +* [video abuse report reasons](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoAbuseReportReason.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoAbuseReportReasonListCall.html) +* [video categories](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoCategory.html) + * [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoCategoryListCall.html) +* [videos](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.Video.html) + * [*delete*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoDeleteCall.html), [*get rating*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoGetRatingCall.html), [*insert*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoInsertCall.html), [*list*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoListCall.html), [*rate*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoRateCall.html), [*report abuse*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoReportAbuseCall.html) and [*update*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoUpdateCall.html) * watermarks - * [*set*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.WatermarkSetCall.html) and [*unset*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.WatermarkUnsetCall.html) + * [*set*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.WatermarkSetCall.html) and [*unset*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.WatermarkUnsetCall.html) Upload supported by ... -* [*set thumbnails*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ThumbnailSetCall.html) -* [*insert captions*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionInsertCall.html) -* [*insert videos*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.VideoInsertCall.html) -* [*set watermarks*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.WatermarkSetCall.html) -* [*insert channel banners*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.ChannelBannerInsertCall.html) -* [*update captions*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionUpdateCall.html) +* [*set thumbnails*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ThumbnailSetCall.html) +* [*insert captions*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionInsertCall.html) +* [*insert videos*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.VideoInsertCall.html) +* [*set watermarks*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.WatermarkSetCall.html) +* [*insert channel banners*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.ChannelBannerInsertCall.html) +* [*update captions*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionUpdateCall.html) Download supported by ... -* [*download captions*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.CaptionDownloadCall.html) +* [*download captions*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.CaptionDownloadCall.html) Subscription supported by ... -* [*list playlist items*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.PlaylistItemListCall.html) +* [*list playlist items*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.PlaylistItemListCall.html) @@ -92,17 +92,17 @@ Subscription supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/struct.YouTube.html)** +* **[Hub](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/struct.YouTube.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -203,17 +203,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/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")`. @@ -223,29 +223,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/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](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/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](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/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](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/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](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/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](https://docs.rs/google-youtube3/1.0.5+20170130/google_youtube3/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtube3/1.0.6+20170130/google_youtube3/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtube3/src/lib.rs b/gen/youtube3/src/lib.rs index fa79bb3637..54fe944c7f 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 *1.0.5+20170130*, where *20170130* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *YouTube* crate version *1.0.6+20170130*, where *20170130* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *YouTube* *v3* API can be found at the //! [official documentation site](https://developers.google.com/youtube/v3). @@ -430,7 +430,7 @@ impl<'a, C, A> YouTube YouTube { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/youtube/v3/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -519,7 +519,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/youtubeanalytics1-cli/Cargo.toml b/gen/youtubeanalytics1-cli/Cargo.toml index 3ef71e330e..4604d8dad9 100644 --- a/gen/youtubeanalytics1-cli/Cargo.toml +++ b/gen/youtubeanalytics1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubeanalytics1-cli" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-youtubeanalytics1] path = "../youtubeanalytics1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" diff --git a/gen/youtubeanalytics1-cli/README.md b/gen/youtubeanalytics1-cli/README.md index 80b9a78976..f14d09c20b 100644 --- a/gen/youtubeanalytics1-cli/README.md +++ b/gen/youtubeanalytics1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube Analytics* API at revision *20170517*. The CLI is at version *1.0.5*. +This documentation was generated from the *YouTube Analytics* API at revision *20170517*. The CLI is at version *1.0.6*. ```bash youtubeanalytics1 [options] diff --git a/gen/youtubeanalytics1-cli/mkdocs.yml b/gen/youtubeanalytics1-cli/mkdocs.yml index 3f1dc82992..5ebf7f3bd6 100644 --- a/gen/youtubeanalytics1-cli/mkdocs.yml +++ b/gen/youtubeanalytics1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Analytics v1.0.5+20170517 +site_name: YouTube Analytics v1.0.6+20170517 site_url: http://byron.github.io/google-apis-rs/google-youtubeanalytics1-cli site_description: A complete library to interact with YouTube Analytics (protocol v1) diff --git a/gen/youtubeanalytics1-cli/src/cmn.rs b/gen/youtubeanalytics1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/youtubeanalytics1-cli/src/cmn.rs +++ b/gen/youtubeanalytics1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/youtubeanalytics1-cli/src/main.rs b/gen/youtubeanalytics1-cli/src/main.rs index ee0ceadbde..9cf150d01a 100644 --- a/gen/youtubeanalytics1-cli/src/main.rs +++ b/gen/youtubeanalytics1-cli/src/main.rs @@ -947,7 +947,7 @@ fn main() { let mut app = App::new("youtubeanalytics1") .author("Sebastian Thiel ") - .version("1.0.5+20170517") + .version("1.0.6+20170517") .about("Retrieves your YouTube Analytics data.") .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_youtubeanalytics1_cli") .arg(Arg::with_name("url") diff --git a/gen/youtubeanalytics1/Cargo.toml b/gen/youtubeanalytics1/Cargo.toml index 8d51057f61..25a71fe90e 100644 --- a/gen/youtubeanalytics1/Cargo.toml +++ b/gen/youtubeanalytics1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtubeanalytics1" -version = "1.0.5+20170517" +version = "1.0.6+20170517" 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" homepage = "http://developers.google.com/youtube/analytics/" -documentation = "https://docs.rs/google-youtubeanalytics1/1.0.5+20170517" +documentation = "https://docs.rs/google-youtubeanalytics1/1.0.6+20170517" license = "MIT" keywords = ["youtubeAnalytics", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/youtubeanalytics1/README.md b/gen/youtubeanalytics1/README.md index 847b951d13..0bfb5ebfc8 100644 --- a/gen/youtubeanalytics1/README.md +++ b/gen/youtubeanalytics1/README.md @@ -5,20 +5,20 @@ 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *YouTube Analytics* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *YouTube Analytics* *v1* API can be found at the [official documentation site](http://developers.google.com/youtube/analytics/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.YouTubeAnalytics.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.YouTubeAnalytics.html) ... -* [group items](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupItem.html) - * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupItemDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupItemInsertCall.html) and [*list*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupItemListCall.html) -* [groups](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.Group.html) - * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupListCall.html) and [*update*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.GroupUpdateCall.html) +* [group items](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupItem.html) + * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupItemDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupItemInsertCall.html) and [*list*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupItemListCall.html) +* [groups](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.Group.html) + * [*delete*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupDeleteCall.html), [*insert*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupInsertCall.html), [*list*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupListCall.html) and [*update*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.GroupUpdateCall.html) * reports - * [*query*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.ReportQueryCall.html) + * [*query*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.ReportQueryCall.html) @@ -27,17 +27,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/struct.YouTubeAnalytics.html)** +* **[Hub](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/struct.YouTubeAnalytics.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -127,17 +127,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/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")`. @@ -147,29 +147,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/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](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/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](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/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](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/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](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/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](https://docs.rs/google-youtubeanalytics1/1.0.5+20170517/google_youtubeanalytics1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtubeanalytics1/1.0.6+20170517/google_youtubeanalytics1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtubeanalytics1/src/lib.rs b/gen/youtubeanalytics1/src/lib.rs index 28f2c00054..a3d4b9a561 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 *1.0.5+20170517*, where *20170517* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *YouTube Analytics* crate version *1.0.6+20170517*, where *20170517* is the exact revision of the *youtubeAnalytics:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *YouTube Analytics* *v1* API can be found at the //! [official documentation site](http://developers.google.com/youtube/analytics/). @@ -342,7 +342,7 @@ impl<'a, C, A> YouTubeAnalytics YouTubeAnalytics { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://www.googleapis.com/youtube/analytics/v1/".to_string(), _root_url: "https://www.googleapis.com/".to_string(), } @@ -359,7 +359,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { diff --git a/gen/youtubereporting1-cli/Cargo.toml b/gen/youtubereporting1-cli/Cargo.toml index d9e15193df..7edf0d7481 100644 --- a/gen/youtubereporting1-cli/Cargo.toml +++ b/gen/youtubereporting1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtubereporting1-cli" -version = "1.0.5+20170520" +version = "1.0.6+20170520" 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" @@ -22,9 +22,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" strsim = "^0.5" hyper-rustls = "^0.6" @@ -37,4 +37,4 @@ clap = "^2.0" [dependencies.google-youtubereporting1] path = "../youtubereporting1" -version = "1.0.5+20170520" +version = "1.0.6+20170520" diff --git a/gen/youtubereporting1-cli/README.md b/gen/youtubereporting1-cli/README.md index be81bf2761..2ecdfd5740 100644 --- a/gen/youtubereporting1-cli/README.md +++ b/gen/youtubereporting1-cli/README.md @@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma # Usage -This documentation was generated from the *YouTube Reporting* API at revision *20170520*. The CLI is at version *1.0.5*. +This documentation was generated from the *YouTube Reporting* API at revision *20170520*. The CLI is at version *1.0.6*. ```bash youtubereporting1 [options] diff --git a/gen/youtubereporting1-cli/mkdocs.yml b/gen/youtubereporting1-cli/mkdocs.yml index 8f2f766d02..38dd2b6e2a 100644 --- a/gen/youtubereporting1-cli/mkdocs.yml +++ b/gen/youtubereporting1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube Reporting v1.0.5+20170520 +site_name: YouTube Reporting v1.0.6+20170520 site_url: http://byron.github.io/google-apis-rs/google-youtubereporting1-cli site_description: A complete library to interact with YouTube Reporting (protocol v1) diff --git a/gen/youtubereporting1-cli/src/cmn.rs b/gen/youtubereporting1-cli/src/cmn.rs index 6cc030e9c4..acddb75913 100644 --- a/gen/youtubereporting1-cli/src/cmn.rs +++ b/gen/youtubereporting1-cli/src/cmn.rs @@ -28,12 +28,12 @@ pub enum ComplexType { Map, } - // Null, - // Bool(bool), - // I64(i64), - // U64(u64), - // F64(f64), - // String(String), +// Null, +// Bool(bool), +// I64(i64), +// U64(u64), +// F64(f64), +// String(String), pub enum JsonType { Boolean, @@ -76,7 +76,8 @@ 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)) { + if confidence > 0.8 && + (candidate.is_none() || (candidate.as_ref().unwrap().0 < confidence)) { candidate = Some((confidence, pv)); } } @@ -102,7 +103,7 @@ impl AsRef for UploadProtocol { fn as_ref(&self) -> &str { match *self { UploadProtocol::Simple => "simple", - UploadProtocol::Resumable => "resumable" + UploadProtocol::Resumable => "resumable", } } } @@ -111,7 +112,7 @@ impl AsRef for CallType { fn as_ref(&self) -> &str { match *self { CallType::Upload(ref proto) => proto.as_ref(), - CallType::Standard => "standard-request" + CallType::Standard => "standard-request", } } } @@ -135,7 +136,7 @@ impl From<&'static str> for FieldCursor { fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> &'a mut Value { if m.contains_key(k) { - return m.get_mut(k).expect("value to exist") + return m.get_mut(k).expect("value to exist"); } m.insert(k.to_owned(), Value::Object(Default::default())); m.get_mut(k).expect("value to exist") @@ -144,7 +145,7 @@ fn assure_entry<'a, 'b>(m: &'a mut json::Map, k: &'b String) -> & impl FieldCursor { pub fn set(&mut self, value: &str) -> Result<(), CLIError> { if value.len() == 0 { - return Err(CLIError::Field(FieldError::Empty)) + return Err(CLIError::Field(FieldError::Empty)); } let mut first_is_field_sep = false; @@ -172,7 +173,7 @@ impl FieldCursor { 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()))) + return Err(CLIError::Field(FieldError::PopOnEmpty(value.to_string()))); } } else { push_field(&mut fields, &mut field); @@ -196,7 +197,7 @@ impl FieldCursor { fields.truncate(0); } if char_count > 1 && num_conscutive_field_seps == 1 { - return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))) + return Err(CLIError::Field(FieldError::TrailingFieldSep(value.to_string()))); } self.0 = fields; @@ -205,7 +206,7 @@ impl FieldCursor { pub fn did_you_mean(value: &str, possible_values: &[&str]) -> Option { if value.len() == 0 { - return None + return None; } let mut last_c = FIELD_SEP; @@ -215,11 +216,10 @@ impl FieldCursor { 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, - }); + fs.push_str(match did_you_mean(&f, possible_values) { + Some(candidate) => candidate, + None => &f, + }); f.truncate(0); } }; @@ -246,108 +246,129 @@ impl FieldCursor { } } - pub fn set_json_value(&self, mut object: &mut Value, - value: &str, type_info: JsonTypeInfo, - err: &mut InvalidOptionsError, - orig_cursor: &FieldCursor) { + 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] { + for field in &self.0[..self.0.len() - 1] { let tmp = object; - object = - match *tmp { - Value::Object(ref mut mapping) => { - assure_entry(mapping, &field) - }, - _ => panic!("We don't expect non-object Values here ...") - }; + object = match *tmp { + Value::Object(ref mut mapping) => { + assure_entry(mapping, &field) + } + _ => 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::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")), - JsonType::Uint => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")), - JsonType::Float => - Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")), - JsonType::String => - Value::String(value.to_owned()), - } - }; - + 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::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "int")) + .expect("valid f64")), + JsonType::Uint => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "uint")) + .expect("valid f64")), + JsonType::Float => + Value::Number(json::Number::from_f64(arg_from_str(value, + err, + &field, + "float")) + .expect("valid f64")), + 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() { + 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 *assure_entry(mapping, field) { - Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)), - _ => unreachable!() + 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 *assure_entry(mapping, &field) { - + 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!(), } } } - }, - _ => 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)); +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) - }, + return (kv, None); + } Some(pos) => { let key = &kv[..pos]; if kv.len() <= pos + 1 { add_err(); - return (key, Some("")) + return (key, Some("")); } - (key, Some(&kv[pos+1..])) + (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 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 { @@ -377,23 +398,27 @@ pub fn writer_from_opts(arg: Option<&str>) -> Result, io::Error> { _ => 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 { +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)) - ); + err.issues.push(CLIError::ParseError(arg_name.to_owned(), + arg_type.to_owned(), + arg.to_string(), + format!("{}", perr))); Default::default() - }, + } Ok(v) => v, } } @@ -419,10 +444,8 @@ pub enum TokenStorageError { impl fmt::Display for TokenStorageError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - TokenStorageError::Json(ref err) - => writeln!(f, "Could not serialize secrets: {}", err), - TokenStorageError::Io(ref err) - => writeln!(f, "Failed to write secret token: {}", err), + TokenStorageError::Json(ref err) => writeln!(f, "Could not serialize secrets: {}", err), + TokenStorageError::Io(ref err) => writeln!(f, "Failed to write secret token: {}", err), } } } @@ -438,15 +461,18 @@ impl TokenStorage for JsonTokenStorage { type Error = TokenStorageError; // NOTE: logging might be interesting, currently we swallow all errors - fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option) -> Result<(), TokenStorageError> { + fn set(&mut self, + scope_hash: u64, + _: &Vec<&str>, + token: Option) + -> Result<(), TokenStorageError> { match token { None => { match fs::remove_file(self.path(scope_hash)) { - Err(err) => - match err.kind() { - io::ErrorKind::NotFound => Ok(()), - _ => Err(TokenStorageError::Io(err)) - }, + Err(err) => match err.kind() { + io::ErrorKind::NotFound => Ok(()), + _ => Err(TokenStorageError::Io(err)), + }, Ok(_) => Ok(()), } } @@ -457,8 +483,8 @@ impl TokenStorage for JsonTokenStorage { Ok(_) => Ok(()), Err(serde_err) => Err(TokenStorageError::Json(serde_err)), } - }, - Err(io_err) => Err(TokenStorageError::Io(io_err)) + } + Err(io_err) => Err(TokenStorageError::Io(io_err)), } } } @@ -469,13 +495,13 @@ impl TokenStorage for JsonTokenStorage { Ok(f) => { match json::de::from_reader(f) { Ok(token) => Ok(Some(token)), - Err(err) => Err(TokenStorageError::Json(err)), + Err(err) => Err(TokenStorageError::Json(err)), } - }, + } Err(io_err) => { match io_err.kind() { io::ErrorKind::NotFound => Ok(None), - _ => Err(TokenStorageError::Io(io_err)) + _ => Err(TokenStorageError::Io(io_err)), } } } @@ -492,12 +518,15 @@ pub enum ApplicationSecretError { 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), + 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), } } } @@ -514,16 +543,22 @@ pub enum ConfigurationError { 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::Io((ref path, ref err)) - => writeln!(f, "IO operation failed on path '{}' with error: {}.", path, err), + 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::Io((ref path, ref err)) => + writeln!(f, + "IO operation failed on path '{}' with error: {}.", + path, + err), } } } @@ -537,10 +572,12 @@ pub enum InputError { impl fmt::Display for InputError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match *self { - InputError::Io((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), + InputError::Io((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), } } } @@ -558,29 +595,28 @@ pub enum FieldError { 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::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(), - }; + 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."), + } + FieldError::Duplicate(ref cursor) => + writeln!(f, "Value at '{}' was already set", cursor), + FieldError::Empty => writeln!(f, "Field names must not be empty."), } } } @@ -605,25 +641,41 @@ 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.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::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(), - }; + 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) - }, + 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), + CLIError::MissingMethodError(ref cmd) => + writeln!(f, + "Please specify the method to call on the '{}' command.", + cmd), } } } @@ -662,26 +714,25 @@ impl InvalidOptionsError { pub fn assure_config_dir_exists(dir: &str) -> Result { let trdir = dir.trim(); if trdir.len() == 0 { - return Err(CLIError::Configuration(ConfigurationError::DirectoryUnset)) + 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 - } + 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() - }; + } + } 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)))) + ConfigurationError::DirectoryCreationFailed((expanded_config_dir, err)))); } } @@ -691,13 +742,11 @@ pub fn assure_config_dir_exists(dir: &str) -> Result { pub fn application_secret_from_directory(dir: &str, secret_basename: &str, json_console_secret: &str) - -> Result { + -> 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::Io( - (secret_str(), io_err) - ))) + Err(CLIError::Configuration(ConfigurationError::Io((secret_str(), io_err)))) }; for _ in 0..2 { @@ -706,22 +755,26 @@ pub fn application_secret_from_directory(dir: &str, 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 = 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(); + let console_secret: ConsoleApplicationSecret = + json::from_str(json_console_secret).unwrap(); match json::to_writer_pretty(&mut f, &console_secret) { - Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err), + Err(serde_err) => + panic!("Unexpected serde error: {:#?}", serde_err), Ok(_) => continue, } } }; // fall through to IO error handling } - return secret_io_error(err) - }, + return secret_io_error(err); + } Ok(f) => { match json::de::from_reader::<_, ConsoleApplicationSecret>(f) { Err(json_err) => @@ -730,15 +783,14 @@ pub fn application_secret_from_directory(dir: &str, ApplicationSecretError::DecoderError( (secret_str(), json_err) )))), - Ok(console_secret) => - match console_secret.installed { - Some(secret) => return Ok(secret), - None => return Err( + Ok(console_secret) => match console_secret.installed { + Some(secret) => return Ok(secret), + None => return Err( CLIError::Configuration( ConfigurationError::Secret( ApplicationSecretError::FormatError(secret_str()) - ))) - }, + ))), + }, } } } diff --git a/gen/youtubereporting1-cli/src/main.rs b/gen/youtubereporting1-cli/src/main.rs index d241b75239..52f990cb0d 100644 --- a/gen/youtubereporting1-cli/src/main.rs +++ b/gen/youtubereporting1-cli/src/main.rs @@ -895,7 +895,7 @@ fn main() { let mut app = App::new("youtubereporting1") .author("Sebastian Thiel ") - .version("1.0.5+20170520") + .version("1.0.6+20170520") .about("Schedules reporting jobs containing your YouTube Analytics data and downloads the resulting bulk data reports 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") diff --git a/gen/youtubereporting1/Cargo.toml b/gen/youtubereporting1/Cargo.toml index 69fe248a18..2460c83dcd 100644 --- a/gen/youtubereporting1/Cargo.toml +++ b/gen/youtubereporting1/Cargo.toml @@ -4,12 +4,12 @@ [package] name = "google-youtubereporting1" -version = "1.0.5+20170520" +version = "1.0.6+20170520" 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" homepage = "https://developers.google.com/youtube/reporting/v1/reports/" -documentation = "https://docs.rs/google-youtubereporting1/1.0.5+20170520" +documentation = "https://docs.rs/google-youtubereporting1/1.0.6+20170520" license = "MIT" keywords = ["youtubereporting", "google", "protocol", "web", "api"] @@ -20,9 +20,9 @@ hyper-rustls = "^0.6" [dependencies] hyper = "^ 0.10" mime = "^ 0.2.0" -serde = "^ 0.9" -serde_json = "^ 0.9" -serde_derive = "^ 0.9" +serde = "^ 1.0" +serde_json = "^ 1.0" +serde_derive = "^ 1.0" yup-oauth2 = "^ 1.0" url = "= 0.5" diff --git a/gen/youtubereporting1/README.md b/gen/youtubereporting1/README.md index d865529577..3d212a7963 100644 --- a/gen/youtubereporting1/README.md +++ b/gen/youtubereporting1/README.md @@ -5,25 +5,25 @@ 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 *1.0.5+20170520*, where *20170520* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +This documentation was generated from *YouTube Reporting* crate version *1.0.6+20170520*, where *20170520* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. Everything else about the *YouTube Reporting* *v1* API can be found at the [official documentation site](https://developers.google.com/youtube/reporting/v1/reports/). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.YouTubeReporting.html) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.YouTubeReporting.html) ... -* [jobs](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.Job.html) - * [*create*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.JobCreateCall.html), [*delete*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.JobDeleteCall.html), [*get*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.JobGetCall.html), [*list*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.JobListCall.html), [*reports get*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.JobReportGetCall.html) and [*reports list*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.JobReportListCall.html) -* [media](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.Media.html) - * [*download*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.MediaDownloadCall.html) -* [report types](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.ReportType.html) - * [*list*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.ReportTypeListCall.html) +* [jobs](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.Job.html) + * [*create*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.JobCreateCall.html), [*delete*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.JobDeleteCall.html), [*get*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.JobGetCall.html), [*list*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.JobListCall.html), [*reports get*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.JobReportGetCall.html) and [*reports list*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.JobReportListCall.html) +* [media](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.Media.html) + * [*download*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.MediaDownloadCall.html) +* [report types](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.ReportType.html) + * [*list*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.ReportTypeListCall.html) Download supported by ... -* [*download media*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.MediaDownloadCall.html) +* [*download media*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.MediaDownloadCall.html) @@ -31,17 +31,17 @@ Download supported by ... The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/struct.YouTubeReporting.html)** +* **[Hub](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/struct.YouTubeReporting.html)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.MethodsBuilder.html) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.CallBuilder.html) -* **[Resources](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.Resource.html)** + * creates [*Method Builders*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.MethodsBuilder.html) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.CallBuilder.html) +* **[Resources](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.Resource.html)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.Part.html)** + * **[Parts](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.Part.html)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.CallBuilder.html)** +* **[Activities](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.CallBuilder.html)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -135,17 +135,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/enum.Result.html) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/enum.Result.html) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This makes the system potentially resilient to all kinds of errors. ## Uploads and Downloads -If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/enum.Result.html), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/enum.Result.html), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.ResponseResult.html), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/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")`. @@ -155,29 +155,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.Delegate.html) to the -[Method Builder](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.CallBuilder.html) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.Delegate.html) to the +[Method Builder](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/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](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/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](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.RequestValue.html) and -[decodable](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/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](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.RequestValue.html) and +[decodable](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.Part.html) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/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](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/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](https://docs.rs/google-youtubereporting1/1.0.5+20170520/google_youtubereporting1/trait.RequestValue.html) are moved +* [request values](https://docs.rs/google-youtubereporting1/1.0.6+20170520/google_youtubereporting1/trait.RequestValue.html) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. diff --git a/gen/youtubereporting1/src/lib.rs b/gen/youtubereporting1/src/lib.rs index 73189b6fd7..d991c55c77 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 *1.0.5+20170520*, where *20170520* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.5*. +//! This documentation was generated from *YouTube Reporting* crate version *1.0.6+20170520*, where *20170520* is the exact revision of the *youtubereporting:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.6*. //! //! Everything else about the *YouTube Reporting* *v1* API can be found at the //! [official documentation site](https://developers.google.com/youtube/reporting/v1/reports/). @@ -340,7 +340,7 @@ impl<'a, C, A> YouTubeReporting YouTubeReporting { client: RefCell::new(client), auth: RefCell::new(authenticator), - _user_agent: "google-api-rust-client/1.0.5".to_string(), + _user_agent: "google-api-rust-client/1.0.6".to_string(), _base_url: "https://youtubereporting.googleapis.com/".to_string(), _root_url: "https://youtubereporting.googleapis.com/".to_string(), } @@ -357,7 +357,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/1.0.5`. + /// It defaults to `google-api-rust-client/1.0.6`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String {