Bump version to 1.0.9; update JSON schemas; add new APIs

This commit is contained in:
Sebastian Thiel
2019-07-05 11:32:35 +08:00
parent 99e97ceece
commit e42ebc0c2b
2442 changed files with 190984 additions and 71186 deletions

View File

@@ -67,6 +67,17 @@ pub fn remove_json_null_values(value: &mut Value) {
map.remove(key);
}
}
json::value::Value::Array(ref mut arr) => {
let mut i = 0;
while i < arr.len() {
if arr[i].is_null() {
arr.remove(i);
} else {
remove_json_null_values(&mut arr[i]);
i += 1;
}
}
}
_ => {}
}
}

View File

@@ -670,65 +670,6 @@ impl<'n> Engine<'n> {
}
}
fn _people_list_by_circle(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut call = self.hub.people().list_by_circle(opt.value_of("circle-id").unwrap_or(""));
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
"page-token" => {
call = call.page_token(value.unwrap_or(""));
},
"max-results" => {
call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer"));
},
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v.extend(["page-token", "max-results"].iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
call = call.add_scope(scope);
}
let mut ostream = match writer_from_opts(opt.value_of("out")) {
Ok(mut f) => f,
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
};
match match protocol {
CallType::Standard => call.doit(),
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
fn _doit(&self, dry_run: bool) -> Result<Result<(), DoitError>, Option<InvalidOptionsError>> {
let mut err = InvalidOptionsError::new();
let mut call_result: Result<(), DoitError> = Ok(());
@@ -806,9 +747,6 @@ impl<'n> Engine<'n> {
("list-by-activity", Some(opt)) => {
call_result = self._people_list_by_activity(opt, dry_run, &mut err);
},
("list-by-circle", Some(opt)) => {
call_result = self._people_list_by_circle(opt, dry_run, &mut err);
},
_ => {
err.issues.push(CLIError::MissingMethodError("people".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
@@ -1091,7 +1029,7 @@ fn main() {
]),
]),
("people", "methods: 'get', 'list', 'list-by-activity' and 'list-by-circle'", vec![
("people", "methods: 'get', 'list' and 'list-by-activity'", vec![
("get",
Some(r##"Get a person's profile."##),
"Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_get",
@@ -1164,28 +1102,6 @@ fn main() {
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
("list-by-circle",
Some(r##"Shut down. See https://developers.google.com/+/api-shutdown for more details."##),
"Details at http://byron.github.io/google-apis-rs/google_plusdomains1_cli/people_list-by-circle",
vec![
(Some(r##"circle-id"##),
None,
Some(r##"The ID of the circle to get the members of."##),
Some(true),
Some(false)),
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
@@ -1198,7 +1114,7 @@ fn main() {
let mut app = App::new("plusdomains1")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("1.0.8+20190328")
.version("1.0.9+20190616")
.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")