mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-24 12:15:55 +01:00
chore(code): updated to latest state
This commit is contained in:
@@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg};
|
||||
|
||||
mod cmn;
|
||||
|
||||
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
||||
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
||||
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol,
|
||||
calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo};
|
||||
|
||||
@@ -36,19 +36,19 @@ enum DoitError {
|
||||
ApiError(api::Error),
|
||||
}
|
||||
|
||||
struct Engine<'n, 'a> {
|
||||
opt: ArgMatches<'n, 'a>,
|
||||
struct Engine<'n> {
|
||||
opt: ArgMatches<'n>,
|
||||
hub: api::AdExchangeSeller<hyper::Client, Authenticator<DefaultAuthenticatorDelegate, JsonTokenStorage, hyper::Client>>,
|
||||
gp: Vec<&'static str>,
|
||||
gpm: Vec<(&'static str, &'static str)>,
|
||||
}
|
||||
|
||||
|
||||
impl<'n, 'a> Engine<'n, 'a> {
|
||||
fn _accounts_adclients_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
impl<'n> Engine<'n> {
|
||||
fn _accounts_adclients_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().adclients_list(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"page-token" => {
|
||||
@@ -67,7 +67,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["page-token", "max-results"].iter().map(|v|*v));
|
||||
@@ -81,7 +81,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -104,10 +104,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_alerts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_alerts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().alerts_list(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"locale" => {
|
||||
@@ -123,7 +123,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["locale"].iter().map(|v|*v));
|
||||
@@ -137,7 +137,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -160,10 +160,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_customchannels_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_customchannels_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().customchannels_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""), opt.value_of("custom-channel-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
_ => {
|
||||
@@ -176,7 +176,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v } ));
|
||||
@@ -189,7 +189,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -212,10 +212,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_customchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_customchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().customchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"page-token" => {
|
||||
@@ -234,7 +234,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["page-token", "max-results"].iter().map(|v|*v));
|
||||
@@ -248,7 +248,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -271,10 +271,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().get(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
_ => {
|
||||
@@ -287,7 +287,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v } ));
|
||||
@@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -323,10 +323,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().list();
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"page-token" => {
|
||||
@@ -345,7 +345,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["page-token", "max-results"].iter().map(|v|*v));
|
||||
@@ -359,7 +359,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -382,10 +382,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_metadata_dimensions_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_metadata_dimensions_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().metadata_dimensions_list(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
_ => {
|
||||
@@ -398,7 +398,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v } ));
|
||||
@@ -411,7 +411,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -434,10 +434,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_metadata_metrics_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_metadata_metrics_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().metadata_metrics_list(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
_ => {
|
||||
@@ -450,7 +450,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v } ));
|
||||
@@ -463,7 +463,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -486,10 +486,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_preferreddeals_get(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_preferreddeals_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().preferreddeals_get(opt.value_of("account-id").unwrap_or(""), opt.value_of("deal-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
_ => {
|
||||
@@ -502,7 +502,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v } ));
|
||||
@@ -515,7 +515,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -538,10 +538,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_preferreddeals_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_preferreddeals_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().preferreddeals_list(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
_ => {
|
||||
@@ -554,7 +554,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v } ));
|
||||
@@ -567,7 +567,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -590,11 +590,11 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_reports_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_reports_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut download_mode = false;
|
||||
let mut call = self.hub.accounts().reports_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("start-date").unwrap_or(""), opt.value_of("end-date").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"start-index" => {
|
||||
@@ -631,7 +631,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["sort", "locale", "metric", "max-results", "filter", "start-index", "dimension"].iter().map(|v|*v));
|
||||
@@ -645,7 +645,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -673,10 +673,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_reports_saved_generate(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_reports_saved_generate(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().reports_saved_generate(opt.value_of("account-id").unwrap_or(""), opt.value_of("saved-report-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"start-index" => {
|
||||
@@ -698,7 +698,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["locale", "start-index", "max-results"].iter().map(|v|*v));
|
||||
@@ -712,7 +712,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -735,10 +735,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_reports_saved_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_reports_saved_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().reports_saved_list(opt.value_of("account-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"page-token" => {
|
||||
@@ -757,7 +757,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["page-token", "max-results"].iter().map(|v|*v));
|
||||
@@ -771,7 +771,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -794,10 +794,10 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _accounts_urlchannels_list(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _accounts_urlchannels_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.accounts().urlchannels_list(opt.value_of("account-id").unwrap_or(""), opt.value_of("ad-client-id").unwrap_or(""));
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"page-token" => {
|
||||
@@ -816,7 +816,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["page-token", "max-results"].iter().map(|v|*v));
|
||||
@@ -830,7 +830,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
Ok(())
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||
for scope in self.opt.values_of("url").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
call = call.add_scope(scope);
|
||||
}
|
||||
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||
@@ -925,14 +925,14 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
|
||||
// Please note that this call will fail if any part of the opt can't be handled
|
||||
fn new(opt: ArgMatches<'a, 'n>) -> Result<Engine<'a, 'n>, InvalidOptionsError> {
|
||||
fn new(opt: ArgMatches<'n>) -> Result<Engine<'n>, InvalidOptionsError> {
|
||||
let (config_dir, secret) = {
|
||||
let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) {
|
||||
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
|
||||
Ok(p) => p,
|
||||
};
|
||||
|
||||
match cmn::application_secret_from_directory(&config_dir, "adexchangeseller2-secret.json",
|
||||
match cmn::application_secret_from_directory(&config_dir, "adexchangeseller2-secret.json",
|
||||
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
|
||||
Ok(secret) => (config_dir, secret),
|
||||
Err(e) => return Err(InvalidOptionsError::single(e, 4))
|
||||
@@ -952,7 +952,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
db_dir: config_dir.clone(),
|
||||
}, None);
|
||||
|
||||
let client =
|
||||
let client =
|
||||
if opt.is_present("debug") {
|
||||
hyper::Client::with_connector(mock::TeeConnector {
|
||||
connector: hyper::net::HttpsConnector::<hyper::net::Openssl>::default()
|
||||
@@ -991,7 +991,7 @@ fn main() {
|
||||
let mut exit_status = 0i32;
|
||||
let arg_data = [
|
||||
("accounts", "methods: 'adclients-list', 'alerts-list', 'customchannels-get', 'customchannels-list', 'get', 'list', 'metadata-dimensions-list', 'metadata-metrics-list', 'preferreddeals-get', 'preferreddeals-list', 'reports-generate', 'reports-saved-generate', 'reports-saved-list' and 'urlchannels-list'", vec![
|
||||
("adclients-list",
|
||||
("adclients-list",
|
||||
Some(r##"List all ad clients in this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_adclients-list",
|
||||
vec![
|
||||
@@ -1013,7 +1013,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("alerts-list",
|
||||
("alerts-list",
|
||||
Some(r##"List the alerts for this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_alerts-list",
|
||||
vec![
|
||||
@@ -1035,7 +1035,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("customchannels-get",
|
||||
("customchannels-get",
|
||||
Some(r##"Get the specified custom channel from the specified ad client."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_customchannels-get",
|
||||
vec![
|
||||
@@ -1069,7 +1069,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("customchannels-list",
|
||||
("customchannels-list",
|
||||
Some(r##"List all custom channels in the specified ad client for this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_customchannels-list",
|
||||
vec![
|
||||
@@ -1097,7 +1097,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("get",
|
||||
("get",
|
||||
Some(r##"Get information about the selected Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_get",
|
||||
vec![
|
||||
@@ -1119,7 +1119,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("list",
|
||||
("list",
|
||||
Some(r##"List all accounts available to this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_list",
|
||||
vec![
|
||||
@@ -1135,7 +1135,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("metadata-dimensions-list",
|
||||
("metadata-dimensions-list",
|
||||
Some(r##"List the metadata for the dimensions available to this AdExchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_metadata-dimensions-list",
|
||||
vec![
|
||||
@@ -1157,7 +1157,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("metadata-metrics-list",
|
||||
("metadata-metrics-list",
|
||||
Some(r##"List the metadata for the metrics available to this AdExchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_metadata-metrics-list",
|
||||
vec![
|
||||
@@ -1179,7 +1179,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("preferreddeals-get",
|
||||
("preferreddeals-get",
|
||||
Some(r##"Get information about the selected Ad Exchange Preferred Deal."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_preferreddeals-get",
|
||||
vec![
|
||||
@@ -1207,7 +1207,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("preferreddeals-list",
|
||||
("preferreddeals-list",
|
||||
Some(r##"List the preferred deals for this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_preferreddeals-list",
|
||||
vec![
|
||||
@@ -1229,7 +1229,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("reports-generate",
|
||||
("reports-generate",
|
||||
Some(r##"Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_reports-generate",
|
||||
vec![
|
||||
@@ -1263,7 +1263,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("reports-saved-generate",
|
||||
("reports-saved-generate",
|
||||
Some(r##"Generate an Ad Exchange report based on the saved report ID sent in the query parameters."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_reports-saved-generate",
|
||||
vec![
|
||||
@@ -1291,7 +1291,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("reports-saved-list",
|
||||
("reports-saved-list",
|
||||
Some(r##"List all saved reports in this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_reports-saved-list",
|
||||
vec![
|
||||
@@ -1313,7 +1313,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("urlchannels-list",
|
||||
("urlchannels-list",
|
||||
Some(r##"List all URL channels in the specified ad client for this Ad Exchange account."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/accounts_urlchannels-list",
|
||||
vec![
|
||||
@@ -1347,7 +1347,7 @@ fn main() {
|
||||
|
||||
let mut app = App::new("adexchangeseller2")
|
||||
.author("Sebastian Thiel <byronimo@gmail.com>")
|
||||
.version("0.3.2+20151013")
|
||||
.version("0.3.3+20151127")
|
||||
.about("Gives Ad Exchange seller users access to their inventory and the ability to generate reports")
|
||||
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli")
|
||||
.arg(Arg::with_name("url")
|
||||
@@ -1371,7 +1371,7 @@ fn main() {
|
||||
.multiple(false)
|
||||
.takes_value(false));
|
||||
|
||||
for &(main_command_name, ref about, ref subcommands) in arg_data.iter() {
|
||||
for &(main_command_name, about, ref subcommands) in arg_data.iter() {
|
||||
let mut mcmd = SubCommand::with_name(main_command_name).about(about);
|
||||
|
||||
for &(sub_command_name, ref desc, url_info, ref args) in subcommands {
|
||||
@@ -1382,7 +1382,7 @@ fn main() {
|
||||
scmd = scmd.after_help(url_info);
|
||||
|
||||
for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args {
|
||||
let arg_name_str =
|
||||
let arg_name_str =
|
||||
match (arg_name, flag) {
|
||||
(&Some(an), _ ) => an,
|
||||
(_ , &Some(f)) => f,
|
||||
|
||||
Reference in New Issue
Block a user