Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d18714e

Browse files
committed
chore(gen): regen all apis/clis for v1.0.4
1 parent 6cad082 commit d18714e

1,050 files changed

Lines changed: 1159158 additions & 1161048 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

gen/adexchangebuyer1d3-cli/Cargo.toml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55

66
name = "google-adexchangebuyer1d3-cli"
7-
version = "1.0.3+20161020"
7+
version = "1.0.4+20161020"
88
authors = ["Sebastian Thiel <[email protected]>"]
99
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
1010
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3-cli"
@@ -19,26 +19,19 @@ name = "adexchangebuyer1d3"
1919
[dependencies]
2020
hyper = "^ 0.10"
2121
mime = "^ 0.2.0"
22-
serde = "^ 0.8"
23-
serde_json = "^ 0.8"
24-
yup-oauth2 = { version = "^ 1.0", optional = true, default-features = false }
25-
serde_derive = { version = "^ 0.8", optional = true }
22+
serde = "^ 0.9"
23+
serde_json = "^ 0.9"
24+
serde_derive = "^ 0.9"
25+
yup-oauth2 = "^ 1.0"
2626
strsim = "^0.5"
2727
hyper-rustls = "^0.3"
2828
yup-hyper-mock = "^2.0"
2929
clap = "^2.0"
3030

3131
[features]
32-
default = ["with-serde-codegen"]
33-
nightly = ["serde_derive","yup-oauth2/nightly","google-adexchangebuyer1d3/nightly"]
34-
with-serde-codegen = ["serde_codegen","yup-oauth2/with-serde-codegen","google-adexchangebuyer1d3/with-serde-codegen"]
3532

36-
[build-dependencies]
37-
serde_codegen = { version = "^ 0.8", optional = true }
3833

3934

4035
[dependencies.google-adexchangebuyer1d3]
4136
path = "../adexchangebuyer1d3"
42-
version = "1.0.3+20161020"
43-
optional = true
44-
default-features = false
37+
version = "1.0.4+20161020"

gen/adexchangebuyer1d3-cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/ma
2525

2626
# Usage
2727

28-
This documentation was generated from the *Ad Exchange Buyer* API at revision *20161020*. The CLI is at version *1.0.3*.
28+
This documentation was generated from the *Ad Exchange Buyer* API at revision *20161020*. The CLI is at version *1.0.4*.
2929

3030
```bash
3131
adexchangebuyer1d3 [options]

gen/adexchangebuyer1d3-cli/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
site_name: Ad Exchange Buyer v1.0.3+20161020
1+
site_name: Ad Exchange Buyer v1.0.4+20161020
22
site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli
33
site_description: A complete library to interact with Ad Exchange Buyer (protocol v1.3)
44

gen/adexchangebuyer1d3-cli/src/cmn.rs

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use strsim;
1010
use std::fs;
1111
use std::env;
1212
use std::io;
13+
use std::error::Error as StdError;
1314
use std::fmt;
1415
use std::path::{Path, PathBuf};
1516
use std::str::FromStr;
@@ -132,6 +133,14 @@ impl From<&'static str> for FieldCursor {
132133
}
133134
}
134135

136+
fn assure_entry<'a, 'b>(m: &'a mut json::Map<String, Value>, k: &'b String) -> &'a mut Value {
137+
if m.contains_key(k) {
138+
return m.get_mut(k).expect("value to exist")
139+
}
140+
m.insert(k.to_owned(), Value::Object(Default::default()));
141+
m.get_mut(k).expect("value to exist")
142+
}
143+
135144
impl FieldCursor {
136145
pub fn set(&mut self, value: &str) -> Result<(), CLIError> {
137146
if value.len() == 0 {
@@ -248,9 +257,7 @@ impl FieldCursor {
248257
object =
249258
match *tmp {
250259
Value::Object(ref mut mapping) => {
251-
mapping.entry(field.to_owned()).or_insert(
252-
Value::Object(Default::default())
253-
)
260+
assure_entry(mapping, &field)
254261
},
255262
_ => panic!("We don't expect non-object Values here ...")
256263
};
@@ -266,35 +273,34 @@ impl FieldCursor {
266273
JsonType::Boolean =>
267274
Value::Bool(arg_from_str(value, err, &field, "boolean")),
268275
JsonType::Int =>
269-
Value::I64(arg_from_str(value, err, &field, "int")),
276+
Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "int")).expect("valid f64")),
270277
JsonType::Uint =>
271-
Value::U64(arg_from_str(value, err, &field, "uint")),
278+
Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "uint")).expect("valid f64")),
272279
JsonType::Float =>
273-
Value::F64(arg_from_str(value, err, &field, "float")),
280+
Value::Number(json::Number::from_f64(arg_from_str(value, err, &field, "float")).expect("valid f64")),
274281
JsonType::String =>
275282
Value::String(value.to_owned()),
276283
}
277284
};
278-
285+
279286
match type_info.ctype {
280287
ComplexType::Pod => {
281288
if mapping.insert(field.to_owned(), to_jval(value, type_info.jtype, err)).is_some() {
282289
err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string())));
283290
}
284291
},
285292
ComplexType::Vec => {
286-
match *mapping.entry(field.to_owned())
287-
.or_insert(Value::Array(Default::default())) {
293+
match *assure_entry(mapping, field) {
288294
Value::Array(ref mut values) => values.push(to_jval(value, type_info.jtype, err)),
289295
_ => unreachable!()
290296
}
291297
},
292298
ComplexType::Map => {
293299
let (key, value) = parse_kv_arg(value, err, true);
294300
let jval = to_jval(value.unwrap_or(""), type_info.jtype, err);
295-
296-
match *mapping.entry(field.to_owned())
297-
.or_insert(Value::Object(Default::default())) {
301+
302+
match *assure_entry(mapping, &field) {
303+
298304
Value::Object(ref mut value_map) => {
299305
if value_map.insert(key.to_owned(), jval).is_some() {
300306
err.issues.push(CLIError::Field(FieldError::Duplicate(orig_cursor.to_string())));
@@ -308,7 +314,7 @@ impl FieldCursor {
308314
_ => unreachable!()
309315
}
310316
}
311-
317+
312318
pub fn num_fields(&self) -> usize {
313319
self.0.len()
314320
}
@@ -403,18 +409,43 @@ impl JsonTokenStorage {
403409
}
404410
}
405411

412+
413+
#[derive(Debug)]
414+
pub enum TokenStorageError {
415+
Json(json::Error),
416+
Io(io::Error),
417+
}
418+
419+
impl fmt::Display for TokenStorageError {
420+
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
421+
match *self {
422+
TokenStorageError::Json(ref err)
423+
=> writeln!(f, "Could not serialize secrets: {}", err),
424+
TokenStorageError::Io(ref err)
425+
=> writeln!(f, "Failed to write secret token: {}", err),
426+
}
427+
}
428+
}
429+
430+
impl StdError for TokenStorageError {
431+
fn description(&self) -> &str {
432+
"Failure when getting or setting the token storage"
433+
}
434+
}
435+
436+
406437
impl TokenStorage for JsonTokenStorage {
407-
type Error = json::Error;
438+
type Error = TokenStorageError;
408439

409440
// NOTE: logging might be interesting, currently we swallow all errors
410-
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Result<(), json::Error> {
441+
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Result<(), TokenStorageError> {
411442
match token {
412443
None => {
413444
match fs::remove_file(self.path(scope_hash)) {
414445
Err(err) =>
415446
match err.kind() {
416447
io::ErrorKind::NotFound => Ok(()),
417-
_ => Err(json::Error::Io(err))
448+
_ => Err(TokenStorageError::Io(err))
418449
},
419450
Ok(_) => Ok(()),
420451
}
@@ -424,27 +455,27 @@ impl TokenStorage for JsonTokenStorage {
424455
Ok(mut f) => {
425456
match json::to_writer_pretty(&mut f, &token) {
426457
Ok(_) => Ok(()),
427-
Err(serde_err) => Err(serde_err),
458+
Err(serde_err) => Err(TokenStorageError::Json(serde_err)),
428459
}
429460
},
430-
Err(io_err) => Err(json::Error::Io(io_err))
461+
Err(io_err) => Err(TokenStorageError::Io(io_err))
431462
}
432463
}
433464
}
434465
}
435466

436-
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, json::Error> {
467+
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, TokenStorageError> {
437468
match fs::File::open(&self.path(scope_hash)) {
438469
Ok(f) => {
439470
match json::de::from_reader(f) {
440471
Ok(token) => Ok(Some(token)),
441-
Err(err) => Err(err),
472+
Err(err) => Err(TokenStorageError::Json(err)),
442473
}
443474
},
444475
Err(io_err) => {
445476
match io_err.kind() {
446477
io::ErrorKind::NotFound => Ok(None),
447-
_ => Err(json::Error::Io(io_err))
478+
_ => Err(TokenStorageError::Io(io_err))
448479
}
449480
}
450481
}
@@ -682,10 +713,7 @@ pub fn application_secret_from_directory(dir: &str,
682713
let console_secret: ConsoleApplicationSecret
683714
= json::from_str(json_console_secret).unwrap();
684715
match json::to_writer_pretty(&mut f, &console_secret) {
685-
Err(serde_err) => match serde_err {
686-
json::Error::Io(err) => err,
687-
_ => panic!("Unexpected serde error: {:#?}", serde_err)
688-
},
716+
Err(serde_err) => panic!("Unexpected serde error: {:#?}", serde_err),
689717
Ok(_) => continue,
690718
}
691719
}
@@ -696,8 +724,6 @@ pub fn application_secret_from_directory(dir: &str,
696724
},
697725
Ok(f) => {
698726
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
699-
Err(json::Error::Io(err)) =>
700-
return secret_io_error(err),
701727
Err(json_err) =>
702728
return Err(CLIError::Configuration(
703729
ConfigurationError::Secret(

0 commit comments

Comments
 (0)