diff --git a/etc/api/type-cli.yaml b/etc/api/type-cli.yaml index f2de6e96424..06abe608b0b 100644 --- a/etc/api/type-cli.yaml +++ b/etc/api/type-cli.yaml @@ -22,12 +22,11 @@ make: - source: main.rs output_dir: src cargo: - build_version: "0.1.0" + build_version: "0.2.0" keywords: [cli] is_executable: YES dependencies: - - docopt = "*" - - docopt_macros = "*" + - clap = "*" - rustc-serialize = "*" - yup-hyper-mock = "*" - serde = ">= 0.3.0" diff --git a/gen/dfareporting2d1-cli/Cargo.toml b/gen/dfareporting2d1-cli/Cargo.toml index cefe278d07d..e4135326407 100644 --- a/gen/dfareporting2d1-cli/Cargo.toml +++ b/gen/dfareporting2d1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-dfareporting2d1-cli" -version = "0.1.0+20150326" +version = "0.2.0+20150326" 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" @@ -20,8 +20,7 @@ name = "dfareporting2d1" hyper = "*" mime = "*" yup-oauth2 = "*" -docopt = "*" -docopt_macros = "*" +clap = "*" rustc-serialize = "*" yup-hyper-mock = "*" serde = ">= 0.3.0" diff --git a/gen/dfareporting2d1-cli/README.md b/gen/dfareporting2d1-cli/README.md index b3cc81d788a..2267c82050e 100644 --- a/gen/dfareporting2d1-cli/README.md +++ b/gen/dfareporting2d1-cli/README.md @@ -10,9 +10,12 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. +Everything else about the *dfareporting* API can be found at the +[official documentation site](https://developers.google.com/doubleclick-advertisers/reporting/). + # Usage -This documentation was generated from the *dfareporting* API at revision *20150326*. The CLI is at version *0.1.0*. +This documentation was generated from the *dfareporting* API at revision *20150326*. The CLI is at version *0.2.0*. ```bash dfareporting2d1 [options] account-active-ad-summaries get [-p ...] [-o ] @@ -211,7 +214,7 @@ This documentation was generated from the *dfareporting* API at revision *201503 dfareporting2d1 --help All documentation details can be found at -http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/index.html +http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli Configuration: --scope diff --git a/gen/dfareporting2d1-cli/mkdocs.yml b/gen/dfareporting2d1-cli/mkdocs.yml index fa56c8a8140..0cfabf34dbe 100644 --- a/gen/dfareporting2d1-cli/mkdocs.yml +++ b/gen/dfareporting2d1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: dfareporting v0.1.0+20150326 +site_name: dfareporting v0.2.0+20150326 site_url: http://byron.github.io/google-apis-rs/google-dfareporting2d1-cli site_description: Write integrating applications with bcore diff --git a/gen/dfareporting2d1-cli/src/cmn.rs b/gen/dfareporting2d1-cli/src/cmn.rs index 4ba65df6433..f07fb4dec5c 100644 --- a/gen/dfareporting2d1-cli/src/cmn.rs +++ b/gen/dfareporting2d1-cli/src/cmn.rs @@ -3,6 +3,7 @@ use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; use rustc_serialize::json; use mime::Mime; +use clap::{App, SubCommand}; use std::fs; use std::env; @@ -17,6 +18,22 @@ use std::default::Default; const FIELD_SEP: char = '.'; +/// Unused for now, can be used once https://github.com/kbknapp/clap-rs/issues/87 +/// is available +pub enum UploadProtocol { + Simple, + Resumable, +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable", + } + } +} + #[derive(Clone, Default)] pub struct FieldCursor(Vec); diff --git a/gen/dfareporting2d1-cli/src/main.rs b/gen/dfareporting2d1-cli/src/main.rs index 41ca80faf89..ddfbaebf25b 100644 --- a/gen/dfareporting2d1-cli/src/main.rs +++ b/gen/dfareporting2d1-cli/src/main.rs @@ -2,10 +2,9 @@ // This file was generated automatically from 'src/mako/cli/main.rs.mako' // DO NOT EDIT ! #![feature(plugin, exit_status)] -#![plugin(docopt_macros)] #![allow(unused_variables, unused_imports, dead_code, unused_mut)] -extern crate docopt; +extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate rustc_serialize; @@ -16,23480 +15,5952 @@ extern crate google_dfareporting2d1 as api; use std::env; use std::io::{self, Write}; - -docopt!(Options derive Debug, " -Usage: - dfareporting2d1 [options] account-active-ad-summaries get [-p ...] [-o ] - dfareporting2d1 [options] account-permission-groups get [-p ...] [-o ] - dfareporting2d1 [options] account-permission-groups list [-p ...] [-o ] - dfareporting2d1 [options] account-permissions get [-p ...] [-o ] - dfareporting2d1 [options] account-permissions list [-p ...] [-o ] - dfareporting2d1 [options] account-user-profiles get [-p ...] [-o ] - dfareporting2d1 [options] account-user-profiles insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] account-user-profiles list [-p ...] [-o ] - dfareporting2d1 [options] account-user-profiles patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] account-user-profiles update -r ... [-p ...] [-o ] - dfareporting2d1 [options] accounts get [-p ...] [-o ] - dfareporting2d1 [options] accounts list [-p ...] [-o ] - dfareporting2d1 [options] accounts patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] accounts update -r ... [-p ...] [-o ] - dfareporting2d1 [options] ads get [-p ...] [-o ] - dfareporting2d1 [options] ads insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] ads list [-p ...] [-o ] - dfareporting2d1 [options] ads patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] ads update -r ... [-p ...] [-o ] - dfareporting2d1 [options] advertiser-groups delete [-p ...] - dfareporting2d1 [options] advertiser-groups get [-p ...] [-o ] - dfareporting2d1 [options] advertiser-groups insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] advertiser-groups list [-p ...] [-o ] - dfareporting2d1 [options] advertiser-groups patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] advertiser-groups update -r ... [-p ...] [-o ] - dfareporting2d1 [options] advertisers get [-p ...] [-o ] - dfareporting2d1 [options] advertisers insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] advertisers list [-p ...] [-o ] - dfareporting2d1 [options] advertisers patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] advertisers update -r ... [-p ...] [-o ] - dfareporting2d1 [options] browsers list [-p ...] [-o ] - dfareporting2d1 [options] campaign-creative-associations insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] campaign-creative-associations list [-p ...] [-o ] - dfareporting2d1 [options] campaigns get [-p ...] [-o ] - dfareporting2d1 [options] campaigns insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] campaigns list [-p ...] [-o ] - dfareporting2d1 [options] campaigns patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] campaigns update -r ... [-p ...] [-o ] - dfareporting2d1 [options] change-logs get [-p ...] [-o ] - dfareporting2d1 [options] change-logs list [-p ...] [-o ] - dfareporting2d1 [options] cities list [-p ...] [-o ] - dfareporting2d1 [options] connection-types get [-p ...] [-o ] - dfareporting2d1 [options] connection-types list [-p ...] [-o ] - dfareporting2d1 [options] content-categories delete [-p ...] - dfareporting2d1 [options] content-categories get [-p ...] [-o ] - dfareporting2d1 [options] content-categories insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] content-categories list [-p ...] [-o ] - dfareporting2d1 [options] content-categories patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] content-categories update -r ... [-p ...] [-o ] - dfareporting2d1 [options] countries get [-p ...] [-o ] - dfareporting2d1 [options] countries list [-p ...] [-o ] - dfareporting2d1 [options] creative-assets insert -r ... -u (simple|resumable) [-p ...] [-o ] - dfareporting2d1 [options] creative-field-values delete [-p ...] - dfareporting2d1 [options] creative-field-values get [-p ...] [-o ] - dfareporting2d1 [options] creative-field-values insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-field-values list [-p ...] [-o ] - dfareporting2d1 [options] creative-field-values patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-field-values update -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-fields delete [-p ...] - dfareporting2d1 [options] creative-fields get [-p ...] [-o ] - dfareporting2d1 [options] creative-fields insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-fields list [-p ...] [-o ] - dfareporting2d1 [options] creative-fields patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-fields update -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-groups get [-p ...] [-o ] - dfareporting2d1 [options] creative-groups insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-groups list [-p ...] [-o ] - dfareporting2d1 [options] creative-groups patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] creative-groups update -r ... [-p ...] [-o ] - dfareporting2d1 [options] creatives get [-p ...] [-o ] - dfareporting2d1 [options] creatives insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] creatives list [-p ...] [-o ] - dfareporting2d1 [options] creatives patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] creatives update -r ... [-p ...] [-o ] - dfareporting2d1 [options] dimension-values query -r ... [-p ...] [-o ] - dfareporting2d1 [options] directory-site-contacts get [-p ...] [-o ] - dfareporting2d1 [options] directory-site-contacts list [-p ...] [-o ] - dfareporting2d1 [options] directory-sites get [-p ...] [-o ] - dfareporting2d1 [options] directory-sites insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] directory-sites list [-p ...] [-o ] - dfareporting2d1 [options] event-tags delete [-p ...] - dfareporting2d1 [options] event-tags get [-p ...] [-o ] - dfareporting2d1 [options] event-tags insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] event-tags list [-p ...] [-o ] - dfareporting2d1 [options] event-tags patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] event-tags update -r ... [-p ...] [-o ] - dfareporting2d1 [options] files get [-p ...] [-o ] - dfareporting2d1 [options] files list [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activities delete [-p ...] - dfareporting2d1 [options] floodlight-activities generatetag [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activities get [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activities insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activities list [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activities patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activities update -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activity-groups delete [-p ...] - dfareporting2d1 [options] floodlight-activity-groups get [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activity-groups insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activity-groups list [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activity-groups patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-activity-groups update -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-configurations get [-p ...] [-o ] - dfareporting2d1 [options] floodlight-configurations list [-p ...] [-o ] - dfareporting2d1 [options] floodlight-configurations patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] floodlight-configurations update -r ... [-p ...] [-o ] - dfareporting2d1 [options] inventory-items get [-p ...] [-o ] - dfareporting2d1 [options] inventory-items list [-p ...] [-o ] - dfareporting2d1 [options] landing-pages delete [-p ...] - dfareporting2d1 [options] landing-pages get [-p ...] [-o ] - dfareporting2d1 [options] landing-pages insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] landing-pages list [-p ...] [-o ] - dfareporting2d1 [options] landing-pages patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] landing-pages update -r ... [-p ...] [-o ] - dfareporting2d1 [options] metros list [-p ...] [-o ] - dfareporting2d1 [options] mobile-carriers get [-p ...] [-o ] - dfareporting2d1 [options] mobile-carriers list [-p ...] [-o ] - dfareporting2d1 [options] operating-system-versions get [-p ...] [-o ] - dfareporting2d1 [options] operating-system-versions list [-p ...] [-o ] - dfareporting2d1 [options] operating-systems get [-p ...] [-o ] - dfareporting2d1 [options] operating-systems list [-p ...] [-o ] - dfareporting2d1 [options] order-documents get [-p ...] [-o ] - dfareporting2d1 [options] order-documents list [-p ...] [-o ] - dfareporting2d1 [options] orders get [-p ...] [-o ] - dfareporting2d1 [options] orders list [-p ...] [-o ] - dfareporting2d1 [options] placement-groups get [-p ...] [-o ] - dfareporting2d1 [options] placement-groups insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] placement-groups list [-p ...] [-o ] - dfareporting2d1 [options] placement-groups patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] placement-groups update -r ... [-p ...] [-o ] - dfareporting2d1 [options] placement-strategies delete [-p ...] - dfareporting2d1 [options] placement-strategies get [-p ...] [-o ] - dfareporting2d1 [options] placement-strategies insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] placement-strategies list [-p ...] [-o ] - dfareporting2d1 [options] placement-strategies patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] placement-strategies update -r ... [-p ...] [-o ] - dfareporting2d1 [options] placements generatetags [-p ...] [-o ] - dfareporting2d1 [options] placements get [-p ...] [-o ] - dfareporting2d1 [options] placements insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] placements list [-p ...] [-o ] - dfareporting2d1 [options] placements patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] placements update -r ... [-p ...] [-o ] - dfareporting2d1 [options] platform-types get [-p ...] [-o ] - dfareporting2d1 [options] platform-types list [-p ...] [-o ] - dfareporting2d1 [options] postal-codes get [-p ...] [-o ] - dfareporting2d1 [options] postal-codes list [-p ...] [-o ] - dfareporting2d1 [options] projects get [-p ...] [-o ] - dfareporting2d1 [options] projects list [-p ...] [-o ] - dfareporting2d1 [options] regions list [-p ...] [-o ] - dfareporting2d1 [options] remarketing-list-shares get [-p ...] [-o ] - dfareporting2d1 [options] remarketing-list-shares patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] remarketing-list-shares update -r ... [-p ...] [-o ] - dfareporting2d1 [options] remarketing-lists get [-p ...] [-o ] - dfareporting2d1 [options] remarketing-lists insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] remarketing-lists list [-p ...] [-o ] - dfareporting2d1 [options] remarketing-lists patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] remarketing-lists update -r ... [-p ...] [-o ] - dfareporting2d1 [options] reports compatible-fields-query -r ... [-p ...] [-o ] - dfareporting2d1 [options] reports delete [-p ...] - dfareporting2d1 [options] reports files-get [-p ...] [-o ] - dfareporting2d1 [options] reports files-list [-p ...] [-o ] - dfareporting2d1 [options] reports get [-p ...] [-o ] - dfareporting2d1 [options] reports insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] reports list [-p ...] [-o ] - dfareporting2d1 [options] reports patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] reports run [-p ...] [-o ] - dfareporting2d1 [options] reports update -r ... [-p ...] [-o ] - dfareporting2d1 [options] sites get [-p ...] [-o ] - dfareporting2d1 [options] sites insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] sites list [-p ...] [-o ] - dfareporting2d1 [options] sites patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] sites update -r ... [-p ...] [-o ] - dfareporting2d1 [options] sizes get [-p ...] [-o ] - dfareporting2d1 [options] sizes insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] sizes list [-p ...] [-o ] - dfareporting2d1 [options] subaccounts get [-p ...] [-o ] - dfareporting2d1 [options] subaccounts insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] subaccounts list [-p ...] [-o ] - dfareporting2d1 [options] subaccounts patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] subaccounts update -r ... [-p ...] [-o ] - dfareporting2d1 [options] targetable-remarketing-lists get [-p ...] [-o ] - dfareporting2d1 [options] targetable-remarketing-lists list [-p ...] [-o ] - dfareporting2d1 [options] user-profiles get [-p ...] [-o ] - dfareporting2d1 [options] user-profiles list [-p ...] [-o ] - dfareporting2d1 [options] user-role-permission-groups get [-p ...] [-o ] - dfareporting2d1 [options] user-role-permission-groups list [-p ...] [-o ] - dfareporting2d1 [options] user-role-permissions get [-p ...] [-o ] - dfareporting2d1 [options] user-role-permissions list [-p ...] [-o ] - dfareporting2d1 [options] user-roles delete [-p ...] - dfareporting2d1 [options] user-roles get [-p ...] [-o ] - dfareporting2d1 [options] user-roles insert -r ... [-p ...] [-o ] - dfareporting2d1 [options] user-roles list [-p ...] [-o ] - dfareporting2d1 [options] user-roles patch -r ... [-p ...] [-o ] - dfareporting2d1 [options] user-roles update -r ... [-p ...] [-o ] - dfareporting2d1 --help - -All documentation details can be found at -http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli/index.html - -Configuration: - --scope - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. - If unset, it defaults to the shortest scope url for a particular method. - --config-dir - A directory into which we will store our persistent data. Defaults to - a user-writable directory that we will create during the first invocation. - [default: ~/.google-service-cli] - --debug - Output all server communication to standard error. `tx` and `rx` are placed - into the same stream. - --debug-auth - Output all communication related to authentication to standard error. `tx` - and `rx` are placed into the same stream. -"); +use clap::{App, SubCommand, Arg}; mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, - input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError}; - -use std::default::Default; -use std::str::FromStr; - -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use rustc_serialize::json; - -struct Engine { - opt: Options, - hub: api::Dfareporting>, -} - - -impl Engine { - fn _account_active_ad_summaries_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_active_ad_summaries().get(&self.opt.arg_profile_id, &self.opt.arg_summary_account_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_permission_groups_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_permission_groups().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_permission_groups_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_permission_groups().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_permissions_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_permissions().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_permissions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_permissions().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_user_profiles_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_user_profiles().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_user_profiles_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::AccountUserProfile::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_filter_init(request: &mut api::AccountUserProfile) { - if request.advertiser_filter.is_none() { - request.advertiser_filter = Some(Default::default()); - } - } - - fn request_campaign_filter_init(request: &mut api::AccountUserProfile) { - if request.campaign_filter.is_none() { - request.campaign_filter = Some(Default::default()); - } - } - - fn request_site_filter_init(request: &mut api::AccountUserProfile) { - if request.site_filter.is_none() { - request.site_filter = Some(Default::default()); - } - } - - fn request_user_role_filter_init(request: &mut api::AccountUserProfile) { - if request.user_role_filter.is_none() { - request.user_role_filter = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "user-role-filter.object-ids" => { - request_user_role_filter_init(&mut request); - if request.user_role_filter.as_mut().unwrap().object_ids.is_none() { - request.user_role_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.user_role_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "user-role-filter.status" => { - request_user_role_filter_init(&mut request); - request.user_role_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "user-role-filter.kind" => { - request_user_role_filter_init(&mut request); - request.user_role_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_user_role_filter_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "locale" => { - request_user_role_filter_init(&mut request); - request.locale = Some(value.unwrap_or("").to_string()); - }, - "site-filter.object-ids" => { - request_site_filter_init(&mut request); - if request.site_filter.as_mut().unwrap().object_ids.is_none() { - request.site_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.site_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "site-filter.status" => { - request_site_filter_init(&mut request); - request.site_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "site-filter.kind" => { - request_site_filter_init(&mut request); - request.site_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "comments" => { - request_site_filter_init(&mut request); - request.comments = Some(value.unwrap_or("").to_string()); - }, - "trafficker-type" => { - request_site_filter_init(&mut request); - request.trafficker_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-filter.object-ids" => { - request_advertiser_filter_init(&mut request); - if request.advertiser_filter.as_mut().unwrap().object_ids.is_none() { - request.advertiser_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.advertiser_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "advertiser-filter.status" => { - request_advertiser_filter_init(&mut request); - request.advertiser_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "advertiser-filter.kind" => { - request_advertiser_filter_init(&mut request); - request.advertiser_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-filter.object-ids" => { - request_campaign_filter_init(&mut request); - if request.campaign_filter.as_mut().unwrap().object_ids.is_none() { - request.campaign_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.campaign_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "campaign-filter.status" => { - request_campaign_filter_init(&mut request); - request.campaign_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "campaign-filter.kind" => { - request_campaign_filter_init(&mut request); - request.campaign_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "email" => { - request_campaign_filter_init(&mut request); - request.email = Some(value.unwrap_or("").to_string()); - }, - "user-role-id" => { - request_campaign_filter_init(&mut request); - request.user_role_id = Some(value.unwrap_or("").to_string()); - }, - "user-access-type" => { - request_campaign_filter_init(&mut request); - request.user_access_type = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_campaign_filter_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "id" => { - request_campaign_filter_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_campaign_filter_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.account_user_profiles().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_user_profiles_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.account_user_profiles().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "user-role-id" => { - call = call.user_role_id(value.unwrap_or("")); - }, - "subaccount-id" => { - call = call.subaccount_id(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_user_profiles_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::AccountUserProfile::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_filter_init(request: &mut api::AccountUserProfile) { - if request.advertiser_filter.is_none() { - request.advertiser_filter = Some(Default::default()); - } - } - - fn request_campaign_filter_init(request: &mut api::AccountUserProfile) { - if request.campaign_filter.is_none() { - request.campaign_filter = Some(Default::default()); - } - } - - fn request_site_filter_init(request: &mut api::AccountUserProfile) { - if request.site_filter.is_none() { - request.site_filter = Some(Default::default()); - } - } - - fn request_user_role_filter_init(request: &mut api::AccountUserProfile) { - if request.user_role_filter.is_none() { - request.user_role_filter = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "user-role-filter.object-ids" => { - request_user_role_filter_init(&mut request); - if request.user_role_filter.as_mut().unwrap().object_ids.is_none() { - request.user_role_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.user_role_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "user-role-filter.status" => { - request_user_role_filter_init(&mut request); - request.user_role_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "user-role-filter.kind" => { - request_user_role_filter_init(&mut request); - request.user_role_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_user_role_filter_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "locale" => { - request_user_role_filter_init(&mut request); - request.locale = Some(value.unwrap_or("").to_string()); - }, - "site-filter.object-ids" => { - request_site_filter_init(&mut request); - if request.site_filter.as_mut().unwrap().object_ids.is_none() { - request.site_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.site_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "site-filter.status" => { - request_site_filter_init(&mut request); - request.site_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "site-filter.kind" => { - request_site_filter_init(&mut request); - request.site_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "comments" => { - request_site_filter_init(&mut request); - request.comments = Some(value.unwrap_or("").to_string()); - }, - "trafficker-type" => { - request_site_filter_init(&mut request); - request.trafficker_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-filter.object-ids" => { - request_advertiser_filter_init(&mut request); - if request.advertiser_filter.as_mut().unwrap().object_ids.is_none() { - request.advertiser_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.advertiser_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "advertiser-filter.status" => { - request_advertiser_filter_init(&mut request); - request.advertiser_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "advertiser-filter.kind" => { - request_advertiser_filter_init(&mut request); - request.advertiser_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-filter.object-ids" => { - request_campaign_filter_init(&mut request); - if request.campaign_filter.as_mut().unwrap().object_ids.is_none() { - request.campaign_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.campaign_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "campaign-filter.status" => { - request_campaign_filter_init(&mut request); - request.campaign_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "campaign-filter.kind" => { - request_campaign_filter_init(&mut request); - request.campaign_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "email" => { - request_campaign_filter_init(&mut request); - request.email = Some(value.unwrap_or("").to_string()); - }, - "user-role-id" => { - request_campaign_filter_init(&mut request); - request.user_role_id = Some(value.unwrap_or("").to_string()); - }, - "user-access-type" => { - request_campaign_filter_init(&mut request); - request.user_access_type = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_campaign_filter_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "id" => { - request_campaign_filter_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_campaign_filter_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.account_user_profiles().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _account_user_profiles_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::AccountUserProfile::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_filter_init(request: &mut api::AccountUserProfile) { - if request.advertiser_filter.is_none() { - request.advertiser_filter = Some(Default::default()); - } - } - - fn request_campaign_filter_init(request: &mut api::AccountUserProfile) { - if request.campaign_filter.is_none() { - request.campaign_filter = Some(Default::default()); - } - } - - fn request_site_filter_init(request: &mut api::AccountUserProfile) { - if request.site_filter.is_none() { - request.site_filter = Some(Default::default()); - } - } - - fn request_user_role_filter_init(request: &mut api::AccountUserProfile) { - if request.user_role_filter.is_none() { - request.user_role_filter = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "user-role-filter.object-ids" => { - request_user_role_filter_init(&mut request); - if request.user_role_filter.as_mut().unwrap().object_ids.is_none() { - request.user_role_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.user_role_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "user-role-filter.status" => { - request_user_role_filter_init(&mut request); - request.user_role_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "user-role-filter.kind" => { - request_user_role_filter_init(&mut request); - request.user_role_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_user_role_filter_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "locale" => { - request_user_role_filter_init(&mut request); - request.locale = Some(value.unwrap_or("").to_string()); - }, - "site-filter.object-ids" => { - request_site_filter_init(&mut request); - if request.site_filter.as_mut().unwrap().object_ids.is_none() { - request.site_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.site_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "site-filter.status" => { - request_site_filter_init(&mut request); - request.site_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "site-filter.kind" => { - request_site_filter_init(&mut request); - request.site_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "comments" => { - request_site_filter_init(&mut request); - request.comments = Some(value.unwrap_or("").to_string()); - }, - "trafficker-type" => { - request_site_filter_init(&mut request); - request.trafficker_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-filter.object-ids" => { - request_advertiser_filter_init(&mut request); - if request.advertiser_filter.as_mut().unwrap().object_ids.is_none() { - request.advertiser_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.advertiser_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "advertiser-filter.status" => { - request_advertiser_filter_init(&mut request); - request.advertiser_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "advertiser-filter.kind" => { - request_advertiser_filter_init(&mut request); - request.advertiser_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-filter.object-ids" => { - request_campaign_filter_init(&mut request); - if request.campaign_filter.as_mut().unwrap().object_ids.is_none() { - request.campaign_filter.as_mut().unwrap().object_ids = Some(Default::default()); - } - request.campaign_filter.as_mut().unwrap().object_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "campaign-filter.status" => { - request_campaign_filter_init(&mut request); - request.campaign_filter.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "campaign-filter.kind" => { - request_campaign_filter_init(&mut request); - request.campaign_filter.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "email" => { - request_campaign_filter_init(&mut request); - request.email = Some(value.unwrap_or("").to_string()); - }, - "user-role-id" => { - request_campaign_filter_init(&mut request); - request.user_role_id = Some(value.unwrap_or("").to_string()); - }, - "user-access-type" => { - request_campaign_filter_init(&mut request); - request.user_access_type = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_campaign_filter_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "id" => { - request_campaign_filter_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_campaign_filter_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.account_user_profiles().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _accounts_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.accounts().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _accounts_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.accounts().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _accounts_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Account::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_reports_configuration_init(request: &mut api::Account) { - if request.reports_configuration.is_none() { - request.reports_configuration = Some(Default::default()); - } - } - - fn request_reports_configuration_lookback_configuration_init(request: &mut api::Account) { - request_reports_configuration_init(request); - if request.reports_configuration.as_mut().unwrap().lookback_configuration.is_none() { - request.reports_configuration.as_mut().unwrap().lookback_configuration = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "teaser-size-limit" => { - request.teaser_size_limit = Some(value.unwrap_or("").to_string()); - }, - "active-view-opt-out" => { - request.active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "active-view-opt-out", "boolean")); - }, - "description" => { - request.description = Some(value.unwrap_or("").to_string()); - }, - "maximum-image-size" => { - request.maximum_image_size = Some(value.unwrap_or("").to_string()); - }, - "locale" => { - request.locale = Some(value.unwrap_or("").to_string()); - }, - "default-creative-size-id" => { - request.default_creative_size_id = Some(value.unwrap_or("").to_string()); - }, - "account-permission-ids" => { - if request.account_permission_ids.is_none() { - request.account_permission_ids = Some(Default::default()); - } - request.account_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "account-profile" => { - request.account_profile = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "nielsen-ocr-enabled" => { - request.nielsen_ocr_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "nielsen-ocr-enabled", "boolean")); - }, - "reports-configuration.report-generation-time-zone-id" => { - request_reports_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().report_generation_time_zone_id = Some(value.unwrap_or("").to_string()); - }, - "reports-configuration.exposure-to-conversion-enabled" => { - request_reports_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().exposure_to_conversion_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "reports-configuration.exposure-to-conversion-enabled", "boolean")); - }, - "reports-configuration.lookback-configuration.click-duration" => { - request_reports_configuration_lookback_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "reports-configuration.lookback-configuration.click-duration", "integer")); - }, - "reports-configuration.lookback-configuration.post-impression-activities-duration" => { - request_reports_configuration_lookback_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "reports-configuration.lookback-configuration.post-impression-activities-duration", "integer")); - }, - "currency-id" => { - request_reports_configuration_init(&mut request); - request.currency_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_reports_configuration_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "comscore-vce-enabled" => { - request_reports_configuration_init(&mut request); - request.comscore_vce_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "comscore-vce-enabled", "boolean")); - }, - "active-ads-limit-tier" => { - request_reports_configuration_init(&mut request); - request.active_ads_limit_tier = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_reports_configuration_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "country-id" => { - request_reports_configuration_init(&mut request); - request.country_id = Some(value.unwrap_or("").to_string()); - }, - "available-permission-ids" => { - request_reports_configuration_init(&mut request); - if request.available_permission_ids.is_none() { - request.available_permission_ids = Some(Default::default()); - } - request.available_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.accounts().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _accounts_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Account::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_reports_configuration_init(request: &mut api::Account) { - if request.reports_configuration.is_none() { - request.reports_configuration = Some(Default::default()); - } - } - - fn request_reports_configuration_lookback_configuration_init(request: &mut api::Account) { - request_reports_configuration_init(request); - if request.reports_configuration.as_mut().unwrap().lookback_configuration.is_none() { - request.reports_configuration.as_mut().unwrap().lookback_configuration = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "teaser-size-limit" => { - request.teaser_size_limit = Some(value.unwrap_or("").to_string()); - }, - "active-view-opt-out" => { - request.active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "active-view-opt-out", "boolean")); - }, - "description" => { - request.description = Some(value.unwrap_or("").to_string()); - }, - "maximum-image-size" => { - request.maximum_image_size = Some(value.unwrap_or("").to_string()); - }, - "locale" => { - request.locale = Some(value.unwrap_or("").to_string()); - }, - "default-creative-size-id" => { - request.default_creative_size_id = Some(value.unwrap_or("").to_string()); - }, - "account-permission-ids" => { - if request.account_permission_ids.is_none() { - request.account_permission_ids = Some(Default::default()); - } - request.account_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "account-profile" => { - request.account_profile = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "nielsen-ocr-enabled" => { - request.nielsen_ocr_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "nielsen-ocr-enabled", "boolean")); - }, - "reports-configuration.report-generation-time-zone-id" => { - request_reports_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().report_generation_time_zone_id = Some(value.unwrap_or("").to_string()); - }, - "reports-configuration.exposure-to-conversion-enabled" => { - request_reports_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().exposure_to_conversion_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "reports-configuration.exposure-to-conversion-enabled", "boolean")); - }, - "reports-configuration.lookback-configuration.click-duration" => { - request_reports_configuration_lookback_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "reports-configuration.lookback-configuration.click-duration", "integer")); - }, - "reports-configuration.lookback-configuration.post-impression-activities-duration" => { - request_reports_configuration_lookback_configuration_init(&mut request); - request.reports_configuration.as_mut().unwrap().lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "reports-configuration.lookback-configuration.post-impression-activities-duration", "integer")); - }, - "currency-id" => { - request_reports_configuration_init(&mut request); - request.currency_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_reports_configuration_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "comscore-vce-enabled" => { - request_reports_configuration_init(&mut request); - request.comscore_vce_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "comscore-vce-enabled", "boolean")); - }, - "active-ads-limit-tier" => { - request_reports_configuration_init(&mut request); - request.active_ads_limit_tier = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_reports_configuration_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "country-id" => { - request_reports_configuration_init(&mut request); - request.country_id = Some(value.unwrap_or("").to_string()); - }, - "available-permission-ids" => { - request_reports_configuration_init(&mut request); - if request.available_permission_ids.is_none() { - request.available_permission_ids = Some(Default::default()); - } - request.available_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.accounts().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _ads_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.ads().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _ads_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Ad::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Ad) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::Ad) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_click_through_url_init(request: &mut api::Ad) { - if request.click_through_url.is_none() { - request.click_through_url = Some(Default::default()); - } - } - - fn request_click_through_url_suffix_properties_init(request: &mut api::Ad) { - if request.click_through_url_suffix_properties.is_none() { - request.click_through_url_suffix_properties = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Ad) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_creative_rotation_init(request: &mut api::Ad) { - if request.creative_rotation.is_none() { - request.creative_rotation = Some(Default::default()); - } - } - - fn request_day_part_targeting_init(request: &mut api::Ad) { - if request.day_part_targeting.is_none() { - request.day_part_targeting = Some(Default::default()); - } - } - - fn request_default_click_through_event_tag_properties_init(request: &mut api::Ad) { - if request.default_click_through_event_tag_properties.is_none() { - request.default_click_through_event_tag_properties = Some(Default::default()); - } - } - - fn request_delivery_schedule_frequency_cap_init(request: &mut api::Ad) { - request_delivery_schedule_init(request); - if request.delivery_schedule.as_mut().unwrap().frequency_cap.is_none() { - request.delivery_schedule.as_mut().unwrap().frequency_cap = Some(Default::default()); - } - } - - fn request_delivery_schedule_init(request: &mut api::Ad) { - if request.delivery_schedule.is_none() { - request.delivery_schedule = Some(Default::default()); - } - } - - fn request_geo_targeting_init(request: &mut api::Ad) { - if request.geo_targeting.is_none() { - request.geo_targeting = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Ad) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_key_value_targeting_expression_init(request: &mut api::Ad) { - if request.key_value_targeting_expression.is_none() { - request.key_value_targeting_expression = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Ad) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_remarketing_list_expression_init(request: &mut api::Ad) { - if request.remarketing_list_expression.is_none() { - request.remarketing_list_expression = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Ad) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "click-through-url-suffix-properties.click-through-url-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.override-inherited-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().override_inherited_suffix = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url-suffix-properties.override-inherited-suffix", "boolean")); - }, - "campaign-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "geo-targeting.exclude-countries" => { - request_geo_targeting_init(&mut request); - request.geo_targeting.as_mut().unwrap().exclude_countries = Some(arg_from_str(value.unwrap_or("false"), err, "geo-targeting.exclude-countries", "boolean")); - }, - "delivery-schedule.priority" => { - request_delivery_schedule_init(&mut request); - request.delivery_schedule.as_mut().unwrap().priority = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.hard-cutoff" => { - request_delivery_schedule_init(&mut request); - request.delivery_schedule.as_mut().unwrap().hard_cutoff = Some(arg_from_str(value.unwrap_or("false"), err, "delivery-schedule.hard-cutoff", "boolean")); - }, - "delivery-schedule.frequency-cap.duration" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().frequency_cap.as_mut().unwrap().duration = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.frequency-cap.impressions" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().frequency_cap.as_mut().unwrap().impressions = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.impression-ratio" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().impression_ratio = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "remarketing-list-expression.expression" => { - request_remarketing_list_expression_init(&mut request); - request.remarketing_list_expression.as_mut().unwrap().expression = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_remarketing_list_expression_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_remarketing_list_expression_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "creative-rotation.weight-calculation-strategy" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().weight_calculation_strategy = Some(value.unwrap_or("").to_string()); - }, - "creative-rotation.creative-optimization-configuration-id" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().creative_optimization_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "creative-rotation.type" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.landing-page-id" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().landing_page_id = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.custom-click-through-url" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().custom_click_through_url = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.default-landing-page" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().default_landing_page = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url.default-landing-page", "boolean")); - }, - "comments" => { - request_click_through_url_init(&mut request); - request.comments = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "type" => { - request_size_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_size_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "audience-segment-id" => { - request_size_init(&mut request); - request.audience_segment_id = Some(value.unwrap_or("").to_string()); - }, - "key-value-targeting-expression.expression" => { - request_key_value_targeting_expression_init(&mut request); - request.key_value_targeting_expression.as_mut().unwrap().expression = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-properties.override-inherited-event-tag" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().override_inherited_event_tag = Some(arg_from_str(value.unwrap_or("false"), err, "default-click-through-event-tag-properties.override-inherited-event-tag", "boolean")); - }, - "default-click-through-event-tag-properties.default-click-through-event-tag-id" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "start-time" => { - request_create_info_init(&mut request); - request.start_time = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_create_info_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "compatibility" => { - request_create_info_init(&mut request); - request.compatibility = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_create_info_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_create_info_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_create_info_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "day-part-targeting.user-local-time" => { - request_day_part_targeting_init(&mut request); - request.day_part_targeting.as_mut().unwrap().user_local_time = Some(arg_from_str(value.unwrap_or("false"), err, "day-part-targeting.user-local-time", "boolean")); - }, - "day-part-targeting.hours-of-day" => { - request_day_part_targeting_init(&mut request); - if request.day_part_targeting.as_mut().unwrap().hours_of_day.is_none() { - request.day_part_targeting.as_mut().unwrap().hours_of_day = Some(Default::default()); - } - request.day_part_targeting.as_mut().unwrap().hours_of_day.as_mut().unwrap().push(arg_from_str(value.unwrap_or("-0"), err, "day-part-targeting.hours-of-day", "integer")); - }, - "day-part-targeting.days-of-week" => { - request_day_part_targeting_init(&mut request); - if request.day_part_targeting.as_mut().unwrap().days_of_week.is_none() { - request.day_part_targeting.as_mut().unwrap().days_of_week = Some(Default::default()); - } - request.day_part_targeting.as_mut().unwrap().days_of_week.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_last_modified_info_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "end-time" => { - request_last_modified_info_init(&mut request); - request.end_time = Some(value.unwrap_or("").to_string()); - }, - "dynamic-click-tracker" => { - request_last_modified_info_init(&mut request); - request.dynamic_click_tracker = Some(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.ads().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _ads_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.ads().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "type" => { - call = call.add_type(value.unwrap_or("")); - }, - "ssl-required" => { - call = call.ssl_required(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "ssl-compliant" => { - call = call.ssl_compliant(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "size-ids" => { - call = call.add_size_ids(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "remarketing-list-ids" => { - call = call.add_remarketing_list_ids(value.unwrap_or("")); - }, - "placement-ids" => { - call = call.add_placement_ids(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "overridden-event-tag-id" => { - call = call.overridden_event_tag_id(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "landing-page-ids" => { - call = call.add_landing_page_ids(value.unwrap_or("")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "dynamic-click-tracker" => { - call = call.dynamic_click_tracker(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); - }, - "creative-type" => { - call = call.creative_type(value.unwrap_or("")); - }, - "creative-optimization-configuration-ids" => { - call = call.add_creative_optimization_configuration_ids(value.unwrap_or("")); - }, - "creative-ids" => { - call = call.add_creative_ids(value.unwrap_or("")); - }, - "compatibility" => { - call = call.compatibility(value.unwrap_or("")); - }, - "campaign-ids" => { - call = call.add_campaign_ids(value.unwrap_or("")); - }, - "audience-segment-ids" => { - call = call.add_audience_segment_ids(value.unwrap_or("")); - }, - "archived" => { - call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "advertiser-id" => { - call = call.advertiser_id(value.unwrap_or("")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _ads_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Ad::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Ad) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::Ad) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_click_through_url_init(request: &mut api::Ad) { - if request.click_through_url.is_none() { - request.click_through_url = Some(Default::default()); - } - } - - fn request_click_through_url_suffix_properties_init(request: &mut api::Ad) { - if request.click_through_url_suffix_properties.is_none() { - request.click_through_url_suffix_properties = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Ad) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_creative_rotation_init(request: &mut api::Ad) { - if request.creative_rotation.is_none() { - request.creative_rotation = Some(Default::default()); - } - } - - fn request_day_part_targeting_init(request: &mut api::Ad) { - if request.day_part_targeting.is_none() { - request.day_part_targeting = Some(Default::default()); - } - } - - fn request_default_click_through_event_tag_properties_init(request: &mut api::Ad) { - if request.default_click_through_event_tag_properties.is_none() { - request.default_click_through_event_tag_properties = Some(Default::default()); - } - } - - fn request_delivery_schedule_frequency_cap_init(request: &mut api::Ad) { - request_delivery_schedule_init(request); - if request.delivery_schedule.as_mut().unwrap().frequency_cap.is_none() { - request.delivery_schedule.as_mut().unwrap().frequency_cap = Some(Default::default()); - } - } - - fn request_delivery_schedule_init(request: &mut api::Ad) { - if request.delivery_schedule.is_none() { - request.delivery_schedule = Some(Default::default()); - } - } - - fn request_geo_targeting_init(request: &mut api::Ad) { - if request.geo_targeting.is_none() { - request.geo_targeting = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Ad) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_key_value_targeting_expression_init(request: &mut api::Ad) { - if request.key_value_targeting_expression.is_none() { - request.key_value_targeting_expression = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Ad) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_remarketing_list_expression_init(request: &mut api::Ad) { - if request.remarketing_list_expression.is_none() { - request.remarketing_list_expression = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Ad) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "click-through-url-suffix-properties.click-through-url-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.override-inherited-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().override_inherited_suffix = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url-suffix-properties.override-inherited-suffix", "boolean")); - }, - "campaign-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "geo-targeting.exclude-countries" => { - request_geo_targeting_init(&mut request); - request.geo_targeting.as_mut().unwrap().exclude_countries = Some(arg_from_str(value.unwrap_or("false"), err, "geo-targeting.exclude-countries", "boolean")); - }, - "delivery-schedule.priority" => { - request_delivery_schedule_init(&mut request); - request.delivery_schedule.as_mut().unwrap().priority = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.hard-cutoff" => { - request_delivery_schedule_init(&mut request); - request.delivery_schedule.as_mut().unwrap().hard_cutoff = Some(arg_from_str(value.unwrap_or("false"), err, "delivery-schedule.hard-cutoff", "boolean")); - }, - "delivery-schedule.frequency-cap.duration" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().frequency_cap.as_mut().unwrap().duration = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.frequency-cap.impressions" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().frequency_cap.as_mut().unwrap().impressions = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.impression-ratio" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().impression_ratio = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "remarketing-list-expression.expression" => { - request_remarketing_list_expression_init(&mut request); - request.remarketing_list_expression.as_mut().unwrap().expression = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_remarketing_list_expression_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_remarketing_list_expression_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "creative-rotation.weight-calculation-strategy" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().weight_calculation_strategy = Some(value.unwrap_or("").to_string()); - }, - "creative-rotation.creative-optimization-configuration-id" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().creative_optimization_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "creative-rotation.type" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.landing-page-id" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().landing_page_id = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.custom-click-through-url" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().custom_click_through_url = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.default-landing-page" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().default_landing_page = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url.default-landing-page", "boolean")); - }, - "comments" => { - request_click_through_url_init(&mut request); - request.comments = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "type" => { - request_size_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_size_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "audience-segment-id" => { - request_size_init(&mut request); - request.audience_segment_id = Some(value.unwrap_or("").to_string()); - }, - "key-value-targeting-expression.expression" => { - request_key_value_targeting_expression_init(&mut request); - request.key_value_targeting_expression.as_mut().unwrap().expression = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-properties.override-inherited-event-tag" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().override_inherited_event_tag = Some(arg_from_str(value.unwrap_or("false"), err, "default-click-through-event-tag-properties.override-inherited-event-tag", "boolean")); - }, - "default-click-through-event-tag-properties.default-click-through-event-tag-id" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "start-time" => { - request_create_info_init(&mut request); - request.start_time = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_create_info_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "compatibility" => { - request_create_info_init(&mut request); - request.compatibility = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_create_info_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_create_info_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_create_info_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "day-part-targeting.user-local-time" => { - request_day_part_targeting_init(&mut request); - request.day_part_targeting.as_mut().unwrap().user_local_time = Some(arg_from_str(value.unwrap_or("false"), err, "day-part-targeting.user-local-time", "boolean")); - }, - "day-part-targeting.hours-of-day" => { - request_day_part_targeting_init(&mut request); - if request.day_part_targeting.as_mut().unwrap().hours_of_day.is_none() { - request.day_part_targeting.as_mut().unwrap().hours_of_day = Some(Default::default()); - } - request.day_part_targeting.as_mut().unwrap().hours_of_day.as_mut().unwrap().push(arg_from_str(value.unwrap_or("-0"), err, "day-part-targeting.hours-of-day", "integer")); - }, - "day-part-targeting.days-of-week" => { - request_day_part_targeting_init(&mut request); - if request.day_part_targeting.as_mut().unwrap().days_of_week.is_none() { - request.day_part_targeting.as_mut().unwrap().days_of_week = Some(Default::default()); - } - request.day_part_targeting.as_mut().unwrap().days_of_week.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_last_modified_info_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "end-time" => { - request_last_modified_info_init(&mut request); - request.end_time = Some(value.unwrap_or("").to_string()); - }, - "dynamic-click-tracker" => { - request_last_modified_info_init(&mut request); - request.dynamic_click_tracker = Some(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.ads().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _ads_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Ad::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Ad) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::Ad) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_click_through_url_init(request: &mut api::Ad) { - if request.click_through_url.is_none() { - request.click_through_url = Some(Default::default()); - } - } - - fn request_click_through_url_suffix_properties_init(request: &mut api::Ad) { - if request.click_through_url_suffix_properties.is_none() { - request.click_through_url_suffix_properties = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Ad) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_creative_rotation_init(request: &mut api::Ad) { - if request.creative_rotation.is_none() { - request.creative_rotation = Some(Default::default()); - } - } - - fn request_day_part_targeting_init(request: &mut api::Ad) { - if request.day_part_targeting.is_none() { - request.day_part_targeting = Some(Default::default()); - } - } - - fn request_default_click_through_event_tag_properties_init(request: &mut api::Ad) { - if request.default_click_through_event_tag_properties.is_none() { - request.default_click_through_event_tag_properties = Some(Default::default()); - } - } - - fn request_delivery_schedule_frequency_cap_init(request: &mut api::Ad) { - request_delivery_schedule_init(request); - if request.delivery_schedule.as_mut().unwrap().frequency_cap.is_none() { - request.delivery_schedule.as_mut().unwrap().frequency_cap = Some(Default::default()); - } - } - - fn request_delivery_schedule_init(request: &mut api::Ad) { - if request.delivery_schedule.is_none() { - request.delivery_schedule = Some(Default::default()); - } - } - - fn request_geo_targeting_init(request: &mut api::Ad) { - if request.geo_targeting.is_none() { - request.geo_targeting = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Ad) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_key_value_targeting_expression_init(request: &mut api::Ad) { - if request.key_value_targeting_expression.is_none() { - request.key_value_targeting_expression = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Ad) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_remarketing_list_expression_init(request: &mut api::Ad) { - if request.remarketing_list_expression.is_none() { - request.remarketing_list_expression = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Ad) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "click-through-url-suffix-properties.click-through-url-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.override-inherited-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().override_inherited_suffix = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url-suffix-properties.override-inherited-suffix", "boolean")); - }, - "campaign-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "geo-targeting.exclude-countries" => { - request_geo_targeting_init(&mut request); - request.geo_targeting.as_mut().unwrap().exclude_countries = Some(arg_from_str(value.unwrap_or("false"), err, "geo-targeting.exclude-countries", "boolean")); - }, - "delivery-schedule.priority" => { - request_delivery_schedule_init(&mut request); - request.delivery_schedule.as_mut().unwrap().priority = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.hard-cutoff" => { - request_delivery_schedule_init(&mut request); - request.delivery_schedule.as_mut().unwrap().hard_cutoff = Some(arg_from_str(value.unwrap_or("false"), err, "delivery-schedule.hard-cutoff", "boolean")); - }, - "delivery-schedule.frequency-cap.duration" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().frequency_cap.as_mut().unwrap().duration = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.frequency-cap.impressions" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().frequency_cap.as_mut().unwrap().impressions = Some(value.unwrap_or("").to_string()); - }, - "delivery-schedule.impression-ratio" => { - request_delivery_schedule_frequency_cap_init(&mut request); - request.delivery_schedule.as_mut().unwrap().impression_ratio = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "remarketing-list-expression.expression" => { - request_remarketing_list_expression_init(&mut request); - request.remarketing_list_expression.as_mut().unwrap().expression = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_remarketing_list_expression_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_remarketing_list_expression_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "creative-rotation.weight-calculation-strategy" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().weight_calculation_strategy = Some(value.unwrap_or("").to_string()); - }, - "creative-rotation.creative-optimization-configuration-id" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().creative_optimization_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "creative-rotation.type" => { - request_creative_rotation_init(&mut request); - request.creative_rotation.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.landing-page-id" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().landing_page_id = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.custom-click-through-url" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().custom_click_through_url = Some(value.unwrap_or("").to_string()); - }, - "click-through-url.default-landing-page" => { - request_click_through_url_init(&mut request); - request.click_through_url.as_mut().unwrap().default_landing_page = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url.default-landing-page", "boolean")); - }, - "comments" => { - request_click_through_url_init(&mut request); - request.comments = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "type" => { - request_size_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_size_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "audience-segment-id" => { - request_size_init(&mut request); - request.audience_segment_id = Some(value.unwrap_or("").to_string()); - }, - "key-value-targeting-expression.expression" => { - request_key_value_targeting_expression_init(&mut request); - request.key_value_targeting_expression.as_mut().unwrap().expression = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-properties.override-inherited-event-tag" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().override_inherited_event_tag = Some(arg_from_str(value.unwrap_or("false"), err, "default-click-through-event-tag-properties.override-inherited-event-tag", "boolean")); - }, - "default-click-through-event-tag-properties.default-click-through-event-tag-id" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "start-time" => { - request_create_info_init(&mut request); - request.start_time = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_create_info_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "compatibility" => { - request_create_info_init(&mut request); - request.compatibility = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_create_info_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_create_info_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_create_info_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "day-part-targeting.user-local-time" => { - request_day_part_targeting_init(&mut request); - request.day_part_targeting.as_mut().unwrap().user_local_time = Some(arg_from_str(value.unwrap_or("false"), err, "day-part-targeting.user-local-time", "boolean")); - }, - "day-part-targeting.hours-of-day" => { - request_day_part_targeting_init(&mut request); - if request.day_part_targeting.as_mut().unwrap().hours_of_day.is_none() { - request.day_part_targeting.as_mut().unwrap().hours_of_day = Some(Default::default()); - } - request.day_part_targeting.as_mut().unwrap().hours_of_day.as_mut().unwrap().push(arg_from_str(value.unwrap_or("-0"), err, "day-part-targeting.hours-of-day", "integer")); - }, - "day-part-targeting.days-of-week" => { - request_day_part_targeting_init(&mut request); - if request.day_part_targeting.as_mut().unwrap().days_of_week.is_none() { - request.day_part_targeting.as_mut().unwrap().days_of_week = Some(Default::default()); - } - request.day_part_targeting.as_mut().unwrap().days_of_week.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_last_modified_info_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "end-time" => { - request_last_modified_info_init(&mut request); - request.end_time = Some(value.unwrap_or("").to_string()); - }, - "dynamic-click-tracker" => { - request_last_modified_info_init(&mut request); - request.dynamic_click_tracker = Some(arg_from_str(value.unwrap_or("false"), err, "dynamic-click-tracker", "boolean")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.ads().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertiser_groups_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.advertiser_groups().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _advertiser_groups_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.advertiser_groups().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertiser_groups_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::AdvertiserGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.advertiser_groups().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertiser_groups_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.advertiser_groups().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertiser_groups_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::AdvertiserGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.advertiser_groups().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertiser_groups_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::AdvertiserGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.advertiser_groups().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertisers_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.advertisers().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertisers_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Advertiser::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::Advertiser) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Advertiser) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status" => { - request.status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-id" => { - request.default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "original-floodlight-configuration-id" => { - request.original_floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix" => { - request.click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-group-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.advertiser_group_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "default-email" => { - request_id_dimension_value_init(&mut request); - request.default_email = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.advertisers().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertisers_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.advertisers().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "subaccount-id" => { - call = call.subaccount_id(value.unwrap_or("")); - }, - "status" => { - call = call.status(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "only-parent" => { - call = call.only_parent(arg_from_str(value.unwrap_or("false"), err, "only-parent", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "include-advertisers-without-groups-only" => { - call = call.include_advertisers_without_groups_only(arg_from_str(value.unwrap_or("false"), err, "include-advertisers-without-groups-only", "boolean")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "floodlight-configuration-ids" => { - call = call.add_floodlight_configuration_ids(value.unwrap_or("")); - }, - "advertiser-group-ids" => { - call = call.add_advertiser_group_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertisers_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Advertiser::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::Advertiser) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Advertiser) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status" => { - request.status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-id" => { - request.default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "original-floodlight-configuration-id" => { - request.original_floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix" => { - request.click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-group-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.advertiser_group_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "default-email" => { - request_id_dimension_value_init(&mut request); - request.default_email = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.advertisers().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _advertisers_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Advertiser::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::Advertiser) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Advertiser) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status" => { - request.status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-id" => { - request.default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "original-floodlight-configuration-id" => { - request.original_floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix" => { - request.click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-group-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.advertiser_group_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "default-email" => { - request_id_dimension_value_init(&mut request); - request.default_email = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.advertisers().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _browsers_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.browsers().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaign_creative_associations_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CampaignCreativeAssociation::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "creative-id" => { - request.creative_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.campaign_creative_associations().insert(request, &self.opt.arg_profile_id, &self.opt.arg_campaign_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaign_creative_associations_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.campaign_creative_associations().list(&self.opt.arg_profile_id, &self.opt.arg_campaign_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaigns_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.campaigns().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaigns_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Campaign::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Campaign) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_click_through_url_suffix_properties_init(request: &mut api::Campaign) { - if request.click_through_url_suffix_properties.is_none() { - request.click_through_url_suffix_properties = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Campaign) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_creative_optimization_configuration_init(request: &mut api::Campaign) { - if request.creative_optimization_configuration.is_none() { - request.creative_optimization_configuration = Some(Default::default()); - } - } - - fn request_default_click_through_event_tag_properties_init(request: &mut api::Campaign) { - if request.default_click_through_event_tag_properties.is_none() { - request.default_click_through_event_tag_properties = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Campaign) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Campaign) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::Campaign) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "start-date" => { - request.start_date = Some(value.unwrap_or("").to_string()); - }, - "end-date" => { - request.end_date = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.click-through-url-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.override-inherited-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().override_inherited_suffix = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url-suffix-properties.override-inherited-suffix", "boolean")); - }, - "advertiser-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.optimization-model" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().optimization_model = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.id" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.name" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().name = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_creative_optimization_configuration_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_creative_optimization_configuration_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "trafficker-emails" => { - request_creative_optimization_configuration_init(&mut request); - if request.trafficker_emails.is_none() { - request.trafficker_emails = Some(Default::default()); - } - request.trafficker_emails.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "archived" => { - request_creative_optimization_configuration_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "external-id" => { - request_creative_optimization_configuration_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-group-id" => { - request_creative_optimization_configuration_init(&mut request); - request.advertiser_group_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "billing-invoice-code" => { - request_id_dimension_value_init(&mut request); - request.billing_invoice_code = Some(value.unwrap_or("").to_string()); - }, - "comscore-vce-enabled" => { - request_id_dimension_value_init(&mut request); - request.comscore_vce_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "comscore-vce-enabled", "boolean")); - }, - "creative-group-ids" => { - request_id_dimension_value_init(&mut request); - if request.creative_group_ids.is_none() { - request.creative_group_ids = Some(Default::default()); - } - request.creative_group_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-properties.override-inherited-event-tag" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().override_inherited_event_tag = Some(arg_from_str(value.unwrap_or("false"), err, "default-click-through-event-tag-properties.override-inherited-event-tag", "boolean")); - }, - "default-click-through-event-tag-properties.default-click-through-event-tag-id" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_create_info_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_create_info_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_create_info_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "nielsen-ocr-enabled" => { - request_lookback_configuration_init(&mut request); - request.nielsen_ocr_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "nielsen-ocr-enabled", "boolean")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.campaigns().insert(request, &self.opt.arg_profile_id, &self.opt.arg_default_landing_page_name, &self.opt.arg_default_landing_page_url); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaigns_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.campaigns().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "subaccount-id" => { - call = call.subaccount_id(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "overridden-event-tag-id" => { - call = call.overridden_event_tag_id(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "excluded-ids" => { - call = call.add_excluded_ids(value.unwrap_or("")); - }, - "at-least-one-optimization-activity" => { - call = call.at_least_one_optimization_activity(arg_from_str(value.unwrap_or("false"), err, "at-least-one-optimization-activity", "boolean")); - }, - "archived" => { - call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "advertiser-ids" => { - call = call.add_advertiser_ids(value.unwrap_or("")); - }, - "advertiser-group-ids" => { - call = call.add_advertiser_group_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaigns_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Campaign::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Campaign) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_click_through_url_suffix_properties_init(request: &mut api::Campaign) { - if request.click_through_url_suffix_properties.is_none() { - request.click_through_url_suffix_properties = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Campaign) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_creative_optimization_configuration_init(request: &mut api::Campaign) { - if request.creative_optimization_configuration.is_none() { - request.creative_optimization_configuration = Some(Default::default()); - } - } - - fn request_default_click_through_event_tag_properties_init(request: &mut api::Campaign) { - if request.default_click_through_event_tag_properties.is_none() { - request.default_click_through_event_tag_properties = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Campaign) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Campaign) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::Campaign) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "start-date" => { - request.start_date = Some(value.unwrap_or("").to_string()); - }, - "end-date" => { - request.end_date = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.click-through-url-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.override-inherited-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().override_inherited_suffix = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url-suffix-properties.override-inherited-suffix", "boolean")); - }, - "advertiser-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.optimization-model" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().optimization_model = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.id" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.name" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().name = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_creative_optimization_configuration_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_creative_optimization_configuration_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "trafficker-emails" => { - request_creative_optimization_configuration_init(&mut request); - if request.trafficker_emails.is_none() { - request.trafficker_emails = Some(Default::default()); - } - request.trafficker_emails.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "archived" => { - request_creative_optimization_configuration_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "external-id" => { - request_creative_optimization_configuration_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-group-id" => { - request_creative_optimization_configuration_init(&mut request); - request.advertiser_group_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "billing-invoice-code" => { - request_id_dimension_value_init(&mut request); - request.billing_invoice_code = Some(value.unwrap_or("").to_string()); - }, - "comscore-vce-enabled" => { - request_id_dimension_value_init(&mut request); - request.comscore_vce_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "comscore-vce-enabled", "boolean")); - }, - "creative-group-ids" => { - request_id_dimension_value_init(&mut request); - if request.creative_group_ids.is_none() { - request.creative_group_ids = Some(Default::default()); - } - request.creative_group_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-properties.override-inherited-event-tag" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().override_inherited_event_tag = Some(arg_from_str(value.unwrap_or("false"), err, "default-click-through-event-tag-properties.override-inherited-event-tag", "boolean")); - }, - "default-click-through-event-tag-properties.default-click-through-event-tag-id" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_create_info_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_create_info_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_create_info_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "nielsen-ocr-enabled" => { - request_lookback_configuration_init(&mut request); - request.nielsen_ocr_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "nielsen-ocr-enabled", "boolean")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.campaigns().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _campaigns_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Campaign::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Campaign) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_click_through_url_suffix_properties_init(request: &mut api::Campaign) { - if request.click_through_url_suffix_properties.is_none() { - request.click_through_url_suffix_properties = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Campaign) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_creative_optimization_configuration_init(request: &mut api::Campaign) { - if request.creative_optimization_configuration.is_none() { - request.creative_optimization_configuration = Some(Default::default()); - } - } - - fn request_default_click_through_event_tag_properties_init(request: &mut api::Campaign) { - if request.default_click_through_event_tag_properties.is_none() { - request.default_click_through_event_tag_properties = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Campaign) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Campaign) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::Campaign) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "start-date" => { - request.start_date = Some(value.unwrap_or("").to_string()); - }, - "end-date" => { - request.end_date = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.click-through-url-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().click_through_url_suffix = Some(value.unwrap_or("").to_string()); - }, - "click-through-url-suffix-properties.override-inherited-suffix" => { - request_click_through_url_suffix_properties_init(&mut request); - request.click_through_url_suffix_properties.as_mut().unwrap().override_inherited_suffix = Some(arg_from_str(value.unwrap_or("false"), err, "click-through-url-suffix-properties.override-inherited-suffix", "boolean")); - }, - "advertiser-id" => { - request_click_through_url_suffix_properties_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.optimization-model" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().optimization_model = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.id" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "creative-optimization-configuration.name" => { - request_creative_optimization_configuration_init(&mut request); - request.creative_optimization_configuration.as_mut().unwrap().name = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_creative_optimization_configuration_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_creative_optimization_configuration_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "trafficker-emails" => { - request_creative_optimization_configuration_init(&mut request); - if request.trafficker_emails.is_none() { - request.trafficker_emails = Some(Default::default()); - } - request.trafficker_emails.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "archived" => { - request_creative_optimization_configuration_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "external-id" => { - request_creative_optimization_configuration_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-group-id" => { - request_creative_optimization_configuration_init(&mut request); - request.advertiser_group_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "billing-invoice-code" => { - request_id_dimension_value_init(&mut request); - request.billing_invoice_code = Some(value.unwrap_or("").to_string()); - }, - "comscore-vce-enabled" => { - request_id_dimension_value_init(&mut request); - request.comscore_vce_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "comscore-vce-enabled", "boolean")); - }, - "creative-group-ids" => { - request_id_dimension_value_init(&mut request); - if request.creative_group_ids.is_none() { - request.creative_group_ids = Some(Default::default()); - } - request.creative_group_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "default-click-through-event-tag-properties.override-inherited-event-tag" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().override_inherited_event_tag = Some(arg_from_str(value.unwrap_or("false"), err, "default-click-through-event-tag-properties.override-inherited-event-tag", "boolean")); - }, - "default-click-through-event-tag-properties.default-click-through-event-tag-id" => { - request_default_click_through_event_tag_properties_init(&mut request); - request.default_click_through_event_tag_properties.as_mut().unwrap().default_click_through_event_tag_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_create_info_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_create_info_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_create_info_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "nielsen-ocr-enabled" => { - request_lookback_configuration_init(&mut request); - request.nielsen_ocr_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "nielsen-ocr-enabled", "boolean")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.campaigns().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _change_logs_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.change_logs().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _change_logs_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.change_logs().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "user-profile-ids" => { - call = call.add_user_profile_ids(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "object-type" => { - call = call.object_type(value.unwrap_or("")); - }, - "object-ids" => { - call = call.add_object_ids(value.unwrap_or("")); - }, - "min-change-time" => { - call = call.min_change_time(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "max-change-time" => { - call = call.max_change_time(value.unwrap_or("")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "action" => { - call = call.action(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _cities_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.cities().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "region-dart-ids" => { - call = call.add_region_dart_ids(value.unwrap_or("")); - }, - "name-prefix" => { - call = call.name_prefix(value.unwrap_or("")); - }, - "dart-ids" => { - call = call.add_dart_ids(value.unwrap_or("")); - }, - "country-dart-ids" => { - call = call.add_country_dart_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _connection_types_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.connection_types().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _connection_types_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.connection_types().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _content_categories_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.content_categories().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _content_categories_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.content_categories().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _content_categories_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::ContentCategory::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.content_categories().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _content_categories_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.content_categories().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _content_categories_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::ContentCategory::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.content_categories().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _content_categories_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::ContentCategory::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.content_categories().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _countries_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.countries().get(&self.opt.arg_profile_id, &self.opt.arg_dart_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _countries_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.countries().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_assets_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeAssetMetadata::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_asset_identifier_init(request: &mut api::CreativeAssetMetadata) { - if request.asset_identifier.is_none() { - request.asset_identifier = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "warned-validation-rules" => { - if request.warned_validation_rules.is_none() { - request.warned_validation_rules = Some(Default::default()); - } - request.warned_validation_rules.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "detected-features" => { - if request.detected_features.is_none() { - request.detected_features = Some(Default::default()); - } - request.detected_features.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "asset-identifier.type" => { - request_asset_identifier_init(&mut request); - request.asset_identifier.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "asset-identifier.name" => { - request_asset_identifier_init(&mut request); - request.asset_identifier.as_mut().unwrap().name = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_assets().insert(request, &self.opt.arg_profile_id, &self.opt.arg_advertiser_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_field_values_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_field_values().delete(&self.opt.arg_profile_id, &self.opt.arg_creative_field_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _creative_field_values_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_field_values().get(&self.opt.arg_profile_id, &self.opt.arg_creative_field_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_field_values_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeFieldValue::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "value" => { - request.value = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_field_values().insert(request, &self.opt.arg_profile_id, &self.opt.arg_creative_field_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_field_values_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_field_values().list(&self.opt.arg_profile_id, &self.opt.arg_creative_field_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_field_values_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeFieldValue::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "value" => { - request.value = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_field_values().patch(request, &self.opt.arg_profile_id, &self.opt.arg_creative_field_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_field_values_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeFieldValue::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "value" => { - request.value = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_field_values().update(request, &self.opt.arg_profile_id, &self.opt.arg_creative_field_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_fields_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_fields().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _creative_fields_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_fields().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_fields_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeField::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::CreativeField) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_fields().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_fields_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_fields().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "advertiser-ids" => { - call = call.add_advertiser_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_fields_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeField::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::CreativeField) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_fields().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_fields_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeField::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::CreativeField) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_fields().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_groups_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_groups().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_groups_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::CreativeGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "group-number" => { - request.group_number = Some(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_groups().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_groups_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creative_groups().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "group-number" => { - call = call.group_number(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); - }, - "advertiser-ids" => { - call = call.add_advertiser_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_groups_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::CreativeGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "group-number" => { - request.group_number = Some(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_groups().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creative_groups_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CreativeGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::CreativeGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "group-number" => { - request.group_number = Some(arg_from_str(value.unwrap_or("-0"), err, "group-number", "integer")); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creative_groups().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creatives_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creatives().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creatives_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Creative::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_backup_image_target_window_init(request: &mut api::Creative) { - if request.backup_image_target_window.is_none() { - request.backup_image_target_window = Some(Default::default()); - } - } - - fn request_fs_command_init(request: &mut api::Creative) { - if request.fs_command.is_none() { - request.fs_command = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Creative) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Creative) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_rendering_id_dimension_value_init(request: &mut api::Creative) { - if request.rendering_id_dimension_value.is_none() { - request.rendering_id_dimension_value = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Creative) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "artwork-type" => { - request.artwork_type = Some(value.unwrap_or("").to_string()); - }, - "latest-trafficked-creative-id" => { - request.latest_trafficked_creative_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "required-flash-plugin-version" => { - request.required_flash_plugin_version = Some(value.unwrap_or("").to_string()); - }, - "fs-command.window-height" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().window_height = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.window-height", "integer")); - }, - "fs-command.top" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().top = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.top", "integer")); - }, - "fs-command.window-width" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().window_width = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.window-width", "integer")); - }, - "fs-command.position-option" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().position_option = Some(value.unwrap_or("").to_string()); - }, - "fs-command.left" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().left = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.left", "integer")); - }, - "rendering-id-dimension-value.kind" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.value" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.dimension-name" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.etag" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.match-type" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.id" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_rendering_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "studio-trafficked-creative-id" => { - request_size_init(&mut request); - request.studio_trafficked_creative_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_size_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "override-css" => { - request_size_init(&mut request); - request.override_css = Some(value.unwrap_or("").to_string()); - }, - "required-flash-version" => { - request_size_init(&mut request); - request.required_flash_version = Some(arg_from_str(value.unwrap_or("-0"), err, "required-flash-version", "integer")); - }, - "rendering-id" => { - request_size_init(&mut request); - request.rendering_id = Some(value.unwrap_or("").to_string()); - }, - "video-description" => { - request_size_init(&mut request); - request.video_description = Some(value.unwrap_or("").to_string()); - }, - "third-party-backup-image-impressions-url" => { - request_size_init(&mut request); - request.third_party_backup_image_impressions_url = Some(value.unwrap_or("").to_string()); - }, - "version" => { - request_size_init(&mut request); - request.version = Some(arg_from_str(value.unwrap_or("-0"), err, "version", "integer")); - }, - "background-color" => { - request_size_init(&mut request); - request.background_color = Some(value.unwrap_or("").to_string()); - }, - "custom-key-values" => { - request_size_init(&mut request); - if request.custom_key_values.is_none() { - request.custom_key_values = Some(Default::default()); - } - request.custom_key_values.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "html-code" => { - request_id_dimension_value_init(&mut request); - request.html_code = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "total-file-size" => { - request_id_dimension_value_init(&mut request); - request.total_file_size = Some(value.unwrap_or("").to_string()); - }, - "third-party-rich-media-impressions-url" => { - request_id_dimension_value_init(&mut request); - request.third_party_rich_media_impressions_url = Some(value.unwrap_or("").to_string()); - }, - "studio-advertiser-id" => { - request_id_dimension_value_init(&mut request); - request.studio_advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "html-code-locked" => { - request_id_dimension_value_init(&mut request); - request.html_code_locked = Some(arg_from_str(value.unwrap_or("false"), err, "html-code-locked", "boolean")); - }, - "redirect-url" => { - request_id_dimension_value_init(&mut request); - request.redirect_url = Some(value.unwrap_or("").to_string()); - }, - "commercial-id" => { - request_id_dimension_value_init(&mut request); - request.commercial_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_id_dimension_value_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "backup-image-reporting-label" => { - request_id_dimension_value_init(&mut request); - request.backup_image_reporting_label = Some(value.unwrap_or("").to_string()); - }, - "compatibility" => { - request_id_dimension_value_init(&mut request); - if request.compatibility.is_none() { - request.compatibility = Some(Default::default()); - } - request.compatibility.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "ad-parameters" => { - request_id_dimension_value_init(&mut request); - request.ad_parameters = Some(value.unwrap_or("").to_string()); - }, - "ad-tag-keys" => { - request_id_dimension_value_init(&mut request); - if request.ad_tag_keys.is_none() { - request.ad_tag_keys = Some(Default::default()); - } - request.ad_tag_keys.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "convert-flash-to-html5" => { - request_id_dimension_value_init(&mut request); - request.convert_flash_to_html5 = Some(arg_from_str(value.unwrap_or("false"), err, "convert-flash-to-html5", "boolean")); - }, - "video-duration" => { - request_id_dimension_value_init(&mut request); - request.video_duration = Some(arg_from_str(value.unwrap_or("0.0"), err, "video-duration", "number")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "backup-image-click-through-url" => { - request_last_modified_info_init(&mut request); - request.backup_image_click_through_url = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_last_modified_info_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "studio-creative-id" => { - request_last_modified_info_init(&mut request); - request.studio_creative_id = Some(value.unwrap_or("").to_string()); - }, - "authoring-tool" => { - request_last_modified_info_init(&mut request); - request.authoring_tool = Some(value.unwrap_or("").to_string()); - }, - "allow-script-access" => { - request_last_modified_info_init(&mut request); - request.allow_script_access = Some(arg_from_str(value.unwrap_or("false"), err, "allow-script-access", "boolean")); - }, - "companion-creatives" => { - request_last_modified_info_init(&mut request); - if request.companion_creatives.is_none() { - request.companion_creatives = Some(Default::default()); - } - request.companion_creatives.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "auto-advance-images" => { - request_last_modified_info_init(&mut request); - request.auto_advance_images = Some(arg_from_str(value.unwrap_or("false"), err, "auto-advance-images", "boolean")); - }, - "backup-image-features" => { - request_last_modified_info_init(&mut request); - if request.backup_image_features.is_none() { - request.backup_image_features = Some(Default::default()); - } - request.backup_image_features.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "backup-image-target-window.custom-html" => { - request_backup_image_target_window_init(&mut request); - request.backup_image_target_window.as_mut().unwrap().custom_html = Some(value.unwrap_or("").to_string()); - }, - "backup-image-target-window.target-window-option" => { - request_backup_image_target_window_init(&mut request); - request.backup_image_target_window.as_mut().unwrap().target_window_option = Some(value.unwrap_or("").to_string()); - }, - "skippable" => { - request_backup_image_target_window_init(&mut request); - request.skippable = Some(arg_from_str(value.unwrap_or("false"), err, "skippable", "boolean")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creatives().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creatives_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.creatives().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "types" => { - call = call.add_types(value.unwrap_or("")); - }, - "studio-creative-id" => { - call = call.studio_creative_id(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "size-ids" => { - call = call.add_size_ids(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "rendering-ids" => { - call = call.add_rendering_ids(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "creative-field-ids" => { - call = call.add_creative_field_ids(value.unwrap_or("")); - }, - "companion-creative-ids" => { - call = call.add_companion_creative_ids(value.unwrap_or("")); - }, - "campaign-id" => { - call = call.campaign_id(value.unwrap_or("")); - }, - "archived" => { - call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "advertiser-id" => { - call = call.advertiser_id(value.unwrap_or("")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creatives_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Creative::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_backup_image_target_window_init(request: &mut api::Creative) { - if request.backup_image_target_window.is_none() { - request.backup_image_target_window = Some(Default::default()); - } - } - - fn request_fs_command_init(request: &mut api::Creative) { - if request.fs_command.is_none() { - request.fs_command = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Creative) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Creative) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_rendering_id_dimension_value_init(request: &mut api::Creative) { - if request.rendering_id_dimension_value.is_none() { - request.rendering_id_dimension_value = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Creative) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "artwork-type" => { - request.artwork_type = Some(value.unwrap_or("").to_string()); - }, - "latest-trafficked-creative-id" => { - request.latest_trafficked_creative_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "required-flash-plugin-version" => { - request.required_flash_plugin_version = Some(value.unwrap_or("").to_string()); - }, - "fs-command.window-height" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().window_height = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.window-height", "integer")); - }, - "fs-command.top" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().top = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.top", "integer")); - }, - "fs-command.window-width" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().window_width = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.window-width", "integer")); - }, - "fs-command.position-option" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().position_option = Some(value.unwrap_or("").to_string()); - }, - "fs-command.left" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().left = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.left", "integer")); - }, - "rendering-id-dimension-value.kind" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.value" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.dimension-name" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.etag" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.match-type" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.id" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_rendering_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "studio-trafficked-creative-id" => { - request_size_init(&mut request); - request.studio_trafficked_creative_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_size_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "override-css" => { - request_size_init(&mut request); - request.override_css = Some(value.unwrap_or("").to_string()); - }, - "required-flash-version" => { - request_size_init(&mut request); - request.required_flash_version = Some(arg_from_str(value.unwrap_or("-0"), err, "required-flash-version", "integer")); - }, - "rendering-id" => { - request_size_init(&mut request); - request.rendering_id = Some(value.unwrap_or("").to_string()); - }, - "video-description" => { - request_size_init(&mut request); - request.video_description = Some(value.unwrap_or("").to_string()); - }, - "third-party-backup-image-impressions-url" => { - request_size_init(&mut request); - request.third_party_backup_image_impressions_url = Some(value.unwrap_or("").to_string()); - }, - "version" => { - request_size_init(&mut request); - request.version = Some(arg_from_str(value.unwrap_or("-0"), err, "version", "integer")); - }, - "background-color" => { - request_size_init(&mut request); - request.background_color = Some(value.unwrap_or("").to_string()); - }, - "custom-key-values" => { - request_size_init(&mut request); - if request.custom_key_values.is_none() { - request.custom_key_values = Some(Default::default()); - } - request.custom_key_values.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "html-code" => { - request_id_dimension_value_init(&mut request); - request.html_code = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "total-file-size" => { - request_id_dimension_value_init(&mut request); - request.total_file_size = Some(value.unwrap_or("").to_string()); - }, - "third-party-rich-media-impressions-url" => { - request_id_dimension_value_init(&mut request); - request.third_party_rich_media_impressions_url = Some(value.unwrap_or("").to_string()); - }, - "studio-advertiser-id" => { - request_id_dimension_value_init(&mut request); - request.studio_advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "html-code-locked" => { - request_id_dimension_value_init(&mut request); - request.html_code_locked = Some(arg_from_str(value.unwrap_or("false"), err, "html-code-locked", "boolean")); - }, - "redirect-url" => { - request_id_dimension_value_init(&mut request); - request.redirect_url = Some(value.unwrap_or("").to_string()); - }, - "commercial-id" => { - request_id_dimension_value_init(&mut request); - request.commercial_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_id_dimension_value_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "backup-image-reporting-label" => { - request_id_dimension_value_init(&mut request); - request.backup_image_reporting_label = Some(value.unwrap_or("").to_string()); - }, - "compatibility" => { - request_id_dimension_value_init(&mut request); - if request.compatibility.is_none() { - request.compatibility = Some(Default::default()); - } - request.compatibility.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "ad-parameters" => { - request_id_dimension_value_init(&mut request); - request.ad_parameters = Some(value.unwrap_or("").to_string()); - }, - "ad-tag-keys" => { - request_id_dimension_value_init(&mut request); - if request.ad_tag_keys.is_none() { - request.ad_tag_keys = Some(Default::default()); - } - request.ad_tag_keys.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "convert-flash-to-html5" => { - request_id_dimension_value_init(&mut request); - request.convert_flash_to_html5 = Some(arg_from_str(value.unwrap_or("false"), err, "convert-flash-to-html5", "boolean")); - }, - "video-duration" => { - request_id_dimension_value_init(&mut request); - request.video_duration = Some(arg_from_str(value.unwrap_or("0.0"), err, "video-duration", "number")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "backup-image-click-through-url" => { - request_last_modified_info_init(&mut request); - request.backup_image_click_through_url = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_last_modified_info_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "studio-creative-id" => { - request_last_modified_info_init(&mut request); - request.studio_creative_id = Some(value.unwrap_or("").to_string()); - }, - "authoring-tool" => { - request_last_modified_info_init(&mut request); - request.authoring_tool = Some(value.unwrap_or("").to_string()); - }, - "allow-script-access" => { - request_last_modified_info_init(&mut request); - request.allow_script_access = Some(arg_from_str(value.unwrap_or("false"), err, "allow-script-access", "boolean")); - }, - "companion-creatives" => { - request_last_modified_info_init(&mut request); - if request.companion_creatives.is_none() { - request.companion_creatives = Some(Default::default()); - } - request.companion_creatives.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "auto-advance-images" => { - request_last_modified_info_init(&mut request); - request.auto_advance_images = Some(arg_from_str(value.unwrap_or("false"), err, "auto-advance-images", "boolean")); - }, - "backup-image-features" => { - request_last_modified_info_init(&mut request); - if request.backup_image_features.is_none() { - request.backup_image_features = Some(Default::default()); - } - request.backup_image_features.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "backup-image-target-window.custom-html" => { - request_backup_image_target_window_init(&mut request); - request.backup_image_target_window.as_mut().unwrap().custom_html = Some(value.unwrap_or("").to_string()); - }, - "backup-image-target-window.target-window-option" => { - request_backup_image_target_window_init(&mut request); - request.backup_image_target_window.as_mut().unwrap().target_window_option = Some(value.unwrap_or("").to_string()); - }, - "skippable" => { - request_backup_image_target_window_init(&mut request); - request.skippable = Some(arg_from_str(value.unwrap_or("false"), err, "skippable", "boolean")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creatives().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _creatives_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Creative::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_backup_image_target_window_init(request: &mut api::Creative) { - if request.backup_image_target_window.is_none() { - request.backup_image_target_window = Some(Default::default()); - } - } - - fn request_fs_command_init(request: &mut api::Creative) { - if request.fs_command.is_none() { - request.fs_command = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Creative) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Creative) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_rendering_id_dimension_value_init(request: &mut api::Creative) { - if request.rendering_id_dimension_value.is_none() { - request.rendering_id_dimension_value = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Creative) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "artwork-type" => { - request.artwork_type = Some(value.unwrap_or("").to_string()); - }, - "latest-trafficked-creative-id" => { - request.latest_trafficked_creative_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "required-flash-plugin-version" => { - request.required_flash_plugin_version = Some(value.unwrap_or("").to_string()); - }, - "fs-command.window-height" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().window_height = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.window-height", "integer")); - }, - "fs-command.top" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().top = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.top", "integer")); - }, - "fs-command.window-width" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().window_width = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.window-width", "integer")); - }, - "fs-command.position-option" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().position_option = Some(value.unwrap_or("").to_string()); - }, - "fs-command.left" => { - request_fs_command_init(&mut request); - request.fs_command.as_mut().unwrap().left = Some(arg_from_str(value.unwrap_or("-0"), err, "fs-command.left", "integer")); - }, - "rendering-id-dimension-value.kind" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.value" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.dimension-name" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.etag" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.match-type" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "rendering-id-dimension-value.id" => { - request_rendering_id_dimension_value_init(&mut request); - request.rendering_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_rendering_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "studio-trafficked-creative-id" => { - request_size_init(&mut request); - request.studio_trafficked_creative_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_size_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "override-css" => { - request_size_init(&mut request); - request.override_css = Some(value.unwrap_or("").to_string()); - }, - "required-flash-version" => { - request_size_init(&mut request); - request.required_flash_version = Some(arg_from_str(value.unwrap_or("-0"), err, "required-flash-version", "integer")); - }, - "rendering-id" => { - request_size_init(&mut request); - request.rendering_id = Some(value.unwrap_or("").to_string()); - }, - "video-description" => { - request_size_init(&mut request); - request.video_description = Some(value.unwrap_or("").to_string()); - }, - "third-party-backup-image-impressions-url" => { - request_size_init(&mut request); - request.third_party_backup_image_impressions_url = Some(value.unwrap_or("").to_string()); - }, - "version" => { - request_size_init(&mut request); - request.version = Some(arg_from_str(value.unwrap_or("-0"), err, "version", "integer")); - }, - "background-color" => { - request_size_init(&mut request); - request.background_color = Some(value.unwrap_or("").to_string()); - }, - "custom-key-values" => { - request_size_init(&mut request); - if request.custom_key_values.is_none() { - request.custom_key_values = Some(Default::default()); - } - request.custom_key_values.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "html-code" => { - request_id_dimension_value_init(&mut request); - request.html_code = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "total-file-size" => { - request_id_dimension_value_init(&mut request); - request.total_file_size = Some(value.unwrap_or("").to_string()); - }, - "third-party-rich-media-impressions-url" => { - request_id_dimension_value_init(&mut request); - request.third_party_rich_media_impressions_url = Some(value.unwrap_or("").to_string()); - }, - "studio-advertiser-id" => { - request_id_dimension_value_init(&mut request); - request.studio_advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "html-code-locked" => { - request_id_dimension_value_init(&mut request); - request.html_code_locked = Some(arg_from_str(value.unwrap_or("false"), err, "html-code-locked", "boolean")); - }, - "redirect-url" => { - request_id_dimension_value_init(&mut request); - request.redirect_url = Some(value.unwrap_or("").to_string()); - }, - "commercial-id" => { - request_id_dimension_value_init(&mut request); - request.commercial_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_id_dimension_value_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "backup-image-reporting-label" => { - request_id_dimension_value_init(&mut request); - request.backup_image_reporting_label = Some(value.unwrap_or("").to_string()); - }, - "compatibility" => { - request_id_dimension_value_init(&mut request); - if request.compatibility.is_none() { - request.compatibility = Some(Default::default()); - } - request.compatibility.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "ad-parameters" => { - request_id_dimension_value_init(&mut request); - request.ad_parameters = Some(value.unwrap_or("").to_string()); - }, - "ad-tag-keys" => { - request_id_dimension_value_init(&mut request); - if request.ad_tag_keys.is_none() { - request.ad_tag_keys = Some(Default::default()); - } - request.ad_tag_keys.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "convert-flash-to-html5" => { - request_id_dimension_value_init(&mut request); - request.convert_flash_to_html5 = Some(arg_from_str(value.unwrap_or("false"), err, "convert-flash-to-html5", "boolean")); - }, - "video-duration" => { - request_id_dimension_value_init(&mut request); - request.video_duration = Some(arg_from_str(value.unwrap_or("0.0"), err, "video-duration", "number")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "backup-image-click-through-url" => { - request_last_modified_info_init(&mut request); - request.backup_image_click_through_url = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_last_modified_info_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "studio-creative-id" => { - request_last_modified_info_init(&mut request); - request.studio_creative_id = Some(value.unwrap_or("").to_string()); - }, - "authoring-tool" => { - request_last_modified_info_init(&mut request); - request.authoring_tool = Some(value.unwrap_or("").to_string()); - }, - "allow-script-access" => { - request_last_modified_info_init(&mut request); - request.allow_script_access = Some(arg_from_str(value.unwrap_or("false"), err, "allow-script-access", "boolean")); - }, - "companion-creatives" => { - request_last_modified_info_init(&mut request); - if request.companion_creatives.is_none() { - request.companion_creatives = Some(Default::default()); - } - request.companion_creatives.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "auto-advance-images" => { - request_last_modified_info_init(&mut request); - request.auto_advance_images = Some(arg_from_str(value.unwrap_or("false"), err, "auto-advance-images", "boolean")); - }, - "backup-image-features" => { - request_last_modified_info_init(&mut request); - if request.backup_image_features.is_none() { - request.backup_image_features = Some(Default::default()); - } - request.backup_image_features.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "backup-image-target-window.custom-html" => { - request_backup_image_target_window_init(&mut request); - request.backup_image_target_window.as_mut().unwrap().custom_html = Some(value.unwrap_or("").to_string()); - }, - "backup-image-target-window.target-window-option" => { - request_backup_image_target_window_init(&mut request); - request.backup_image_target_window.as_mut().unwrap().target_window_option = Some(value.unwrap_or("").to_string()); - }, - "skippable" => { - request_backup_image_target_window_init(&mut request); - request.skippable = Some(arg_from_str(value.unwrap_or("false"), err, "skippable", "boolean")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.creatives().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _dimension_values_query(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::DimensionValueRequest::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "dimension-name" => { - request.dimension_name = Some(value.unwrap_or("").to_string()); - }, - "start-date" => { - request.start_date = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "end-date" => { - request.end_date = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.dimension_values().query(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.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")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _directory_site_contacts_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.directory_site_contacts().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _directory_site_contacts_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.directory_site_contacts().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "directory-site-ids" => { - call = call.add_directory_site_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _directory_sites_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.directory_sites().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _directory_sites_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::DirectorySite::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_id_dimension_value_init(request: &mut api::DirectorySite) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_settings_dfp_settings_init(request: &mut api::DirectorySite) { - request_settings_init(request); - if request.settings.as_mut().unwrap().dfp_settings.is_none() { - request.settings.as_mut().unwrap().dfp_settings = Some(Default::default()); - } - } - - fn request_settings_init(request: &mut api::DirectorySite) { - if request.settings.is_none() { - request.settings = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "country-id" => { - request.country_id = Some(value.unwrap_or("").to_string()); - }, - "description" => { - request.description = Some(value.unwrap_or("").to_string()); - }, - "settings.nielsen-ocr-opt-out" => { - request_settings_init(&mut request); - request.settings.as_mut().unwrap().nielsen_ocr_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "settings.nielsen-ocr-opt-out", "boolean")); - }, - "settings.active-view-opt-out" => { - request_settings_init(&mut request); - request.settings.as_mut().unwrap().active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "settings.active-view-opt-out", "boolean")); - }, - "settings.dfp-settings.dfp-network-name" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().dfp_settings.as_mut().unwrap().dfp_network_name = Some(value.unwrap_or("").to_string()); - }, - "settings.dfp-settings.publisher-portal-only" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().dfp_settings.as_mut().unwrap().publisher_portal_only = Some(arg_from_str(value.unwrap_or("false"), err, "settings.dfp-settings.publisher-portal-only", "boolean")); - }, - "settings.dfp-settings.programmatic-placement-accepted" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().dfp_settings.as_mut().unwrap().programmatic_placement_accepted = Some(arg_from_str(value.unwrap_or("false"), err, "settings.dfp-settings.programmatic-placement-accepted", "boolean")); - }, - "settings.dfp-settings.pub-paid-placement-accepted" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().dfp_settings.as_mut().unwrap().pub_paid_placement_accepted = Some(arg_from_str(value.unwrap_or("false"), err, "settings.dfp-settings.pub-paid-placement-accepted", "boolean")); - }, - "settings.dfp-settings.dfp-network-code" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().dfp_settings.as_mut().unwrap().dfp_network_code = Some(value.unwrap_or("").to_string()); - }, - "settings.verification-tag-opt-out" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().verification_tag_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "settings.verification-tag-opt-out", "boolean")); - }, - "settings.instream-video-placement-accepted" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().instream_video_placement_accepted = Some(arg_from_str(value.unwrap_or("false"), err, "settings.instream-video-placement-accepted", "boolean")); - }, - "settings.interstitial-placement-accepted" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().interstitial_placement_accepted = Some(arg_from_str(value.unwrap_or("false"), err, "settings.interstitial-placement-accepted", "boolean")); - }, - "settings.video-active-view-opt-out" => { - request_settings_dfp_settings_init(&mut request); - request.settings.as_mut().unwrap().video_active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "settings.video-active-view-opt-out", "boolean")); - }, - "currency-id" => { - request_settings_init(&mut request); - request.currency_id = Some(value.unwrap_or("").to_string()); - }, - "inpage-tag-formats" => { - request_settings_init(&mut request); - if request.inpage_tag_formats.is_none() { - request.inpage_tag_formats = Some(Default::default()); - } - request.inpage_tag_formats.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "url" => { - request_settings_init(&mut request); - request.url = Some(value.unwrap_or("").to_string()); - }, - "parent-id" => { - request_settings_init(&mut request); - request.parent_id = Some(value.unwrap_or("").to_string()); - }, - "interstitial-tag-formats" => { - request_settings_init(&mut request); - if request.interstitial_tag_formats.is_none() { - request.interstitial_tag_formats = Some(Default::default()); - } - request.interstitial_tag_formats.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_id_dimension_value_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.directory_sites().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _directory_sites_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.directory_sites().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "parent-id" => { - call = call.parent_id(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "dfp-network-code" => { - call = call.dfp_network_code(value.unwrap_or("")); - }, - "country-id" => { - call = call.country_id(value.unwrap_or("")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "accepts-publisher-paid-placements" => { - call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); - }, - "accepts-interstitial-placements" => { - call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); - }, - "accepts-in-stream-video-placements" => { - call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _event_tags_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.event_tags().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _event_tags_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.event_tags().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _event_tags_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::EventTag::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::EventTag) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::EventTag) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status" => { - request.status = Some(value.unwrap_or("").to_string()); - }, - "site-ids" => { - if request.site_ids.is_none() { - request.site_ids = Some(Default::default()); - } - request.site_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "url-escape-levels" => { - request.url_escape_levels = Some(arg_from_str(value.unwrap_or("-0"), err, "url-escape-levels", "integer")); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "enabled-by-default" => { - request_campaign_id_dimension_value_init(&mut request); - request.enabled_by_default = Some(arg_from_str(value.unwrap_or("false"), err, "enabled-by-default", "boolean")); - }, - "advertiser-id" => { - request_campaign_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "site-filter-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.site_filter_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.event_tags().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _event_tags_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.event_tags().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "event-tag-types" => { - call = call.add_event_tag_types(value.unwrap_or("")); - }, - "enabled" => { - call = call.enabled(arg_from_str(value.unwrap_or("false"), err, "enabled", "boolean")); - }, - "definitions-only" => { - call = call.definitions_only(arg_from_str(value.unwrap_or("false"), err, "definitions-only", "boolean")); - }, - "campaign-id" => { - call = call.campaign_id(value.unwrap_or("")); - }, - "advertiser-id" => { - call = call.advertiser_id(value.unwrap_or("")); - }, - "ad-id" => { - call = call.ad_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _event_tags_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::EventTag::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::EventTag) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::EventTag) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status" => { - request.status = Some(value.unwrap_or("").to_string()); - }, - "site-ids" => { - if request.site_ids.is_none() { - request.site_ids = Some(Default::default()); - } - request.site_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "url-escape-levels" => { - request.url_escape_levels = Some(arg_from_str(value.unwrap_or("-0"), err, "url-escape-levels", "integer")); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "enabled-by-default" => { - request_campaign_id_dimension_value_init(&mut request); - request.enabled_by_default = Some(arg_from_str(value.unwrap_or("false"), err, "enabled-by-default", "boolean")); - }, - "advertiser-id" => { - request_campaign_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "site-filter-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.site_filter_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.event_tags().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _event_tags_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::EventTag::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::EventTag) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::EventTag) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status" => { - request.status = Some(value.unwrap_or("").to_string()); - }, - "site-ids" => { - if request.site_ids.is_none() { - request.site_ids = Some(Default::default()); - } - request.site_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "url-escape-levels" => { - request.url_escape_levels = Some(arg_from_str(value.unwrap_or("-0"), err, "url-escape-levels", "integer")); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "enabled-by-default" => { - request_campaign_id_dimension_value_init(&mut request); - request.enabled_by_default = Some(arg_from_str(value.unwrap_or("false"), err, "enabled-by-default", "boolean")); - }, - "advertiser-id" => { - request_campaign_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "site-filter-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.site_filter_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.event_tags().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _files_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut download_mode = false; - let mut call = self.hub.files().get(&self.opt.arg_report_id, &self.opt.arg_file_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - if key == "alt" && value.unwrap_or("unset") == "media" { - download_mode = true; - } - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - if !download_mode { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - } else { - io::copy(&mut response, &mut ostream).unwrap(); - } - None - } - } - } - } - - fn _files_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.files().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "scope" => { - call = call.scope(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activities_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activities().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _floodlight_activities_generatetag(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activities().generatetag(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "floodlight-activity-id" => { - call = call.floodlight_activity_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activities_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activities().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activities_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightActivity::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "tag-string" => { - request.tag_string = Some(value.unwrap_or("").to_string()); - }, - "secure" => { - request.secure = Some(arg_from_str(value.unwrap_or("false"), err, "secure", "boolean")); - }, - "floodlight-activity-group-name" => { - request.floodlight_activity_group_name = Some(value.unwrap_or("").to_string()); - }, - "image-tag-enabled" => { - request.image_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "image-tag-enabled", "boolean")); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.floodlight_activity_group_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-tag-string" => { - request_advertiser_id_dimension_value_init(&mut request); - request.floodlight_activity_group_tag_string = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_advertiser_id_dimension_value_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "cache-busting-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.cache_busting_type = Some(value.unwrap_or("").to_string()); - }, - "hidden" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.hidden = Some(arg_from_str(value.unwrap_or("false"), err, "hidden", "boolean")); - }, - "account-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "expected-url" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.expected_url = Some(value.unwrap_or("").to_string()); - }, - "tag-format" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.tag_format = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "notes" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.notes = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "user-defined-variable-types" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - if request.user_defined_variable_types.is_none() { - request.user_defined_variable_types = Some(Default::default()); - } - request.user_defined_variable_types.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "counting-method" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.counting_method = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-type" => { - request_id_dimension_value_init(&mut request); - request.floodlight_activity_group_type = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_activities().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activities_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activities().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "tag-string" => { - call = call.tag_string(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "floodlight-configuration-id" => { - call = call.floodlight_configuration_id(value.unwrap_or("")); - }, - "floodlight-activity-group-type" => { - call = call.floodlight_activity_group_type(value.unwrap_or("")); - }, - "floodlight-activity-group-tag-string" => { - call = call.floodlight_activity_group_tag_string(value.unwrap_or("")); - }, - "floodlight-activity-group-name" => { - call = call.floodlight_activity_group_name(value.unwrap_or("")); - }, - "floodlight-activity-group-ids" => { - call = call.add_floodlight_activity_group_ids(value.unwrap_or("")); - }, - "advertiser-id" => { - call = call.advertiser_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activities_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightActivity::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "tag-string" => { - request.tag_string = Some(value.unwrap_or("").to_string()); - }, - "secure" => { - request.secure = Some(arg_from_str(value.unwrap_or("false"), err, "secure", "boolean")); - }, - "floodlight-activity-group-name" => { - request.floodlight_activity_group_name = Some(value.unwrap_or("").to_string()); - }, - "image-tag-enabled" => { - request.image_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "image-tag-enabled", "boolean")); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.floodlight_activity_group_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-tag-string" => { - request_advertiser_id_dimension_value_init(&mut request); - request.floodlight_activity_group_tag_string = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_advertiser_id_dimension_value_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "cache-busting-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.cache_busting_type = Some(value.unwrap_or("").to_string()); - }, - "hidden" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.hidden = Some(arg_from_str(value.unwrap_or("false"), err, "hidden", "boolean")); - }, - "account-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "expected-url" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.expected_url = Some(value.unwrap_or("").to_string()); - }, - "tag-format" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.tag_format = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "notes" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.notes = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "user-defined-variable-types" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - if request.user_defined_variable_types.is_none() { - request.user_defined_variable_types = Some(Default::default()); - } - request.user_defined_variable_types.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "counting-method" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.counting_method = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-type" => { - request_id_dimension_value_init(&mut request); - request.floodlight_activity_group_type = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_activities().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activities_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightActivity::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightActivity) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "tag-string" => { - request.tag_string = Some(value.unwrap_or("").to_string()); - }, - "secure" => { - request.secure = Some(arg_from_str(value.unwrap_or("false"), err, "secure", "boolean")); - }, - "floodlight-activity-group-name" => { - request.floodlight_activity_group_name = Some(value.unwrap_or("").to_string()); - }, - "image-tag-enabled" => { - request.image_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "image-tag-enabled", "boolean")); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.floodlight_activity_group_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-tag-string" => { - request_advertiser_id_dimension_value_init(&mut request); - request.floodlight_activity_group_tag_string = Some(value.unwrap_or("").to_string()); - }, - "ssl-compliant" => { - request_advertiser_id_dimension_value_init(&mut request); - request.ssl_compliant = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-compliant", "boolean")); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "cache-busting-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.cache_busting_type = Some(value.unwrap_or("").to_string()); - }, - "hidden" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.hidden = Some(arg_from_str(value.unwrap_or("false"), err, "hidden", "boolean")); - }, - "account-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "expected-url" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.expected_url = Some(value.unwrap_or("").to_string()); - }, - "tag-format" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.tag_format = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "notes" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.notes = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "user-defined-variable-types" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - if request.user_defined_variable_types.is_none() { - request.user_defined_variable_types = Some(Default::default()); - } - request.user_defined_variable_types.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "counting-method" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.counting_method = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-activity-group-type" => { - request_id_dimension_value_init(&mut request); - request.floodlight_activity_group_type = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_activities().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activity_groups_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activity_groups().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _floodlight_activity_groups_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activity_groups().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activity_groups_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightActivityGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "tag-string" => { - request_advertiser_id_dimension_value_init(&mut request); - request.tag_string = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_activity_groups().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activity_groups_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_activity_groups().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "type" => { - call = call.type_(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "floodlight-configuration-id" => { - call = call.floodlight_configuration_id(value.unwrap_or("")); - }, - "advertiser-id" => { - call = call.advertiser_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activity_groups_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightActivityGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "tag-string" => { - request_advertiser_id_dimension_value_init(&mut request); - request.tag_string = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_activity_groups().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_activity_groups_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightActivityGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_floodlight_configuration_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.floodlight_configuration_id_dimension_value.is_none() { - request.floodlight_configuration_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightActivityGroup) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id" => { - request.floodlight_configuration_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.kind" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.value" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.dimension-name" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.etag" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.match-type" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-configuration-id-dimension-value.id" => { - request_floodlight_configuration_id_dimension_value_init(&mut request); - request.floodlight_configuration_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "tag-string" => { - request_advertiser_id_dimension_value_init(&mut request); - request.tag_string = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_activity_groups().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_configurations_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_configurations().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_configurations_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.floodlight_configurations().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_configurations_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightConfiguration::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightConfiguration) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightConfiguration) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::FloodlightConfiguration) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - fn request_omniture_settings_init(request: &mut api::FloodlightConfiguration) { - if request.omniture_settings.is_none() { - request.omniture_settings = Some(Default::default()); - } - } - - fn request_tag_settings_init(request: &mut api::FloodlightConfiguration) { - if request.tag_settings.is_none() { - request.tag_settings = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "natural-search-conversion-attribution-option" => { - request.natural_search_conversion_attribution_option = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "exposure-to-conversion-enabled" => { - request.exposure_to_conversion_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "exposure-to-conversion-enabled", "boolean")); - }, - "analytics-data-sharing-enabled" => { - request.analytics_data_sharing_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "analytics-data-sharing-enabled", "boolean")); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "first-day-of-week" => { - request_lookback_configuration_init(&mut request); - request.first_day_of_week = Some(value.unwrap_or("").to_string()); - }, - "standard-variable-types" => { - request_lookback_configuration_init(&mut request); - if request.standard_variable_types.is_none() { - request.standard_variable_types = Some(Default::default()); - } - request.standard_variable_types.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "omniture-settings.omniture-cost-data-enabled" => { - request_omniture_settings_init(&mut request); - request.omniture_settings.as_mut().unwrap().omniture_cost_data_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "omniture-settings.omniture-cost-data-enabled", "boolean")); - }, - "omniture-settings.omniture-integration-enabled" => { - request_omniture_settings_init(&mut request); - request.omniture_settings.as_mut().unwrap().omniture_integration_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "omniture-settings.omniture-integration-enabled", "boolean")); - }, - "subaccount-id" => { - request_omniture_settings_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_omniture_settings_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "tag-settings.dynamic-tag-enabled" => { - request_tag_settings_init(&mut request); - request.tag_settings.as_mut().unwrap().dynamic_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "tag-settings.dynamic-tag-enabled", "boolean")); - }, - "tag-settings.image-tag-enabled" => { - request_tag_settings_init(&mut request); - request.tag_settings.as_mut().unwrap().image_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "tag-settings.image-tag-enabled", "boolean")); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_advertiser_id_dimension_value_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_configurations().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _floodlight_configurations_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::FloodlightConfiguration::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::FloodlightConfiguration) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::FloodlightConfiguration) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::FloodlightConfiguration) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - fn request_omniture_settings_init(request: &mut api::FloodlightConfiguration) { - if request.omniture_settings.is_none() { - request.omniture_settings = Some(Default::default()); - } - } - - fn request_tag_settings_init(request: &mut api::FloodlightConfiguration) { - if request.tag_settings.is_none() { - request.tag_settings = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "natural-search-conversion-attribution-option" => { - request.natural_search_conversion_attribution_option = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "exposure-to-conversion-enabled" => { - request.exposure_to_conversion_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "exposure-to-conversion-enabled", "boolean")); - }, - "analytics-data-sharing-enabled" => { - request.analytics_data_sharing_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "analytics-data-sharing-enabled", "boolean")); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "first-day-of-week" => { - request_lookback_configuration_init(&mut request); - request.first_day_of_week = Some(value.unwrap_or("").to_string()); - }, - "standard-variable-types" => { - request_lookback_configuration_init(&mut request); - if request.standard_variable_types.is_none() { - request.standard_variable_types = Some(Default::default()); - } - request.standard_variable_types.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "omniture-settings.omniture-cost-data-enabled" => { - request_omniture_settings_init(&mut request); - request.omniture_settings.as_mut().unwrap().omniture_cost_data_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "omniture-settings.omniture-cost-data-enabled", "boolean")); - }, - "omniture-settings.omniture-integration-enabled" => { - request_omniture_settings_init(&mut request); - request.omniture_settings.as_mut().unwrap().omniture_integration_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "omniture-settings.omniture-integration-enabled", "boolean")); - }, - "subaccount-id" => { - request_omniture_settings_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_omniture_settings_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "tag-settings.dynamic-tag-enabled" => { - request_tag_settings_init(&mut request); - request.tag_settings.as_mut().unwrap().dynamic_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "tag-settings.dynamic-tag-enabled", "boolean")); - }, - "tag-settings.image-tag-enabled" => { - request_tag_settings_init(&mut request); - request.tag_settings.as_mut().unwrap().image_tag_enabled = Some(arg_from_str(value.unwrap_or("false"), err, "tag-settings.image-tag-enabled", "boolean")); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "ssl-required" => { - request_advertiser_id_dimension_value_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.floodlight_configurations().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _inventory_items_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.inventory_items().get(&self.opt.arg_profile_id, &self.opt.arg_project_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _inventory_items_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.inventory_items().list(&self.opt.arg_profile_id, &self.opt.arg_project_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "site-id" => { - call = call.add_site_id(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "order-id" => { - call = call.add_order_id(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "in-plan" => { - call = call.in_plan(arg_from_str(value.unwrap_or("false"), err, "in-plan", "boolean")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _landing_pages_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.landing_pages().delete(&self.opt.arg_profile_id, &self.opt.arg_campaign_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _landing_pages_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.landing_pages().get(&self.opt.arg_profile_id, &self.opt.arg_campaign_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _landing_pages_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LandingPage::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "default" => { - request.default = Some(arg_from_str(value.unwrap_or("false"), err, "default", "boolean")); - }, - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.landing_pages().insert(request, &self.opt.arg_profile_id, &self.opt.arg_campaign_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _landing_pages_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.landing_pages().list(&self.opt.arg_profile_id, &self.opt.arg_campaign_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _landing_pages_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LandingPage::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "default" => { - request.default = Some(arg_from_str(value.unwrap_or("false"), err, "default", "boolean")); - }, - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.landing_pages().patch(request, &self.opt.arg_profile_id, &self.opt.arg_campaign_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _landing_pages_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LandingPage::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "default" => { - request.default = Some(arg_from_str(value.unwrap_or("false"), err, "default", "boolean")); - }, - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.landing_pages().update(request, &self.opt.arg_profile_id, &self.opt.arg_campaign_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _metros_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.metros().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _mobile_carriers_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.mobile_carriers().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _mobile_carriers_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.mobile_carriers().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _operating_system_versions_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.operating_system_versions().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _operating_system_versions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.operating_system_versions().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _operating_systems_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.operating_systems().get(&self.opt.arg_profile_id, &self.opt.arg_dart_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _operating_systems_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.operating_systems().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _order_documents_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.order_documents().get(&self.opt.arg_profile_id, &self.opt.arg_project_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _order_documents_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.order_documents().list(&self.opt.arg_profile_id, &self.opt.arg_project_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "site-id" => { - call = call.add_site_id(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "order-id" => { - call = call.add_order_id(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "approved" => { - call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _orders_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.orders().get(&self.opt.arg_profile_id, &self.opt.arg_project_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _orders_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.orders().list(&self.opt.arg_profile_id, &self.opt.arg_project_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "site-id" => { - call = call.add_site_id(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_groups_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placement_groups().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_groups_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlacementGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::PlacementGroup) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_directory_site_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::PlacementGroup) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_pricing_schedule_init(request: &mut api::PlacementGroup) { - if request.pricing_schedule.is_none() { - request.pricing_schedule = Some(Default::default()); - } - } - - fn request_primary_placement_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.primary_placement_id_dimension_value.is_none() { - request.primary_placement_id_dimension_value = Some(Default::default()); - } - } - - fn request_programmatic_setting_init(request: &mut api::PlacementGroup) { - if request.programmatic_setting.is_none() { - request.programmatic_setting = Some(Default::default()); - } - } - - fn request_site_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.site_id_dimension_value.is_none() { - request.site_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id" => { - request.primary_placement_id = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "placement-group-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.placement_group_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "programmatic-setting.trafficker-emails" => { - request_programmatic_setting_init(&mut request); - if request.programmatic_setting.as_mut().unwrap().trafficker_emails.is_none() { - request.programmatic_setting.as_mut().unwrap().trafficker_emails = Some(Default::default()); - } - request.programmatic_setting.as_mut().unwrap().trafficker_emails.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "programmatic-setting.programmatic" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().programmatic = Some(arg_from_str(value.unwrap_or("false"), err, "programmatic-setting.programmatic", "boolean")); - }, - "programmatic-setting.insertion-order-id" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().insertion_order_id = Some(value.unwrap_or("").to_string()); - }, - "programmatic-setting.insertion-order-id-status" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().insertion_order_id_status = Some(arg_from_str(value.unwrap_or("false"), err, "programmatic-setting.insertion-order-id-status", "boolean")); - }, - "programmatic-setting.adx-deal-ids" => { - request_programmatic_setting_init(&mut request); - if request.programmatic_setting.as_mut().unwrap().adx_deal_ids.is_none() { - request.programmatic_setting.as_mut().unwrap().adx_deal_ids = Some(Default::default()); - } - request.programmatic_setting.as_mut().unwrap().adx_deal_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "programmatic-setting.media-cost-nanos" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().media_cost_nanos = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_programmatic_setting_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "child-placement-ids" => { - request_programmatic_setting_init(&mut request); - if request.child_placement_ids.is_none() { - request.child_placement_ids = Some(Default::default()); - } - request.child_placement_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-category-id" => { - request_programmatic_setting_init(&mut request); - request.content_category_id = Some(value.unwrap_or("").to_string()); - }, - "external-id" => { - request_programmatic_setting_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.kind" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.value" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.dimension-name" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.etag" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.match-type" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.id" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "site-id" => { - request_create_info_init(&mut request); - request.site_id = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.kind" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.value" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.dimension-name" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.etag" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.match-type" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.id" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "placement-strategy-id" => { - request_site_id_dimension_value_init(&mut request); - request.placement_strategy_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_site_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_site_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_site_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.end-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.flighted" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().flighted = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.flighted", "boolean")); - }, - "pricing-schedule.disregard-overdelivery" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().disregard_overdelivery = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.disregard-overdelivery", "boolean")); - }, - "pricing-schedule.pricing-type" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().pricing_type = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.cap-cost-option" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().cap_cost_option = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.testing-start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().testing_start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.floodlight-activity-id" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placement_groups().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_groups_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placement_groups().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "site-ids" => { - call = call.add_site_ids(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "pricing-types" => { - call = call.add_pricing_types(value.unwrap_or("")); - }, - "placement-strategy-ids" => { - call = call.add_placement_strategy_ids(value.unwrap_or("")); - }, - "placement-group-type" => { - call = call.placement_group_type(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "directory-site-ids" => { - call = call.add_directory_site_ids(value.unwrap_or("")); - }, - "content-category-ids" => { - call = call.add_content_category_ids(value.unwrap_or("")); - }, - "campaign-ids" => { - call = call.add_campaign_ids(value.unwrap_or("")); - }, - "archived" => { - call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "advertiser-ids" => { - call = call.add_advertiser_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_groups_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlacementGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::PlacementGroup) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_directory_site_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::PlacementGroup) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_pricing_schedule_init(request: &mut api::PlacementGroup) { - if request.pricing_schedule.is_none() { - request.pricing_schedule = Some(Default::default()); - } - } - - fn request_primary_placement_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.primary_placement_id_dimension_value.is_none() { - request.primary_placement_id_dimension_value = Some(Default::default()); - } - } - - fn request_programmatic_setting_init(request: &mut api::PlacementGroup) { - if request.programmatic_setting.is_none() { - request.programmatic_setting = Some(Default::default()); - } - } - - fn request_site_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.site_id_dimension_value.is_none() { - request.site_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id" => { - request.primary_placement_id = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "placement-group-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.placement_group_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "programmatic-setting.trafficker-emails" => { - request_programmatic_setting_init(&mut request); - if request.programmatic_setting.as_mut().unwrap().trafficker_emails.is_none() { - request.programmatic_setting.as_mut().unwrap().trafficker_emails = Some(Default::default()); - } - request.programmatic_setting.as_mut().unwrap().trafficker_emails.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "programmatic-setting.programmatic" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().programmatic = Some(arg_from_str(value.unwrap_or("false"), err, "programmatic-setting.programmatic", "boolean")); - }, - "programmatic-setting.insertion-order-id" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().insertion_order_id = Some(value.unwrap_or("").to_string()); - }, - "programmatic-setting.insertion-order-id-status" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().insertion_order_id_status = Some(arg_from_str(value.unwrap_or("false"), err, "programmatic-setting.insertion-order-id-status", "boolean")); - }, - "programmatic-setting.adx-deal-ids" => { - request_programmatic_setting_init(&mut request); - if request.programmatic_setting.as_mut().unwrap().adx_deal_ids.is_none() { - request.programmatic_setting.as_mut().unwrap().adx_deal_ids = Some(Default::default()); - } - request.programmatic_setting.as_mut().unwrap().adx_deal_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "programmatic-setting.media-cost-nanos" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().media_cost_nanos = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_programmatic_setting_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "child-placement-ids" => { - request_programmatic_setting_init(&mut request); - if request.child_placement_ids.is_none() { - request.child_placement_ids = Some(Default::default()); - } - request.child_placement_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-category-id" => { - request_programmatic_setting_init(&mut request); - request.content_category_id = Some(value.unwrap_or("").to_string()); - }, - "external-id" => { - request_programmatic_setting_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.kind" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.value" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.dimension-name" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.etag" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.match-type" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.id" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "site-id" => { - request_create_info_init(&mut request); - request.site_id = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.kind" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.value" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.dimension-name" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.etag" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.match-type" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.id" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "placement-strategy-id" => { - request_site_id_dimension_value_init(&mut request); - request.placement_strategy_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_site_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_site_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_site_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.end-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.flighted" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().flighted = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.flighted", "boolean")); - }, - "pricing-schedule.disregard-overdelivery" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().disregard_overdelivery = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.disregard-overdelivery", "boolean")); - }, - "pricing-schedule.pricing-type" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().pricing_type = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.cap-cost-option" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().cap_cost_option = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.testing-start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().testing_start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.floodlight-activity-id" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placement_groups().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_groups_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlacementGroup::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::PlacementGroup) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_directory_site_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::PlacementGroup) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_pricing_schedule_init(request: &mut api::PlacementGroup) { - if request.pricing_schedule.is_none() { - request.pricing_schedule = Some(Default::default()); - } - } - - fn request_primary_placement_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.primary_placement_id_dimension_value.is_none() { - request.primary_placement_id_dimension_value = Some(Default::default()); - } - } - - fn request_programmatic_setting_init(request: &mut api::PlacementGroup) { - if request.programmatic_setting.is_none() { - request.programmatic_setting = Some(Default::default()); - } - } - - fn request_site_id_dimension_value_init(request: &mut api::PlacementGroup) { - if request.site_id_dimension_value.is_none() { - request.site_id_dimension_value = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id" => { - request.primary_placement_id = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "placement-group-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.placement_group_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "programmatic-setting.trafficker-emails" => { - request_programmatic_setting_init(&mut request); - if request.programmatic_setting.as_mut().unwrap().trafficker_emails.is_none() { - request.programmatic_setting.as_mut().unwrap().trafficker_emails = Some(Default::default()); - } - request.programmatic_setting.as_mut().unwrap().trafficker_emails.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "programmatic-setting.programmatic" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().programmatic = Some(arg_from_str(value.unwrap_or("false"), err, "programmatic-setting.programmatic", "boolean")); - }, - "programmatic-setting.insertion-order-id" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().insertion_order_id = Some(value.unwrap_or("").to_string()); - }, - "programmatic-setting.insertion-order-id-status" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().insertion_order_id_status = Some(arg_from_str(value.unwrap_or("false"), err, "programmatic-setting.insertion-order-id-status", "boolean")); - }, - "programmatic-setting.adx-deal-ids" => { - request_programmatic_setting_init(&mut request); - if request.programmatic_setting.as_mut().unwrap().adx_deal_ids.is_none() { - request.programmatic_setting.as_mut().unwrap().adx_deal_ids = Some(Default::default()); - } - request.programmatic_setting.as_mut().unwrap().adx_deal_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "programmatic-setting.media-cost-nanos" => { - request_programmatic_setting_init(&mut request); - request.programmatic_setting.as_mut().unwrap().media_cost_nanos = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_programmatic_setting_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "child-placement-ids" => { - request_programmatic_setting_init(&mut request); - if request.child_placement_ids.is_none() { - request.child_placement_ids = Some(Default::default()); - } - request.child_placement_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-category-id" => { - request_programmatic_setting_init(&mut request); - request.content_category_id = Some(value.unwrap_or("").to_string()); - }, - "external-id" => { - request_programmatic_setting_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.kind" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.value" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.dimension-name" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.etag" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.match-type" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "primary-placement-id-dimension-value.id" => { - request_primary_placement_id_dimension_value_init(&mut request); - request.primary_placement_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "site-id" => { - request_create_info_init(&mut request); - request.site_id = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.kind" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.value" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.dimension-name" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.etag" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.match-type" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.id" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "placement-strategy-id" => { - request_site_id_dimension_value_init(&mut request); - request.placement_strategy_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_site_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_site_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_site_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.end-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.flighted" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().flighted = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.flighted", "boolean")); - }, - "pricing-schedule.disregard-overdelivery" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().disregard_overdelivery = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.disregard-overdelivery", "boolean")); - }, - "pricing-schedule.pricing-type" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().pricing_type = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.cap-cost-option" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().cap_cost_option = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.testing-start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().testing_start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.floodlight-activity-id" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placement_groups().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_strategies_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placement_strategies().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _placement_strategies_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placement_strategies().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_strategies_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlacementStrategy::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placement_strategies().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_strategies_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placement_strategies().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_strategies_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlacementStrategy::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placement_strategies().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placement_strategies_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlacementStrategy::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placement_strategies().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placements_generatetags(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placements().generatetags(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "tag-formats" => { - call = call.add_tag_formats(value.unwrap_or("")); - }, - "placement-ids" => { - call = call.add_placement_ids(value.unwrap_or("")); - }, - "campaign-id" => { - call = call.campaign_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placements_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placements().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placements_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Placement::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Placement) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::Placement) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Placement) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_directory_site_id_dimension_value_init(request: &mut api::Placement) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Placement) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Placement) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::Placement) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - fn request_placement_group_id_dimension_value_init(request: &mut api::Placement) { - if request.placement_group_id_dimension_value.is_none() { - request.placement_group_id_dimension_value = Some(Default::default()); - } - } - - fn request_pricing_schedule_init(request: &mut api::Placement) { - if request.pricing_schedule.is_none() { - request.pricing_schedule = Some(Default::default()); - } - } - - fn request_publisher_update_info_init(request: &mut api::Placement) { - if request.publisher_update_info.is_none() { - request.publisher_update_info = Some(Default::default()); - } - } - - fn request_site_id_dimension_value_init(request: &mut api::Placement) { - if request.site_id_dimension_value.is_none() { - request.site_id_dimension_value = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Placement) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - fn request_tag_setting_init(request: &mut api::Placement) { - if request.tag_setting.is_none() { - request.tag_setting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "payment-source" => { - request.payment_source = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "key-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.key_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_advertiser_id_dimension_value_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "publisher-update-info.time" => { - request_publisher_update_info_init(&mut request); - request.publisher_update_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "tag-formats" => { - request_publisher_update_info_init(&mut request); - if request.tag_formats.is_none() { - request.tag_formats = Some(Default::default()); - } - request.tag_formats.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "payment-approved" => { - request_publisher_update_info_init(&mut request); - request.payment_approved = Some(arg_from_str(value.unwrap_or("false"), err, "payment-approved", "boolean")); - }, - "tag-setting.include-click-through-urls" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().include_click_through_urls = Some(arg_from_str(value.unwrap_or("false"), err, "tag-setting.include-click-through-urls", "boolean")); - }, - "tag-setting.include-click-tracking" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().include_click_tracking = Some(arg_from_str(value.unwrap_or("false"), err, "tag-setting.include-click-tracking", "boolean")); - }, - "tag-setting.additional-key-values" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().additional_key_values = Some(value.unwrap_or("").to_string()); - }, - "tag-setting.keyword-option" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().keyword_option = Some(value.unwrap_or("").to_string()); - }, - "content-category-id" => { - request_tag_setting_init(&mut request); - request.content_category_id = Some(value.unwrap_or("").to_string()); - }, - "external-id" => { - request_tag_setting_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "ssl-required" => { - request_size_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "status" => { - request_size_init(&mut request); - request.status = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "primary" => { - request_campaign_id_dimension_value_init(&mut request); - request.primary = Some(arg_from_str(value.unwrap_or("false"), err, "primary", "boolean")); - }, - "placement-group-id" => { - request_campaign_id_dimension_value_init(&mut request); - request.placement_group_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "site-id" => { - request_create_info_init(&mut request); - request.site_id = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.kind" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.value" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.dimension-name" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.etag" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.match-type" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.id" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "compatibility" => { - request_site_id_dimension_value_init(&mut request); - request.compatibility = Some(value.unwrap_or("").to_string()); - }, - "placement-strategy-id" => { - request_site_id_dimension_value_init(&mut request); - request.placement_strategy_id = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.kind" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.value" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.dimension-name" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.etag" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.match-type" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.id" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_placement_group_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_placement_group_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_placement_group_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.end-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.flighted" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().flighted = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.flighted", "boolean")); - }, - "pricing-schedule.disregard-overdelivery" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().disregard_overdelivery = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.disregard-overdelivery", "boolean")); - }, - "pricing-schedule.pricing-type" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().pricing_type = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.cap-cost-option" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().cap_cost_option = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.testing-start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().testing_start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.floodlight-activity-id" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placements().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placements_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.placements().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "size-ids" => { - call = call.add_size_ids(value.unwrap_or("")); - }, - "site-ids" => { - call = call.add_site_ids(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "pricing-types" => { - call = call.add_pricing_types(value.unwrap_or("")); - }, - "placement-strategy-ids" => { - call = call.add_placement_strategy_ids(value.unwrap_or("")); - }, - "payment-source" => { - call = call.payment_source(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "group-ids" => { - call = call.add_group_ids(value.unwrap_or("")); - }, - "directory-site-ids" => { - call = call.add_directory_site_ids(value.unwrap_or("")); - }, - "content-category-ids" => { - call = call.add_content_category_ids(value.unwrap_or("")); - }, - "compatibilities" => { - call = call.add_compatibilities(value.unwrap_or("")); - }, - "campaign-ids" => { - call = call.add_campaign_ids(value.unwrap_or("")); - }, - "archived" => { - call = call.archived(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "advertiser-ids" => { - call = call.add_advertiser_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placements_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Placement::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Placement) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::Placement) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Placement) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_directory_site_id_dimension_value_init(request: &mut api::Placement) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Placement) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Placement) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::Placement) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - fn request_placement_group_id_dimension_value_init(request: &mut api::Placement) { - if request.placement_group_id_dimension_value.is_none() { - request.placement_group_id_dimension_value = Some(Default::default()); - } - } - - fn request_pricing_schedule_init(request: &mut api::Placement) { - if request.pricing_schedule.is_none() { - request.pricing_schedule = Some(Default::default()); - } - } - - fn request_publisher_update_info_init(request: &mut api::Placement) { - if request.publisher_update_info.is_none() { - request.publisher_update_info = Some(Default::default()); - } - } - - fn request_site_id_dimension_value_init(request: &mut api::Placement) { - if request.site_id_dimension_value.is_none() { - request.site_id_dimension_value = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Placement) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - fn request_tag_setting_init(request: &mut api::Placement) { - if request.tag_setting.is_none() { - request.tag_setting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "payment-source" => { - request.payment_source = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "key-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.key_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_advertiser_id_dimension_value_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "publisher-update-info.time" => { - request_publisher_update_info_init(&mut request); - request.publisher_update_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "tag-formats" => { - request_publisher_update_info_init(&mut request); - if request.tag_formats.is_none() { - request.tag_formats = Some(Default::default()); - } - request.tag_formats.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "payment-approved" => { - request_publisher_update_info_init(&mut request); - request.payment_approved = Some(arg_from_str(value.unwrap_or("false"), err, "payment-approved", "boolean")); - }, - "tag-setting.include-click-through-urls" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().include_click_through_urls = Some(arg_from_str(value.unwrap_or("false"), err, "tag-setting.include-click-through-urls", "boolean")); - }, - "tag-setting.include-click-tracking" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().include_click_tracking = Some(arg_from_str(value.unwrap_or("false"), err, "tag-setting.include-click-tracking", "boolean")); - }, - "tag-setting.additional-key-values" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().additional_key_values = Some(value.unwrap_or("").to_string()); - }, - "tag-setting.keyword-option" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().keyword_option = Some(value.unwrap_or("").to_string()); - }, - "content-category-id" => { - request_tag_setting_init(&mut request); - request.content_category_id = Some(value.unwrap_or("").to_string()); - }, - "external-id" => { - request_tag_setting_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "ssl-required" => { - request_size_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "status" => { - request_size_init(&mut request); - request.status = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "primary" => { - request_campaign_id_dimension_value_init(&mut request); - request.primary = Some(arg_from_str(value.unwrap_or("false"), err, "primary", "boolean")); - }, - "placement-group-id" => { - request_campaign_id_dimension_value_init(&mut request); - request.placement_group_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "site-id" => { - request_create_info_init(&mut request); - request.site_id = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.kind" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.value" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.dimension-name" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.etag" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.match-type" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.id" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "compatibility" => { - request_site_id_dimension_value_init(&mut request); - request.compatibility = Some(value.unwrap_or("").to_string()); - }, - "placement-strategy-id" => { - request_site_id_dimension_value_init(&mut request); - request.placement_strategy_id = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.kind" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.value" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.dimension-name" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.etag" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.match-type" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.id" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_placement_group_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_placement_group_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_placement_group_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.end-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.flighted" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().flighted = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.flighted", "boolean")); - }, - "pricing-schedule.disregard-overdelivery" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().disregard_overdelivery = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.disregard-overdelivery", "boolean")); - }, - "pricing-schedule.pricing-type" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().pricing_type = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.cap-cost-option" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().cap_cost_option = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.testing-start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().testing_start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.floodlight-activity-id" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placements().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _placements_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Placement::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::Placement) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_campaign_id_dimension_value_init(request: &mut api::Placement) { - if request.campaign_id_dimension_value.is_none() { - request.campaign_id_dimension_value = Some(Default::default()); - } - } - - fn request_create_info_init(request: &mut api::Placement) { - if request.create_info.is_none() { - request.create_info = Some(Default::default()); - } - } - - fn request_directory_site_id_dimension_value_init(request: &mut api::Placement) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Placement) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_last_modified_info_init(request: &mut api::Placement) { - if request.last_modified_info.is_none() { - request.last_modified_info = Some(Default::default()); - } - } - - fn request_lookback_configuration_init(request: &mut api::Placement) { - if request.lookback_configuration.is_none() { - request.lookback_configuration = Some(Default::default()); - } - } - - fn request_placement_group_id_dimension_value_init(request: &mut api::Placement) { - if request.placement_group_id_dimension_value.is_none() { - request.placement_group_id_dimension_value = Some(Default::default()); - } - } - - fn request_pricing_schedule_init(request: &mut api::Placement) { - if request.pricing_schedule.is_none() { - request.pricing_schedule = Some(Default::default()); - } - } - - fn request_publisher_update_info_init(request: &mut api::Placement) { - if request.publisher_update_info.is_none() { - request.publisher_update_info = Some(Default::default()); - } - } - - fn request_site_id_dimension_value_init(request: &mut api::Placement) { - if request.site_id_dimension_value.is_none() { - request.site_id_dimension_value = Some(Default::default()); - } - } - - fn request_size_init(request: &mut api::Placement) { - if request.size.is_none() { - request.size = Some(Default::default()); - } - } - - fn request_tag_setting_init(request: &mut api::Placement) { - if request.tag_setting.is_none() { - request.tag_setting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "comment" => { - request.comment = Some(value.unwrap_or("").to_string()); - }, - "campaign-id" => { - request.campaign_id = Some(value.unwrap_or("").to_string()); - }, - "payment-source" => { - request.payment_source = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "key-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.key_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "archived" => { - request_advertiser_id_dimension_value_init(&mut request); - request.archived = Some(arg_from_str(value.unwrap_or("false"), err, "archived", "boolean")); - }, - "publisher-update-info.time" => { - request_publisher_update_info_init(&mut request); - request.publisher_update_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "tag-formats" => { - request_publisher_update_info_init(&mut request); - if request.tag_formats.is_none() { - request.tag_formats = Some(Default::default()); - } - request.tag_formats.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "payment-approved" => { - request_publisher_update_info_init(&mut request); - request.payment_approved = Some(arg_from_str(value.unwrap_or("false"), err, "payment-approved", "boolean")); - }, - "tag-setting.include-click-through-urls" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().include_click_through_urls = Some(arg_from_str(value.unwrap_or("false"), err, "tag-setting.include-click-through-urls", "boolean")); - }, - "tag-setting.include-click-tracking" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().include_click_tracking = Some(arg_from_str(value.unwrap_or("false"), err, "tag-setting.include-click-tracking", "boolean")); - }, - "tag-setting.additional-key-values" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().additional_key_values = Some(value.unwrap_or("").to_string()); - }, - "tag-setting.keyword-option" => { - request_tag_setting_init(&mut request); - request.tag_setting.as_mut().unwrap().keyword_option = Some(value.unwrap_or("").to_string()); - }, - "content-category-id" => { - request_tag_setting_init(&mut request); - request.content_category_id = Some(value.unwrap_or("").to_string()); - }, - "external-id" => { - request_tag_setting_init(&mut request); - request.external_id = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.width" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "size.width", "integer")); - }, - "size.kind" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "size.iab" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().iab = Some(arg_from_str(value.unwrap_or("false"), err, "size.iab", "boolean")); - }, - "size.id" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "size.height" => { - request_size_init(&mut request); - request.size.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "size.height", "integer")); - }, - "ssl-required" => { - request_size_init(&mut request); - request.ssl_required = Some(arg_from_str(value.unwrap_or("false"), err, "ssl-required", "boolean")); - }, - "status" => { - request_size_init(&mut request); - request.status = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.kind" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.value" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.dimension-name" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.etag" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.match-type" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "campaign-id-dimension-value.id" => { - request_campaign_id_dimension_value_init(&mut request); - request.campaign_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "primary" => { - request_campaign_id_dimension_value_init(&mut request); - request.primary = Some(arg_from_str(value.unwrap_or("false"), err, "primary", "boolean")); - }, - "placement-group-id" => { - request_campaign_id_dimension_value_init(&mut request); - request.placement_group_id = Some(value.unwrap_or("").to_string()); - }, - "create-info.time" => { - request_create_info_init(&mut request); - request.create_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "site-id" => { - request_create_info_init(&mut request); - request.site_id = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.kind" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.value" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.dimension-name" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.etag" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.match-type" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "site-id-dimension-value.id" => { - request_site_id_dimension_value_init(&mut request); - request.site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "compatibility" => { - request_site_id_dimension_value_init(&mut request); - request.compatibility = Some(value.unwrap_or("").to_string()); - }, - "placement-strategy-id" => { - request_site_id_dimension_value_init(&mut request); - request.placement_strategy_id = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.kind" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.value" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.dimension-name" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.etag" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.match-type" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "placement-group-id-dimension-value.id" => { - request_placement_group_id_dimension_value_init(&mut request); - request.placement_group_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_placement_group_id_dimension_value_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_placement_group_id_dimension_value_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_placement_group_id_dimension_value_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "lookback-configuration.click-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.click-duration", "integer")); - }, - "lookback-configuration.post-impression-activities-duration" => { - request_lookback_configuration_init(&mut request); - request.lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "lookback-configuration.post-impression-activities-duration", "integer")); - }, - "last-modified-info.time" => { - request_last_modified_info_init(&mut request); - request.last_modified_info.as_mut().unwrap().time = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.end-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.flighted" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().flighted = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.flighted", "boolean")); - }, - "pricing-schedule.disregard-overdelivery" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().disregard_overdelivery = Some(arg_from_str(value.unwrap_or("false"), err, "pricing-schedule.disregard-overdelivery", "boolean")); - }, - "pricing-schedule.pricing-type" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().pricing_type = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.cap-cost-option" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().cap_cost_option = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.testing-start-date" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().testing_start_date = Some(value.unwrap_or("").to_string()); - }, - "pricing-schedule.floodlight-activity-id" => { - request_pricing_schedule_init(&mut request); - request.pricing_schedule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.placements().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _platform_types_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.platform_types().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _platform_types_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.platform_types().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _postal_codes_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.postal_codes().get(&self.opt.arg_profile_id, &self.opt.arg_code); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _postal_codes_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.postal_codes().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _projects_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.projects().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _projects_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.projects().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "advertiser-ids" => { - call = call.add_advertiser_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _regions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.regions().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_list_shares_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.remarketing_list_shares().get(&self.opt.arg_profile_id, &self.opt.arg_remarketing_list_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_list_shares_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::RemarketingListShare::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "shared-advertiser-ids" => { - if request.shared_advertiser_ids.is_none() { - request.shared_advertiser_ids = Some(Default::default()); - } - request.shared_advertiser_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "remarketing-list-id" => { - request.remarketing_list_id = Some(value.unwrap_or("").to_string()); - }, - "shared-account-ids" => { - if request.shared_account_ids.is_none() { - request.shared_account_ids = Some(Default::default()); - } - request.shared_account_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.remarketing_list_shares().patch(request, &self.opt.arg_profile_id, &self.opt.arg_remarketing_list_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_list_shares_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::RemarketingListShare::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "shared-advertiser-ids" => { - if request.shared_advertiser_ids.is_none() { - request.shared_advertiser_ids = Some(Default::default()); - } - request.shared_advertiser_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "remarketing-list-id" => { - request.remarketing_list_id = Some(value.unwrap_or("").to_string()); - }, - "shared-account-ids" => { - if request.shared_account_ids.is_none() { - request.shared_account_ids = Some(Default::default()); - } - request.shared_account_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.remarketing_list_shares().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_lists_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.remarketing_lists().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_lists_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::RemarketingList::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::RemarketingList) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_list_population_rule_init(request: &mut api::RemarketingList) { - if request.list_population_rule.is_none() { - request.list_population_rule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "list-population-rule.floodlight-activity-name" => { - request_list_population_rule_init(&mut request); - request.list_population_rule.as_mut().unwrap().floodlight_activity_name = Some(value.unwrap_or("").to_string()); - }, - "list-population-rule.floodlight-activity-id" => { - request_list_population_rule_init(&mut request); - request.list_population_rule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_list_population_rule_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_list_population_rule_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "description" => { - request_list_population_rule_init(&mut request); - request.description = Some(value.unwrap_or("").to_string()); - }, - "list-size" => { - request_list_population_rule_init(&mut request); - request.list_size = Some(value.unwrap_or("").to_string()); - }, - "life-span" => { - request_list_population_rule_init(&mut request); - request.life_span = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_list_population_rule_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_list_population_rule_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_list_population_rule_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "list-source" => { - request_advertiser_id_dimension_value_init(&mut request); - request.list_source = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.remarketing_lists().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_lists_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.remarketing_lists().list(&self.opt.arg_profile_id, &self.opt.arg_advertiser_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "name" => { - call = call.name(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "floodlight-activity-id" => { - call = call.floodlight_activity_id(value.unwrap_or("")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_lists_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::RemarketingList::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::RemarketingList) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_list_population_rule_init(request: &mut api::RemarketingList) { - if request.list_population_rule.is_none() { - request.list_population_rule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "list-population-rule.floodlight-activity-name" => { - request_list_population_rule_init(&mut request); - request.list_population_rule.as_mut().unwrap().floodlight_activity_name = Some(value.unwrap_or("").to_string()); - }, - "list-population-rule.floodlight-activity-id" => { - request_list_population_rule_init(&mut request); - request.list_population_rule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_list_population_rule_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_list_population_rule_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "description" => { - request_list_population_rule_init(&mut request); - request.description = Some(value.unwrap_or("").to_string()); - }, - "list-size" => { - request_list_population_rule_init(&mut request); - request.list_size = Some(value.unwrap_or("").to_string()); - }, - "life-span" => { - request_list_population_rule_init(&mut request); - request.life_span = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_list_population_rule_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_list_population_rule_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_list_population_rule_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "list-source" => { - request_advertiser_id_dimension_value_init(&mut request); - request.list_source = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.remarketing_lists().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _remarketing_lists_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::RemarketingList::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_advertiser_id_dimension_value_init(request: &mut api::RemarketingList) { - if request.advertiser_id_dimension_value.is_none() { - request.advertiser_id_dimension_value = Some(Default::default()); - } - } - - fn request_list_population_rule_init(request: &mut api::RemarketingList) { - if request.list_population_rule.is_none() { - request.list_population_rule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "list-population-rule.floodlight-activity-name" => { - request_list_population_rule_init(&mut request); - request.list_population_rule.as_mut().unwrap().floodlight_activity_name = Some(value.unwrap_or("").to_string()); - }, - "list-population-rule.floodlight-activity-id" => { - request_list_population_rule_init(&mut request); - request.list_population_rule.as_mut().unwrap().floodlight_activity_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_list_population_rule_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request_list_population_rule_init(&mut request); - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "description" => { - request_list_population_rule_init(&mut request); - request.description = Some(value.unwrap_or("").to_string()); - }, - "list-size" => { - request_list_population_rule_init(&mut request); - request.list_size = Some(value.unwrap_or("").to_string()); - }, - "life-span" => { - request_list_population_rule_init(&mut request); - request.life_span = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_list_population_rule_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id" => { - request_list_population_rule_init(&mut request); - request.advertiser_id = Some(value.unwrap_or("").to_string()); - }, - "active" => { - request_list_population_rule_init(&mut request); - request.active = Some(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "advertiser-id-dimension-value.kind" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.value" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.dimension-name" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.etag" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.match-type" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "advertiser-id-dimension-value.id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.advertiser_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_advertiser_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "list-source" => { - request_advertiser_id_dimension_value_init(&mut request); - request.list_source = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.remarketing_lists().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_compatible_fields_query(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Report::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_criteria_activities_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().activities.is_none() { - request.criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_criteria_date_range_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().date_range.is_none() { - request.criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_criteria_init(request: &mut api::Report) { - if request.criteria.is_none() { - request.criteria = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_date_range_init(request: &mut api::Report) { - request_cross_dimension_reach_criteria_init(request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_init(request: &mut api::Report) { - if request.cross_dimension_reach_criteria.is_none() { - request.cross_dimension_reach_criteria = Some(Default::default()); - } - } - - fn request_delivery_init(request: &mut api::Report) { - if request.delivery.is_none() { - request.delivery = Some(Default::default()); - } - } - - fn request_floodlight_criteria_date_range_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().date_range.is_none() { - request.floodlight_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_floodlight_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_floodlight_criteria_init(request: &mut api::Report) { - if request.floodlight_criteria.is_none() { - request.floodlight_criteria = Some(Default::default()); - } - } - - fn request_floodlight_criteria_report_properties_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().report_properties.is_none() { - request.floodlight_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_date_range_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().date_range.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_init(request: &mut api::Report) { - if request.path_to_conversion_criteria.is_none() { - request.path_to_conversion_criteria = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_report_properties_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().report_properties.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_reach_criteria_activities_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().activities.is_none() { - request.reach_criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_reach_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.reach_criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_reach_criteria_date_range_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().date_range.is_none() { - request.reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_reach_criteria_init(request: &mut api::Report) { - if request.reach_criteria.is_none() { - request.reach_criteria = Some(Default::default()); - } - } - - fn request_schedule_init(request: &mut api::Report) { - if request.schedule.is_none() { - request.schedule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "criteria.activities.kind" => { - request_criteria_activities_init(&mut request); - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.activities.metric-names" => { - request_criteria_activities_init(&mut request); - if request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "criteria.date-range.start-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.kind" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.end-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.relative-date-range" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "criteria.custom-rich-media-events.kind" => { - request_criteria_custom_rich_media_events_init(&mut request); - request.criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.metric-names" => { - request_criteria_custom_rich_media_events_init(&mut request); - if request.criteria.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_criteria_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "sub-account-id" => { - request_criteria_init(&mut request); - request.sub_account_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_criteria_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "schedule.start-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.runs-on-day-of-month" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().runs_on_day_of_month = Some(value.unwrap_or("").to_string()); - }, - "schedule.every" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().every = Some(arg_from_str(value.unwrap_or("-0"), err, "schedule.every", "integer")); - }, - "schedule.expiration-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().expiration_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.active" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().active = Some(arg_from_str(value.unwrap_or("false"), err, "schedule.active", "boolean")); - }, - "schedule.repeats" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().repeats = Some(value.unwrap_or("").to_string()); - }, - "schedule.repeats-on-week-days" => { - request_schedule_init(&mut request); - if request.schedule.as_mut().unwrap().repeats_on_week_days.is_none() { - request.schedule.as_mut().unwrap().repeats_on_week_days = Some(Default::default()); - } - request.schedule.as_mut().unwrap().repeats_on_week_days.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.start-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.kind" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.end-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.relative-date-range" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.kind" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.value" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.dimension-name" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.etag" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.match-type" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.id" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.report-properties.clicks-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().clicks_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.clicks-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().pivot_on_interaction_path = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.pivot-on-interaction-path", "boolean")); - }, - "path-to-conversion-criteria.report-properties.impressions-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().impressions_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.impressions-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_interaction_gap = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-interaction-gap", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-click-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_click_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-click-interactions", "integer")); - }, - "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_impression_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-impression-interactions", "integer")); - }, - "path-to-conversion-criteria.metric-names" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - if request.path_to_conversion_criteria.as_mut().unwrap().metric_names.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.path_to_conversion_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "format" => { - request_path_to_conversion_criteria_init(&mut request); - request.format = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.kind" => { - request_reach_criteria_activities_init(&mut request); - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.start-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.kind" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.end-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.relative-date-range" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.reach-by-frequency-metric-names" => { - request_reach_criteria_date_range_init(&mut request); - if request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.custom-rich-media-events.kind" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.enable-all-dimension-combinations" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().enable_all_dimension_combinations = Some(arg_from_str(value.unwrap_or("false"), err, "reach-criteria.enable-all-dimension-combinations", "boolean")); - }, - "file-name" => { - request_reach_criteria_init(&mut request); - request.file_name = Some(value.unwrap_or("").to_string()); - }, - "delivery.message" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().message = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner-delivery-type" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner_delivery_type = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner = Some(arg_from_str(value.unwrap_or("false"), err, "delivery.email-owner", "boolean")); - }, - "etag" => { - request_delivery_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "owner-profile-id" => { - request_delivery_init(&mut request); - request.owner_profile_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_delivery_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "last-modified-time" => { - request_delivery_init(&mut request); - request.last_modified_time = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_delivery_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_delivery_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.start-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.kind" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.end-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.relative-date-range" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.kind" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.value" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.dimension-name" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.etag" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.match-type" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.id" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-attributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.metric-names" => { - request_floodlight_criteria_report_properties_init(&mut request); - if request.floodlight_criteria.as_mut().unwrap().metric_names.is_none() { - request.floodlight_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.floodlight_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.pivoted" => { - request_cross_dimension_reach_criteria_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().pivoted = Some(arg_from_str(value.unwrap_or("false"), err, "cross-dimension-reach-criteria.pivoted", "boolean")); - }, - "cross-dimension-reach-criteria.date-range.start-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.kind" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.end-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.relative-date-range" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.dimension" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().dimension = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.overlap-metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.reports().compatible_fields_query(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.reports().delete(&self.opt.arg_profile_id, &self.opt.arg_report_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _reports_files_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut download_mode = false; - let mut call = self.hub.reports().files_get(&self.opt.arg_profile_id, &self.opt.arg_report_id, &self.opt.arg_file_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - if key == "alt" && value.unwrap_or("unset") == "media" { - download_mode = true; - } - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - if !download_mode { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - } else { - io::copy(&mut response, &mut ostream).unwrap(); - } - None - } - } - } - } - - fn _reports_files_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.reports().files_list(&self.opt.arg_profile_id, &self.opt.arg_report_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.reports().get(&self.opt.arg_profile_id, &self.opt.arg_report_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Report::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_criteria_activities_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().activities.is_none() { - request.criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_criteria_date_range_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().date_range.is_none() { - request.criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_criteria_init(request: &mut api::Report) { - if request.criteria.is_none() { - request.criteria = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_date_range_init(request: &mut api::Report) { - request_cross_dimension_reach_criteria_init(request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_init(request: &mut api::Report) { - if request.cross_dimension_reach_criteria.is_none() { - request.cross_dimension_reach_criteria = Some(Default::default()); - } - } - - fn request_delivery_init(request: &mut api::Report) { - if request.delivery.is_none() { - request.delivery = Some(Default::default()); - } - } - - fn request_floodlight_criteria_date_range_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().date_range.is_none() { - request.floodlight_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_floodlight_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_floodlight_criteria_init(request: &mut api::Report) { - if request.floodlight_criteria.is_none() { - request.floodlight_criteria = Some(Default::default()); - } - } - - fn request_floodlight_criteria_report_properties_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().report_properties.is_none() { - request.floodlight_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_date_range_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().date_range.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_init(request: &mut api::Report) { - if request.path_to_conversion_criteria.is_none() { - request.path_to_conversion_criteria = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_report_properties_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().report_properties.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_reach_criteria_activities_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().activities.is_none() { - request.reach_criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_reach_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.reach_criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_reach_criteria_date_range_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().date_range.is_none() { - request.reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_reach_criteria_init(request: &mut api::Report) { - if request.reach_criteria.is_none() { - request.reach_criteria = Some(Default::default()); - } - } - - fn request_schedule_init(request: &mut api::Report) { - if request.schedule.is_none() { - request.schedule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "criteria.activities.kind" => { - request_criteria_activities_init(&mut request); - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.activities.metric-names" => { - request_criteria_activities_init(&mut request); - if request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "criteria.date-range.start-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.kind" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.end-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.relative-date-range" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "criteria.custom-rich-media-events.kind" => { - request_criteria_custom_rich_media_events_init(&mut request); - request.criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.metric-names" => { - request_criteria_custom_rich_media_events_init(&mut request); - if request.criteria.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_criteria_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "sub-account-id" => { - request_criteria_init(&mut request); - request.sub_account_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_criteria_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "schedule.start-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.runs-on-day-of-month" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().runs_on_day_of_month = Some(value.unwrap_or("").to_string()); - }, - "schedule.every" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().every = Some(arg_from_str(value.unwrap_or("-0"), err, "schedule.every", "integer")); - }, - "schedule.expiration-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().expiration_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.active" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().active = Some(arg_from_str(value.unwrap_or("false"), err, "schedule.active", "boolean")); - }, - "schedule.repeats" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().repeats = Some(value.unwrap_or("").to_string()); - }, - "schedule.repeats-on-week-days" => { - request_schedule_init(&mut request); - if request.schedule.as_mut().unwrap().repeats_on_week_days.is_none() { - request.schedule.as_mut().unwrap().repeats_on_week_days = Some(Default::default()); - } - request.schedule.as_mut().unwrap().repeats_on_week_days.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.start-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.kind" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.end-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.relative-date-range" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.kind" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.value" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.dimension-name" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.etag" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.match-type" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.id" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.report-properties.clicks-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().clicks_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.clicks-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().pivot_on_interaction_path = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.pivot-on-interaction-path", "boolean")); - }, - "path-to-conversion-criteria.report-properties.impressions-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().impressions_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.impressions-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_interaction_gap = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-interaction-gap", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-click-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_click_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-click-interactions", "integer")); - }, - "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_impression_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-impression-interactions", "integer")); - }, - "path-to-conversion-criteria.metric-names" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - if request.path_to_conversion_criteria.as_mut().unwrap().metric_names.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.path_to_conversion_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "format" => { - request_path_to_conversion_criteria_init(&mut request); - request.format = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.kind" => { - request_reach_criteria_activities_init(&mut request); - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.start-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.kind" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.end-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.relative-date-range" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.reach-by-frequency-metric-names" => { - request_reach_criteria_date_range_init(&mut request); - if request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.custom-rich-media-events.kind" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.enable-all-dimension-combinations" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().enable_all_dimension_combinations = Some(arg_from_str(value.unwrap_or("false"), err, "reach-criteria.enable-all-dimension-combinations", "boolean")); - }, - "file-name" => { - request_reach_criteria_init(&mut request); - request.file_name = Some(value.unwrap_or("").to_string()); - }, - "delivery.message" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().message = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner-delivery-type" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner_delivery_type = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner = Some(arg_from_str(value.unwrap_or("false"), err, "delivery.email-owner", "boolean")); - }, - "etag" => { - request_delivery_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "owner-profile-id" => { - request_delivery_init(&mut request); - request.owner_profile_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_delivery_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "last-modified-time" => { - request_delivery_init(&mut request); - request.last_modified_time = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_delivery_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_delivery_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.start-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.kind" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.end-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.relative-date-range" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.kind" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.value" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.dimension-name" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.etag" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.match-type" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.id" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-attributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.metric-names" => { - request_floodlight_criteria_report_properties_init(&mut request); - if request.floodlight_criteria.as_mut().unwrap().metric_names.is_none() { - request.floodlight_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.floodlight_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.pivoted" => { - request_cross_dimension_reach_criteria_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().pivoted = Some(arg_from_str(value.unwrap_or("false"), err, "cross-dimension-reach-criteria.pivoted", "boolean")); - }, - "cross-dimension-reach-criteria.date-range.start-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.kind" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.end-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.relative-date-range" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.dimension" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().dimension = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.overlap-metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.reports().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.reports().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "scope" => { - call = call.scope(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Report::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_criteria_activities_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().activities.is_none() { - request.criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_criteria_date_range_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().date_range.is_none() { - request.criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_criteria_init(request: &mut api::Report) { - if request.criteria.is_none() { - request.criteria = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_date_range_init(request: &mut api::Report) { - request_cross_dimension_reach_criteria_init(request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_init(request: &mut api::Report) { - if request.cross_dimension_reach_criteria.is_none() { - request.cross_dimension_reach_criteria = Some(Default::default()); - } - } - - fn request_delivery_init(request: &mut api::Report) { - if request.delivery.is_none() { - request.delivery = Some(Default::default()); - } - } - - fn request_floodlight_criteria_date_range_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().date_range.is_none() { - request.floodlight_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_floodlight_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_floodlight_criteria_init(request: &mut api::Report) { - if request.floodlight_criteria.is_none() { - request.floodlight_criteria = Some(Default::default()); - } - } - - fn request_floodlight_criteria_report_properties_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().report_properties.is_none() { - request.floodlight_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_date_range_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().date_range.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_init(request: &mut api::Report) { - if request.path_to_conversion_criteria.is_none() { - request.path_to_conversion_criteria = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_report_properties_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().report_properties.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_reach_criteria_activities_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().activities.is_none() { - request.reach_criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_reach_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.reach_criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_reach_criteria_date_range_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().date_range.is_none() { - request.reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_reach_criteria_init(request: &mut api::Report) { - if request.reach_criteria.is_none() { - request.reach_criteria = Some(Default::default()); - } - } - - fn request_schedule_init(request: &mut api::Report) { - if request.schedule.is_none() { - request.schedule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "criteria.activities.kind" => { - request_criteria_activities_init(&mut request); - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.activities.metric-names" => { - request_criteria_activities_init(&mut request); - if request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "criteria.date-range.start-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.kind" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.end-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.relative-date-range" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "criteria.custom-rich-media-events.kind" => { - request_criteria_custom_rich_media_events_init(&mut request); - request.criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.metric-names" => { - request_criteria_custom_rich_media_events_init(&mut request); - if request.criteria.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_criteria_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "sub-account-id" => { - request_criteria_init(&mut request); - request.sub_account_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_criteria_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "schedule.start-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.runs-on-day-of-month" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().runs_on_day_of_month = Some(value.unwrap_or("").to_string()); - }, - "schedule.every" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().every = Some(arg_from_str(value.unwrap_or("-0"), err, "schedule.every", "integer")); - }, - "schedule.expiration-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().expiration_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.active" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().active = Some(arg_from_str(value.unwrap_or("false"), err, "schedule.active", "boolean")); - }, - "schedule.repeats" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().repeats = Some(value.unwrap_or("").to_string()); - }, - "schedule.repeats-on-week-days" => { - request_schedule_init(&mut request); - if request.schedule.as_mut().unwrap().repeats_on_week_days.is_none() { - request.schedule.as_mut().unwrap().repeats_on_week_days = Some(Default::default()); - } - request.schedule.as_mut().unwrap().repeats_on_week_days.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.start-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.kind" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.end-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.relative-date-range" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.kind" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.value" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.dimension-name" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.etag" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.match-type" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.id" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.report-properties.clicks-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().clicks_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.clicks-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().pivot_on_interaction_path = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.pivot-on-interaction-path", "boolean")); - }, - "path-to-conversion-criteria.report-properties.impressions-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().impressions_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.impressions-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_interaction_gap = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-interaction-gap", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-click-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_click_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-click-interactions", "integer")); - }, - "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_impression_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-impression-interactions", "integer")); - }, - "path-to-conversion-criteria.metric-names" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - if request.path_to_conversion_criteria.as_mut().unwrap().metric_names.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.path_to_conversion_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "format" => { - request_path_to_conversion_criteria_init(&mut request); - request.format = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.kind" => { - request_reach_criteria_activities_init(&mut request); - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.start-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.kind" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.end-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.relative-date-range" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.reach-by-frequency-metric-names" => { - request_reach_criteria_date_range_init(&mut request); - if request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.custom-rich-media-events.kind" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.enable-all-dimension-combinations" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().enable_all_dimension_combinations = Some(arg_from_str(value.unwrap_or("false"), err, "reach-criteria.enable-all-dimension-combinations", "boolean")); - }, - "file-name" => { - request_reach_criteria_init(&mut request); - request.file_name = Some(value.unwrap_or("").to_string()); - }, - "delivery.message" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().message = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner-delivery-type" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner_delivery_type = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner = Some(arg_from_str(value.unwrap_or("false"), err, "delivery.email-owner", "boolean")); - }, - "etag" => { - request_delivery_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "owner-profile-id" => { - request_delivery_init(&mut request); - request.owner_profile_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_delivery_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "last-modified-time" => { - request_delivery_init(&mut request); - request.last_modified_time = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_delivery_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_delivery_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.start-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.kind" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.end-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.relative-date-range" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.kind" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.value" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.dimension-name" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.etag" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.match-type" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.id" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-attributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.metric-names" => { - request_floodlight_criteria_report_properties_init(&mut request); - if request.floodlight_criteria.as_mut().unwrap().metric_names.is_none() { - request.floodlight_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.floodlight_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.pivoted" => { - request_cross_dimension_reach_criteria_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().pivoted = Some(arg_from_str(value.unwrap_or("false"), err, "cross-dimension-reach-criteria.pivoted", "boolean")); - }, - "cross-dimension-reach-criteria.date-range.start-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.kind" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.end-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.relative-date-range" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.dimension" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().dimension = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.overlap-metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.reports().patch(request, &self.opt.arg_profile_id, &self.opt.arg_report_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_run(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.reports().run(&self.opt.arg_profile_id, &self.opt.arg_report_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "synchronous" => { - call = call.synchronous(arg_from_str(value.unwrap_or("false"), err, "synchronous", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _reports_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Report::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_criteria_activities_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().activities.is_none() { - request.criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_criteria_date_range_init(request: &mut api::Report) { - request_criteria_init(request); - if request.criteria.as_mut().unwrap().date_range.is_none() { - request.criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_criteria_init(request: &mut api::Report) { - if request.criteria.is_none() { - request.criteria = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_date_range_init(request: &mut api::Report) { - request_cross_dimension_reach_criteria_init(request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_cross_dimension_reach_criteria_init(request: &mut api::Report) { - if request.cross_dimension_reach_criteria.is_none() { - request.cross_dimension_reach_criteria = Some(Default::default()); - } - } - - fn request_delivery_init(request: &mut api::Report) { - if request.delivery.is_none() { - request.delivery = Some(Default::default()); - } - } - - fn request_floodlight_criteria_date_range_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().date_range.is_none() { - request.floodlight_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_floodlight_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_floodlight_criteria_init(request: &mut api::Report) { - if request.floodlight_criteria.is_none() { - request.floodlight_criteria = Some(Default::default()); - } - } - - fn request_floodlight_criteria_report_properties_init(request: &mut api::Report) { - request_floodlight_criteria_init(request); - if request.floodlight_criteria.as_mut().unwrap().report_properties.is_none() { - request.floodlight_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_date_range_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().date_range.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_floodlight_config_id_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_init(request: &mut api::Report) { - if request.path_to_conversion_criteria.is_none() { - request.path_to_conversion_criteria = Some(Default::default()); - } - } - - fn request_path_to_conversion_criteria_report_properties_init(request: &mut api::Report) { - request_path_to_conversion_criteria_init(request); - if request.path_to_conversion_criteria.as_mut().unwrap().report_properties.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().report_properties = Some(Default::default()); - } - } - - fn request_reach_criteria_activities_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().activities.is_none() { - request.reach_criteria.as_mut().unwrap().activities = Some(Default::default()); - } - } - - fn request_reach_criteria_custom_rich_media_events_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().custom_rich_media_events.is_none() { - request.reach_criteria.as_mut().unwrap().custom_rich_media_events = Some(Default::default()); - } - } - - fn request_reach_criteria_date_range_init(request: &mut api::Report) { - request_reach_criteria_init(request); - if request.reach_criteria.as_mut().unwrap().date_range.is_none() { - request.reach_criteria.as_mut().unwrap().date_range = Some(Default::default()); - } - } - - fn request_reach_criteria_init(request: &mut api::Report) { - if request.reach_criteria.is_none() { - request.reach_criteria = Some(Default::default()); - } - } - - fn request_schedule_init(request: &mut api::Report) { - if request.schedule.is_none() { - request.schedule = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "criteria.activities.kind" => { - request_criteria_activities_init(&mut request); - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.activities.metric-names" => { - request_criteria_activities_init(&mut request); - if request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "criteria.date-range.start-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.kind" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.end-date" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "criteria.date-range.relative-date-range" => { - request_criteria_date_range_init(&mut request); - request.criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "criteria.custom-rich-media-events.kind" => { - request_criteria_custom_rich_media_events_init(&mut request); - request.criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "criteria.metric-names" => { - request_criteria_custom_rich_media_events_init(&mut request); - if request.criteria.as_mut().unwrap().metric_names.is_none() { - request.criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_criteria_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "sub-account-id" => { - request_criteria_init(&mut request); - request.sub_account_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request_criteria_init(&mut request); - request.name = Some(value.unwrap_or("").to_string()); - }, - "schedule.start-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.runs-on-day-of-month" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().runs_on_day_of_month = Some(value.unwrap_or("").to_string()); - }, - "schedule.every" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().every = Some(arg_from_str(value.unwrap_or("-0"), err, "schedule.every", "integer")); - }, - "schedule.expiration-date" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().expiration_date = Some(value.unwrap_or("").to_string()); - }, - "schedule.active" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().active = Some(arg_from_str(value.unwrap_or("false"), err, "schedule.active", "boolean")); - }, - "schedule.repeats" => { - request_schedule_init(&mut request); - request.schedule.as_mut().unwrap().repeats = Some(value.unwrap_or("").to_string()); - }, - "schedule.repeats-on-week-days" => { - request_schedule_init(&mut request); - if request.schedule.as_mut().unwrap().repeats_on_week_days.is_none() { - request.schedule.as_mut().unwrap().repeats_on_week_days = Some(Default::default()); - } - request.schedule.as_mut().unwrap().repeats_on_week_days.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.start-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.kind" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.end-date" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.date-range.relative-date-range" => { - request_path_to_conversion_criteria_date_range_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.kind" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.value" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.dimension-name" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.etag" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.match-type" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.floodlight-config-id.id" => { - request_path_to_conversion_criteria_floodlight_config_id_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "path-to-conversion-criteria.report-properties.clicks-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().clicks_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.clicks-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.pivot-on-interaction-path" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().pivot_on_interaction_path = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.pivot-on-interaction-path", "boolean")); - }, - "path-to-conversion-criteria.report-properties.impressions-lookback-window" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().impressions_lookback_window = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.impressions-lookback-window", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-interaction-gap" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_interaction_gap = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-interaction-gap", "integer")); - }, - "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "path-to-conversion-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "path-to-conversion-criteria.report-properties.maximum-click-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_click_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-click-interactions", "integer")); - }, - "path-to-conversion-criteria.report-properties.maximum-impression-interactions" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - request.path_to_conversion_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().maximum_impression_interactions = Some(arg_from_str(value.unwrap_or("-0"), err, "path-to-conversion-criteria.report-properties.maximum-impression-interactions", "integer")); - }, - "path-to-conversion-criteria.metric-names" => { - request_path_to_conversion_criteria_report_properties_init(&mut request); - if request.path_to_conversion_criteria.as_mut().unwrap().metric_names.is_none() { - request.path_to_conversion_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.path_to_conversion_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "format" => { - request_path_to_conversion_criteria_init(&mut request); - request.format = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.kind" => { - request_reach_criteria_activities_init(&mut request); - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.activities.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().activities.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.metric-names" => { - request_reach_criteria_activities_init(&mut request); - if request.reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.start-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.kind" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.end-date" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.date-range.relative-date-range" => { - request_reach_criteria_date_range_init(&mut request); - request.reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.reach-by-frequency-metric-names" => { - request_reach_criteria_date_range_init(&mut request); - if request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.is_none() { - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names = Some(Default::default()); - } - request.reach_criteria.as_mut().unwrap().reach_by_frequency_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "reach-criteria.custom-rich-media-events.kind" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().custom_rich_media_events.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "reach-criteria.enable-all-dimension-combinations" => { - request_reach_criteria_custom_rich_media_events_init(&mut request); - request.reach_criteria.as_mut().unwrap().enable_all_dimension_combinations = Some(arg_from_str(value.unwrap_or("false"), err, "reach-criteria.enable-all-dimension-combinations", "boolean")); - }, - "file-name" => { - request_reach_criteria_init(&mut request); - request.file_name = Some(value.unwrap_or("").to_string()); - }, - "delivery.message" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().message = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner-delivery-type" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner_delivery_type = Some(value.unwrap_or("").to_string()); - }, - "delivery.email-owner" => { - request_delivery_init(&mut request); - request.delivery.as_mut().unwrap().email_owner = Some(arg_from_str(value.unwrap_or("false"), err, "delivery.email-owner", "boolean")); - }, - "etag" => { - request_delivery_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "owner-profile-id" => { - request_delivery_init(&mut request); - request.owner_profile_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_delivery_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "last-modified-time" => { - request_delivery_init(&mut request); - request.last_modified_time = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_delivery_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - "type" => { - request_delivery_init(&mut request); - request.type_ = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.start-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.kind" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.end-date" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.date-range.relative-date-range" => { - request_floodlight_criteria_date_range_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.kind" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.value" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.dimension-name" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.etag" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.match-type" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.floodlight-config-id.id" => { - request_floodlight_criteria_floodlight_config_id_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().floodlight_config_id.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "floodlight-criteria.report-properties.include-unattributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-unattributed-cookie-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_unattributed_cookie_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-unattributed-cookie-conversions", "boolean")); - }, - "floodlight-criteria.report-properties.include-attributed-ip-conversions" => { - request_floodlight_criteria_report_properties_init(&mut request); - request.floodlight_criteria.as_mut().unwrap().report_properties.as_mut().unwrap().include_attributed_ip_conversions = Some(arg_from_str(value.unwrap_or("false"), err, "floodlight-criteria.report-properties.include-attributed-ip-conversions", "boolean")); - }, - "floodlight-criteria.metric-names" => { - request_floodlight_criteria_report_properties_init(&mut request); - if request.floodlight_criteria.as_mut().unwrap().metric_names.is_none() { - request.floodlight_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.floodlight_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.pivoted" => { - request_cross_dimension_reach_criteria_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().pivoted = Some(arg_from_str(value.unwrap_or("false"), err, "cross-dimension-reach-criteria.pivoted", "boolean")); - }, - "cross-dimension-reach-criteria.date-range.start-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().start_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.kind" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.end-date" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().end_date = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.date-range.relative-date-range" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().date_range.as_mut().unwrap().relative_date_range = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.dimension" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - request.cross_dimension_reach_criteria.as_mut().unwrap().dimension = Some(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.overlap-metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().overlap_metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "cross-dimension-reach-criteria.metric-names" => { - request_cross_dimension_reach_criteria_date_range_init(&mut request); - if request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.is_none() { - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names = Some(Default::default()); - } - request.cross_dimension_reach_criteria.as_mut().unwrap().metric_names.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.reports().update(request, &self.opt.arg_profile_id, &self.opt.arg_report_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sites_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.sites().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sites_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Site::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_directory_site_id_dimension_value_init(request: &mut api::Site) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Site) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_site_settings_creative_settings_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().creative_settings.is_none() { - request.site_settings.as_mut().unwrap().creative_settings = Some(Default::default()); - } - } - - fn request_site_settings_init(request: &mut api::Site) { - if request.site_settings.is_none() { - request.site_settings = Some(Default::default()); - } - } - - fn request_site_settings_lookback_configuration_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().lookback_configuration.is_none() { - request.site_settings.as_mut().unwrap().lookback_configuration = Some(Default::default()); - } - } - - fn request_site_settings_tag_setting_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().tag_setting.is_none() { - request.site_settings.as_mut().unwrap().tag_setting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "site-settings.disable-brand-safe-ads" => { - request_site_settings_init(&mut request); - request.site_settings.as_mut().unwrap().disable_brand_safe_ads = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.disable-brand-safe-ads", "boolean")); - }, - "site-settings.active-view-opt-out" => { - request_site_settings_init(&mut request); - request.site_settings.as_mut().unwrap().active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.active-view-opt-out", "boolean")); - }, - "site-settings.lookback-configuration.click-duration" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "site-settings.lookback-configuration.click-duration", "integer")); - }, - "site-settings.lookback-configuration.post-impression-activities-duration" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "site-settings.lookback-configuration.post-impression-activities-duration", "integer")); - }, - "site-settings.disable-new-cookie" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().disable_new_cookie = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.disable-new-cookie", "boolean")); - }, - "site-settings.tag-setting.include-click-through-urls" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().include_click_through_urls = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.tag-setting.include-click-through-urls", "boolean")); - }, - "site-settings.tag-setting.include-click-tracking" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().include_click_tracking = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.tag-setting.include-click-tracking", "boolean")); - }, - "site-settings.tag-setting.additional-key-values" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().additional_key_values = Some(value.unwrap_or("").to_string()); - }, - "site-settings.tag-setting.keyword-option" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().keyword_option = Some(value.unwrap_or("").to_string()); - }, - "site-settings.creative-settings.i-frame-header" => { - request_site_settings_creative_settings_init(&mut request); - request.site_settings.as_mut().unwrap().creative_settings.as_mut().unwrap().i_frame_header = Some(value.unwrap_or("").to_string()); - }, - "site-settings.creative-settings.i-frame-footer" => { - request_site_settings_creative_settings_init(&mut request); - request.site_settings.as_mut().unwrap().creative_settings.as_mut().unwrap().i_frame_footer = Some(value.unwrap_or("").to_string()); - }, - "approved" => { - request_site_settings_init(&mut request); - request.approved = Some(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "key-name" => { - request_id_dimension_value_init(&mut request); - request.key_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.sites().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sites_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.sites().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "unmapped-site" => { - call = call.unmapped_site(arg_from_str(value.unwrap_or("false"), err, "unmapped-site", "boolean")); - }, - "subaccount-id" => { - call = call.subaccount_id(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "directory-site-ids" => { - call = call.add_directory_site_ids(value.unwrap_or("")); - }, - "campaign-ids" => { - call = call.add_campaign_ids(value.unwrap_or("")); - }, - "approved" => { - call = call.approved(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); - }, - "ad-words-site" => { - call = call.ad_words_site(arg_from_str(value.unwrap_or("false"), err, "ad-words-site", "boolean")); - }, - "accepts-publisher-paid-placements" => { - call = call.accepts_publisher_paid_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-publisher-paid-placements", "boolean")); - }, - "accepts-interstitial-placements" => { - call = call.accepts_interstitial_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-interstitial-placements", "boolean")); - }, - "accepts-in-stream-video-placements" => { - call = call.accepts_in_stream_video_placements(arg_from_str(value.unwrap_or("false"), err, "accepts-in-stream-video-placements", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sites_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Site::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_directory_site_id_dimension_value_init(request: &mut api::Site) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Site) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_site_settings_creative_settings_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().creative_settings.is_none() { - request.site_settings.as_mut().unwrap().creative_settings = Some(Default::default()); - } - } - - fn request_site_settings_init(request: &mut api::Site) { - if request.site_settings.is_none() { - request.site_settings = Some(Default::default()); - } - } - - fn request_site_settings_lookback_configuration_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().lookback_configuration.is_none() { - request.site_settings.as_mut().unwrap().lookback_configuration = Some(Default::default()); - } - } - - fn request_site_settings_tag_setting_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().tag_setting.is_none() { - request.site_settings.as_mut().unwrap().tag_setting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "site-settings.disable-brand-safe-ads" => { - request_site_settings_init(&mut request); - request.site_settings.as_mut().unwrap().disable_brand_safe_ads = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.disable-brand-safe-ads", "boolean")); - }, - "site-settings.active-view-opt-out" => { - request_site_settings_init(&mut request); - request.site_settings.as_mut().unwrap().active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.active-view-opt-out", "boolean")); - }, - "site-settings.lookback-configuration.click-duration" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "site-settings.lookback-configuration.click-duration", "integer")); - }, - "site-settings.lookback-configuration.post-impression-activities-duration" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "site-settings.lookback-configuration.post-impression-activities-duration", "integer")); - }, - "site-settings.disable-new-cookie" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().disable_new_cookie = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.disable-new-cookie", "boolean")); - }, - "site-settings.tag-setting.include-click-through-urls" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().include_click_through_urls = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.tag-setting.include-click-through-urls", "boolean")); - }, - "site-settings.tag-setting.include-click-tracking" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().include_click_tracking = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.tag-setting.include-click-tracking", "boolean")); - }, - "site-settings.tag-setting.additional-key-values" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().additional_key_values = Some(value.unwrap_or("").to_string()); - }, - "site-settings.tag-setting.keyword-option" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().keyword_option = Some(value.unwrap_or("").to_string()); - }, - "site-settings.creative-settings.i-frame-header" => { - request_site_settings_creative_settings_init(&mut request); - request.site_settings.as_mut().unwrap().creative_settings.as_mut().unwrap().i_frame_header = Some(value.unwrap_or("").to_string()); - }, - "site-settings.creative-settings.i-frame-footer" => { - request_site_settings_creative_settings_init(&mut request); - request.site_settings.as_mut().unwrap().creative_settings.as_mut().unwrap().i_frame_footer = Some(value.unwrap_or("").to_string()); - }, - "approved" => { - request_site_settings_init(&mut request); - request.approved = Some(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "key-name" => { - request_id_dimension_value_init(&mut request); - request.key_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.sites().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sites_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Site::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_directory_site_id_dimension_value_init(request: &mut api::Site) { - if request.directory_site_id_dimension_value.is_none() { - request.directory_site_id_dimension_value = Some(Default::default()); - } - } - - fn request_id_dimension_value_init(request: &mut api::Site) { - if request.id_dimension_value.is_none() { - request.id_dimension_value = Some(Default::default()); - } - } - - fn request_site_settings_creative_settings_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().creative_settings.is_none() { - request.site_settings.as_mut().unwrap().creative_settings = Some(Default::default()); - } - } - - fn request_site_settings_init(request: &mut api::Site) { - if request.site_settings.is_none() { - request.site_settings = Some(Default::default()); - } - } - - fn request_site_settings_lookback_configuration_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().lookback_configuration.is_none() { - request.site_settings.as_mut().unwrap().lookback_configuration = Some(Default::default()); - } - } - - fn request_site_settings_tag_setting_init(request: &mut api::Site) { - request_site_settings_init(request); - if request.site_settings.as_mut().unwrap().tag_setting.is_none() { - request.site_settings.as_mut().unwrap().tag_setting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.kind" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.value" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.dimension-name" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.etag" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.match-type" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id-dimension-value.id" => { - request_directory_site_id_dimension_value_init(&mut request); - request.directory_site_id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "site-settings.disable-brand-safe-ads" => { - request_site_settings_init(&mut request); - request.site_settings.as_mut().unwrap().disable_brand_safe_ads = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.disable-brand-safe-ads", "boolean")); - }, - "site-settings.active-view-opt-out" => { - request_site_settings_init(&mut request); - request.site_settings.as_mut().unwrap().active_view_opt_out = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.active-view-opt-out", "boolean")); - }, - "site-settings.lookback-configuration.click-duration" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().lookback_configuration.as_mut().unwrap().click_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "site-settings.lookback-configuration.click-duration", "integer")); - }, - "site-settings.lookback-configuration.post-impression-activities-duration" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().lookback_configuration.as_mut().unwrap().post_impression_activities_duration = Some(arg_from_str(value.unwrap_or("-0"), err, "site-settings.lookback-configuration.post-impression-activities-duration", "integer")); - }, - "site-settings.disable-new-cookie" => { - request_site_settings_lookback_configuration_init(&mut request); - request.site_settings.as_mut().unwrap().disable_new_cookie = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.disable-new-cookie", "boolean")); - }, - "site-settings.tag-setting.include-click-through-urls" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().include_click_through_urls = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.tag-setting.include-click-through-urls", "boolean")); - }, - "site-settings.tag-setting.include-click-tracking" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().include_click_tracking = Some(arg_from_str(value.unwrap_or("false"), err, "site-settings.tag-setting.include-click-tracking", "boolean")); - }, - "site-settings.tag-setting.additional-key-values" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().additional_key_values = Some(value.unwrap_or("").to_string()); - }, - "site-settings.tag-setting.keyword-option" => { - request_site_settings_tag_setting_init(&mut request); - request.site_settings.as_mut().unwrap().tag_setting.as_mut().unwrap().keyword_option = Some(value.unwrap_or("").to_string()); - }, - "site-settings.creative-settings.i-frame-header" => { - request_site_settings_creative_settings_init(&mut request); - request.site_settings.as_mut().unwrap().creative_settings.as_mut().unwrap().i_frame_header = Some(value.unwrap_or("").to_string()); - }, - "site-settings.creative-settings.i-frame-footer" => { - request_site_settings_creative_settings_init(&mut request); - request.site_settings.as_mut().unwrap().creative_settings.as_mut().unwrap().i_frame_footer = Some(value.unwrap_or("").to_string()); - }, - "approved" => { - request_site_settings_init(&mut request); - request.approved = Some(arg_from_str(value.unwrap_or("false"), err, "approved", "boolean")); - }, - "id-dimension-value.kind" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.value" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.dimension-name" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().dimension_name = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.etag" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.match-type" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().match_type = Some(value.unwrap_or("").to_string()); - }, - "id-dimension-value.id" => { - request_id_dimension_value_init(&mut request); - request.id_dimension_value.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "key-name" => { - request_id_dimension_value_init(&mut request); - request.key_name = Some(value.unwrap_or("").to_string()); - }, - "directory-site-id" => { - request_id_dimension_value_init(&mut request); - request.directory_site_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_id_dimension_value_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request_id_dimension_value_init(&mut request); - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.sites().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sizes_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.sizes().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sizes_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Size::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "width" => { - request.width = Some(arg_from_str(value.unwrap_or("-0"), err, "width", "integer")); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "iab" => { - request.iab = Some(arg_from_str(value.unwrap_or("false"), err, "iab", "boolean")); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "height" => { - request.height = Some(arg_from_str(value.unwrap_or("-0"), err, "height", "integer")); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.sizes().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _sizes_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.sizes().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "width" => { - call = call.width(arg_from_str(value.unwrap_or("-0"), err, "width", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "iab-standard" => { - call = call.iab_standard(arg_from_str(value.unwrap_or("false"), err, "iab-standard", "boolean")); - }, - "height" => { - call = call.height(arg_from_str(value.unwrap_or("-0"), err, "height", "integer")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subaccounts_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.subaccounts().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subaccounts_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Subaccount::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "available-permission-ids" => { - if request.available_permission_ids.is_none() { - request.available_permission_ids = Some(Default::default()); - } - request.available_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.subaccounts().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subaccounts_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.subaccounts().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subaccounts_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Subaccount::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "available-permission-ids" => { - if request.available_permission_ids.is_none() { - request.available_permission_ids = Some(Default::default()); - } - request.available_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.subaccounts().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subaccounts_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Subaccount::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "available-permission-ids" => { - if request.available_permission_ids.is_none() { - request.available_permission_ids = Some(Default::default()); - } - request.available_permission_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.subaccounts().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _targetable_remarketing_lists_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.targetable_remarketing_lists().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _targetable_remarketing_lists_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.targetable_remarketing_lists().list(&self.opt.arg_profile_id, &self.opt.arg_advertiser_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "name" => { - call = call.name(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "active" => { - call = call.active(arg_from_str(value.unwrap_or("false"), err, "active", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_profiles_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_profiles().get(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_profiles_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_profiles().list(); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_role_permission_groups_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_role_permission_groups().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_role_permission_groups_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_role_permission_groups().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_role_permissions_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_role_permissions().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_role_permissions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_role_permissions().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_roles_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_roles().delete(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _user_roles_get(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_roles().get(&self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_roles_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::UserRole::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "default-user-role" => { - request.default_user_role = Some(arg_from_str(value.unwrap_or("false"), err, "default-user-role", "boolean")); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "parent-user-role-id" => { - request.parent_user_role_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.user_roles().insert(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_roles_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.user_roles().list(&self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "subaccount-id" => { - call = call.subaccount_id(value.unwrap_or("")); - }, - "sort-order" => { - call = call.sort_order(value.unwrap_or("")); - }, - "sort-field" => { - call = call.sort_field(value.unwrap_or("")); - }, - "search-string" => { - call = call.search_string(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "ids" => { - call = call.add_ids(value.unwrap_or("")); - }, - "account-user-role-only" => { - call = call.account_user_role_only(arg_from_str(value.unwrap_or("false"), err, "account-user-role-only", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_roles_patch(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::UserRole::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "default-user-role" => { - request.default_user_role = Some(arg_from_str(value.unwrap_or("false"), err, "default-user-role", "boolean")); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "parent-user-role-id" => { - request.parent_user_role_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.user_roles().patch(request, &self.opt.arg_profile_id, &self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _user_roles_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::UserRole::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "default-user-role" => { - request.default_user_role = Some(arg_from_str(value.unwrap_or("false"), err, "default-user-role", "boolean")); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "subaccount-id" => { - request.subaccount_id = Some(value.unwrap_or("").to_string()); - }, - "name" => { - request.name = Some(value.unwrap_or("").to_string()); - }, - "parent-user-role-id" => { - request.parent_user_role_id = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request.id = Some(value.unwrap_or("").to_string()); - }, - "account-id" => { - request.account_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.user_roles().update(request, &self.opt.arg_profile_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _doit(&self, dry_run: bool) -> (Option, Option) { - let mut err = InvalidOptionsError::new(); - let mut call_result: Option; - let mut err_opt: Option = None; - - if self.opt.cmd_account_active_ad_summaries { - if self.opt.cmd_get { - call_result = self._account_active_ad_summaries_get(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_account_permission_groups { - if self.opt.cmd_get { - call_result = self._account_permission_groups_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._account_permission_groups_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_account_permissions { - if self.opt.cmd_get { - call_result = self._account_permissions_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._account_permissions_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_account_user_profiles { - if self.opt.cmd_get { - call_result = self._account_user_profiles_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._account_user_profiles_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._account_user_profiles_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._account_user_profiles_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._account_user_profiles_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_accounts { - if self.opt.cmd_get { - call_result = self._accounts_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._accounts_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._accounts_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._accounts_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_ads { - if self.opt.cmd_get { - call_result = self._ads_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._ads_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._ads_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._ads_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._ads_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_advertiser_groups { - if self.opt.cmd_delete { - call_result = self._advertiser_groups_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._advertiser_groups_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._advertiser_groups_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._advertiser_groups_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._advertiser_groups_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._advertiser_groups_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_advertisers { - if self.opt.cmd_get { - call_result = self._advertisers_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._advertisers_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._advertisers_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._advertisers_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._advertisers_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_browsers { - if self.opt.cmd_list { - call_result = self._browsers_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_campaign_creative_associations { - if self.opt.cmd_insert { - call_result = self._campaign_creative_associations_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._campaign_creative_associations_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_campaigns { - if self.opt.cmd_get { - call_result = self._campaigns_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._campaigns_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._campaigns_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._campaigns_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._campaigns_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_change_logs { - if self.opt.cmd_get { - call_result = self._change_logs_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._change_logs_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_cities { - if self.opt.cmd_list { - call_result = self._cities_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_connection_types { - if self.opt.cmd_get { - call_result = self._connection_types_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._connection_types_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_content_categories { - if self.opt.cmd_delete { - call_result = self._content_categories_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._content_categories_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._content_categories_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._content_categories_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._content_categories_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._content_categories_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_countries { - if self.opt.cmd_get { - call_result = self._countries_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._countries_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_creative_assets { - if self.opt.cmd_insert { - call_result = self._creative_assets_insert(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_creative_field_values { - if self.opt.cmd_delete { - call_result = self._creative_field_values_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._creative_field_values_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._creative_field_values_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._creative_field_values_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._creative_field_values_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._creative_field_values_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_creative_fields { - if self.opt.cmd_delete { - call_result = self._creative_fields_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._creative_fields_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._creative_fields_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._creative_fields_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._creative_fields_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._creative_fields_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_creative_groups { - if self.opt.cmd_get { - call_result = self._creative_groups_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._creative_groups_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._creative_groups_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._creative_groups_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._creative_groups_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_creatives { - if self.opt.cmd_get { - call_result = self._creatives_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._creatives_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._creatives_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._creatives_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._creatives_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_dimension_values { - if self.opt.cmd_query { - call_result = self._dimension_values_query(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_directory_site_contacts { - if self.opt.cmd_get { - call_result = self._directory_site_contacts_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._directory_site_contacts_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_directory_sites { - if self.opt.cmd_get { - call_result = self._directory_sites_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._directory_sites_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._directory_sites_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_event_tags { - if self.opt.cmd_delete { - call_result = self._event_tags_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._event_tags_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._event_tags_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._event_tags_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._event_tags_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._event_tags_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_files { - if self.opt.cmd_get { - call_result = self._files_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._files_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_floodlight_activities { - if self.opt.cmd_delete { - call_result = self._floodlight_activities_delete(dry_run, &mut err); - } else if self.opt.cmd_generatetag { - call_result = self._floodlight_activities_generatetag(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._floodlight_activities_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._floodlight_activities_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._floodlight_activities_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._floodlight_activities_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._floodlight_activities_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_floodlight_activity_groups { - if self.opt.cmd_delete { - call_result = self._floodlight_activity_groups_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._floodlight_activity_groups_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._floodlight_activity_groups_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._floodlight_activity_groups_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._floodlight_activity_groups_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._floodlight_activity_groups_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_floodlight_configurations { - if self.opt.cmd_get { - call_result = self._floodlight_configurations_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._floodlight_configurations_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._floodlight_configurations_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._floodlight_configurations_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_inventory_items { - if self.opt.cmd_get { - call_result = self._inventory_items_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._inventory_items_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_landing_pages { - if self.opt.cmd_delete { - call_result = self._landing_pages_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._landing_pages_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._landing_pages_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._landing_pages_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._landing_pages_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._landing_pages_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_metros { - if self.opt.cmd_list { - call_result = self._metros_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_mobile_carriers { - if self.opt.cmd_get { - call_result = self._mobile_carriers_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._mobile_carriers_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_operating_system_versions { - if self.opt.cmd_get { - call_result = self._operating_system_versions_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._operating_system_versions_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_operating_systems { - if self.opt.cmd_get { - call_result = self._operating_systems_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._operating_systems_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_order_documents { - if self.opt.cmd_get { - call_result = self._order_documents_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._order_documents_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_orders { - if self.opt.cmd_get { - call_result = self._orders_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._orders_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_placement_groups { - if self.opt.cmd_get { - call_result = self._placement_groups_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._placement_groups_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._placement_groups_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._placement_groups_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._placement_groups_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_placement_strategies { - if self.opt.cmd_delete { - call_result = self._placement_strategies_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._placement_strategies_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._placement_strategies_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._placement_strategies_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._placement_strategies_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._placement_strategies_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_placements { - if self.opt.cmd_generatetags { - call_result = self._placements_generatetags(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._placements_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._placements_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._placements_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._placements_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._placements_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_platform_types { - if self.opt.cmd_get { - call_result = self._platform_types_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._platform_types_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_postal_codes { - if self.opt.cmd_get { - call_result = self._postal_codes_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._postal_codes_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_projects { - if self.opt.cmd_get { - call_result = self._projects_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._projects_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_regions { - if self.opt.cmd_list { - call_result = self._regions_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_remarketing_list_shares { - if self.opt.cmd_get { - call_result = self._remarketing_list_shares_get(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._remarketing_list_shares_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._remarketing_list_shares_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_remarketing_lists { - if self.opt.cmd_get { - call_result = self._remarketing_lists_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._remarketing_lists_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._remarketing_lists_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._remarketing_lists_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._remarketing_lists_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_reports { - if self.opt.cmd_compatible_fields_query { - call_result = self._reports_compatible_fields_query(dry_run, &mut err); - } else if self.opt.cmd_delete { - call_result = self._reports_delete(dry_run, &mut err); - } else if self.opt.cmd_files_get { - call_result = self._reports_files_get(dry_run, &mut err); - } else if self.opt.cmd_files_list { - call_result = self._reports_files_list(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._reports_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._reports_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._reports_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._reports_patch(dry_run, &mut err); - } else if self.opt.cmd_run { - call_result = self._reports_run(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._reports_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_sites { - if self.opt.cmd_get { - call_result = self._sites_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._sites_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._sites_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._sites_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._sites_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_sizes { - if self.opt.cmd_get { - call_result = self._sizes_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._sizes_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._sizes_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_subaccounts { - if self.opt.cmd_get { - call_result = self._subaccounts_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._subaccounts_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._subaccounts_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._subaccounts_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._subaccounts_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_targetable_remarketing_lists { - if self.opt.cmd_get { - call_result = self._targetable_remarketing_lists_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._targetable_remarketing_lists_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_user_profiles { - if self.opt.cmd_get { - call_result = self._user_profiles_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._user_profiles_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_user_role_permission_groups { - if self.opt.cmd_get { - call_result = self._user_role_permission_groups_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._user_role_permission_groups_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_user_role_permissions { - if self.opt.cmd_get { - call_result = self._user_role_permissions_get(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._user_role_permissions_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_user_roles { - if self.opt.cmd_delete { - call_result = self._user_roles_delete(dry_run, &mut err); - } else if self.opt.cmd_get { - call_result = self._user_roles_get(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._user_roles_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._user_roles_list(dry_run, &mut err); - } else if self.opt.cmd_patch { - call_result = self._user_roles_patch(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._user_roles_update(dry_run, &mut err); - } else { - unreachable!(); - } - } else { - unreachable!(); - } - - if dry_run { - if err.issues.len() > 0 { - err_opt = Some(err); - } - } - (call_result, err_opt) - } - - // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: Options) -> Result { - let (config_dir, secret) = { - let config_dir = match cmn::assure_config_dir_exists(&opt.flag_config_dir) { - Err(e) => return Err(InvalidOptionsError::single(e, 3)), - Ok(p) => p, - }; - - match cmn::application_secret_from_directory(&config_dir, "dfareporting2d1-secret.json", - "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { - Ok(secret) => (config_dir, secret), - Err(e) => return Err(InvalidOptionsError::single(e, 4)) - } - }; - - let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, - if opt.flag_debug_auth { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }, - JsonTokenStorage { - program_name: "dfareporting2d1", - db_dir: config_dir.clone(), - }, None); - - let client = - if opt.flag_debug { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }; - let engine = Engine { - opt: opt, - hub: api::Dfareporting::new(client, auth), - }; - - match engine._doit(true) { - (_, Some(err)) => Err(err), - _ => Ok(engine), - } - } - - // Execute the call with all the bells and whistles, informing the caller only if there was an error. - // The absense of one indicates success. - fn doit(&self) -> Option { - self._doit(false).0 - } -} fn main() { - let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit()); - let debug = opts.flag_debug; - match Engine::new(opts) { - Err(err) => { - writeln!(io::stderr(), "{}", err).ok(); - env::set_exit_status(err.exit_code); - }, - Ok(engine) => { - if let Some(err) = engine.doit() { - if debug { - writeln!(io::stderr(), "{:?}", err).ok(); - } else { - writeln!(io::stderr(), "{}", err).ok(); - } - env::set_exit_status(1); - } - } - } + use cmn::UploadProtocol; + + let mut app = App::new("dfareporting2d1") + .author("Sebastian Thiel ") + .version("0.2.0") + .about("Manage your DoubleClick Campaign Manager ad campaigns and reports.") + .after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_dfareporting2d1_cli") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ${CONFIG_DIR}]") + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .takes_value(false)); + let arg_data = [ + ("account-active-ad-summaries", vec![ + ("get", Some("Gets the account's active ad summary by account ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("summary-account-id"), + None, + Some("Account ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("account-permission-groups", vec![ + ("get", Some("Gets one account permission group by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Account permission group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves the list of account permission groups."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("account-permissions", vec![ + ("get", Some("Gets one account permission by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Account permission ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves the list of account permissions."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("account-user-profiles", vec![ + ("get", Some("Gets one account user profile by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User profile ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new account user profile."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of account user profiles, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing account user profile. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User profile ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing account user profile."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("accounts", vec![ + ("get", Some("Gets one account by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Account ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves the list of accounts, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing account. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Account ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing account."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("ads", vec![ + ("get", Some("Gets one ad by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Ad ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new ad."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of ads, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing ad. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Ad ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing ad."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("advertiser-groups", vec![ + ("delete", Some("Deletes an existing advertiser group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Advertiser group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one advertiser group by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Advertiser group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new advertiser group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of advertiser groups, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing advertiser group. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Advertiser group ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing advertiser group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("advertisers", vec![ + ("get", Some("Gets one advertiser by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Advertiser ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new advertiser."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of advertisers, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing advertiser. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Advertiser ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing advertiser."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("browsers", vec![ + ("list", Some("Retrieves a list of browsers."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("campaign-creative-associations", vec![ + ("insert", Some("Associates a creative with the specified campaign. This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Campaign ID in this association."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves the list of creative IDs associated with the specified campaign."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Campaign ID in this association."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("campaigns", vec![ + ("get", Some("Gets one campaign by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Campaign ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new campaign."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("default-landing-page-name"), + None, + Some("Default landing page name for this new campaign. Must be less than 256 characters long."), + Some(true), + Some(false), + None), + + (Some("default-landing-page-url"), + None, + Some("Default landing page URL for this new campaign."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of campaigns, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing campaign. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Campaign ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing campaign."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("change-logs", vec![ + ("get", Some("Gets one change log by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Change log ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of change logs."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("cities", vec![ + ("list", Some("Retrieves a list of cities, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("connection-types", vec![ + ("get", Some("Gets one connection type by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Connection type ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of connection types."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("content-categories", vec![ + ("delete", Some("Deletes an existing content category."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Content category ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one content category by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Content category ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new content category."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of content categories, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing content category. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Content category ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing content category."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("countries", vec![ + ("get", Some("Gets one country by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("dart-id"), + None, + Some("Country DART ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of countries."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("creative-assets", vec![ + ("insert", Some("Inserts a new creative asset."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("advertiser-id"), + None, + Some("Advertiser ID of this creative. This is a required field."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("mode"), + Some("u"), + Some("Specify which file to upload"), + Some(false), + Some(false), + Some(vec!["simple","resumable"])), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("creative-field-values", vec![ + ("delete", Some("Deletes an existing creative field value."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("creative-field-id"), + None, + Some("Creative field ID for this creative field value."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative Field Value ID"), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one creative field value by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("creative-field-id"), + None, + Some("Creative field ID for this creative field value."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative Field Value ID"), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new creative field value."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("creative-field-id"), + None, + Some("Creative field ID for this creative field value."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of creative field values, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("creative-field-id"), + None, + Some("Creative field ID for this creative field value."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing creative field value. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("creative-field-id"), + None, + Some("Creative field ID for this creative field value."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative Field Value ID"), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing creative field value."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("creative-field-id"), + None, + Some("Creative field ID for this creative field value."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("creative-fields", vec![ + ("delete", Some("Deletes an existing creative field."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative Field ID"), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one creative field by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative Field ID"), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new creative field."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of creative fields, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing creative field. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative Field ID"), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing creative field."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("creative-groups", vec![ + ("get", Some("Gets one creative group by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new creative group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of creative groups, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing creative group. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative group ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing creative group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("creatives", vec![ + ("get", Some("Gets one creative by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new creative."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of creatives, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing creative. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Creative ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing creative."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("dimension-values", vec![ + ("query", Some("Retrieves list of report dimension values for a list of filters."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("directory-site-contacts", vec![ + ("get", Some("Gets one directory site contact by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Directory site contact ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of directory site contacts, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("directory-sites", vec![ + ("get", Some("Gets one directory site by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Directory site ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new directory site."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of directory sites, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("event-tags", vec![ + ("delete", Some("Deletes an existing event tag."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Event tag ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one event tag by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Event tag ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new event tag."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of event tags, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing event tag. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Event tag ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing event tag."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("files", vec![ + ("get", Some("Retrieves a report file by its report ID and file ID."), + vec![ + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("file-id"), + None, + Some("The ID of the report file."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Lists files for a user profile."), + vec![ + (Some("profile-id"), + None, + Some("The DFA profile ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("floodlight-activities", vec![ + ("delete", Some("Deletes an existing floodlight activity."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight activity ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("generatetag", Some("Generates a tag for a floodlight activity."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("get", Some("Gets one floodlight activity by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight activity ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new floodlight activity."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of floodlight activities, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing floodlight activity. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight activity ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing floodlight activity."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("floodlight-activity-groups", vec![ + ("delete", Some("Deletes an existing floodlight activity group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight activity Group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one floodlight activity group by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight activity Group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new floodlight activity group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of floodlight activity groups, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing floodlight activity group. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight activity Group ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing floodlight activity group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("floodlight-configurations", vec![ + ("get", Some("Gets one floodlight configuration by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight configuration ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of floodlight configurations, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing floodlight configuration. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Floodlight configuration ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing floodlight configuration."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("inventory-items", vec![ + ("get", Some("Gets one inventory item by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("project-id"), + None, + Some("Project ID for order documents."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Inventory item ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of inventory items, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("project-id"), + None, + Some("Project ID for order documents."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("landing-pages", vec![ + ("delete", Some("Deletes an existing campaign landing page."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Landing page campaign ID."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Landing page ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one campaign landing page by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Landing page campaign ID."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Landing page ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new landing page for the specified campaign."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Landing page campaign ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves the list of landing pages for the specified campaign."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Landing page campaign ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing campaign landing page. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Landing page campaign ID."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Landing page ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing campaign landing page."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("campaign-id"), + None, + Some("Landing page campaign ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("metros", vec![ + ("list", Some("Retrieves a list of metros."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("mobile-carriers", vec![ + ("get", Some("Gets one mobile carrier by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Mobile carrier ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of mobile carriers."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("operating-system-versions", vec![ + ("get", Some("Gets one operating system version by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Operating system version ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of operating system versions."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("operating-systems", vec![ + ("get", Some("Gets one operating system by DART ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("dart-id"), + None, + Some("Operating system DART ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of operating systems."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("order-documents", vec![ + ("get", Some("Gets one order document by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("project-id"), + None, + Some("Project ID for order documents."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Order document ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of order documents, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("project-id"), + None, + Some("Project ID for order documents."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("orders", vec![ + ("get", Some("Gets one order by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("project-id"), + None, + Some("Project ID for orders."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Order ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of orders, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("project-id"), + None, + Some("Project ID for orders."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("placement-groups", vec![ + ("get", Some("Gets one placement group by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new placement group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of placement groups, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing placement group. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement group ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing placement group."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("placement-strategies", vec![ + ("delete", Some("Deletes an existing placement strategy."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement strategy ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one placement strategy by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement strategy ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new placement strategy."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of placement strategies, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing placement strategy. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement strategy ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing placement strategy."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("placements", vec![ + ("generatetags", Some("Generates tags for a placement."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("get", Some("Gets one placement by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new placement."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of placements, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing placement. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Placement ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing placement."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("platform-types", vec![ + ("get", Some("Gets one platform type by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Platform type ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of platform types."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("postal-codes", vec![ + ("get", Some("Gets one postal code by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("code"), + None, + Some("Postal code ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of postal codes."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("projects", vec![ + ("get", Some("Gets one project by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Project ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of projects, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("regions", vec![ + ("list", Some("Retrieves a list of regions."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("remarketing-list-shares", vec![ + ("get", Some("Gets one remarketing list share by remarketing list ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("remarketing-list-id"), + None, + Some("Remarketing list ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing remarketing list share. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("remarketing-list-id"), + None, + Some("Remarketing list ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing remarketing list share."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("remarketing-lists", vec![ + ("get", Some("Gets one remarketing list by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Remarketing list ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new remarketing list."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of remarketing lists, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("advertiser-id"), + None, + Some("Select only remarketing lists owned by this advertiser."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing remarketing list. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Remarketing list ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing remarketing list."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("reports", vec![ + ("compatible-fields-query", Some("Returns the fields that are compatible to be selected in the respective sections of a report criteria, given the fields already selected in the input report and user permissions."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("delete", Some("Deletes a report by its ID."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("files-get", Some("Retrieves a report file."), + vec![ + (Some("profile-id"), + None, + Some("The DFA profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("file-id"), + None, + Some("The ID of the report file."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("files-list", Some("Lists files for a report."), + vec![ + (Some("profile-id"), + None, + Some("The DFA profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the parent report."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("get", Some("Retrieves a report by its ID."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Creates a report."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves list of reports."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates a report. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("run", Some("Runs a report."), + vec![ + (Some("profile-id"), + None, + Some("The DFA profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates a report."), + vec![ + (Some("profile-id"), + None, + Some("The DFA user profile ID."), + Some(true), + Some(false), + None), + + (Some("report-id"), + None, + Some("The ID of the report."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("sites", vec![ + ("get", Some("Gets one site by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Site ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new site."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of sites, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing site. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Site ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing site."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("sizes", vec![ + ("get", Some("Gets one size by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Size ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new size."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of sizes, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("subaccounts", vec![ + ("get", Some("Gets one subaccount by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Subaccount ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new subaccount."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Gets a list of subaccounts, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing subaccount. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Subaccount ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing subaccount."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("targetable-remarketing-lists", vec![ + ("get", Some("Gets one remarketing list by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("Remarketing list ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of targetable remarketing lists, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("advertiser-id"), + None, + Some("Select only targetable remarketing lists targetable by these advertisers."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("user-profiles", vec![ + ("get", Some("Gets one user profile by ID."), + vec![ + (Some("profile-id"), + None, + Some("The user profile ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves list of user profiles for a user."), + vec![ + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("user-role-permission-groups", vec![ + ("get", Some("Gets one user role permission group by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User role permission group ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Gets a list of all supported user role permission groups."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("user-role-permissions", vec![ + ("get", Some("Gets one user role permission by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User role permission ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Gets a list of user role permissions, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ("user-roles", vec![ + ("delete", Some("Deletes an existing user role."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User role ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + ]), + ("get", Some("Gets one user role by ID."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User role ID."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("insert", Some("Inserts a new user role."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("list", Some("Retrieves a list of user roles, possibly filtered."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("patch", Some("Updates an existing user role. This method supports patch semantics."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("id"), + None, + Some("User role ID."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ("update", Some("Updates an existing user role."), + vec![ + (Some("profile-id"), + None, + Some("User profile ID associated with this request."), + Some(true), + Some(false), + None), + + (Some("kv"), + Some("r"), + Some("Set various fields of the request structure"), + Some(true), + Some(true), + None), + + (Some("v"), + Some("p"), + Some("Set various fields of the request structure"), + Some(false), + Some(true), + None), + + (Some("out"), + Some("o"), + Some("Specify the file into which to write the programs output"), + Some(false), + Some(false), + None), + ]), + ]), + + ]; + + for &(main_command_name, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::new(main_command_name); + for &(sub_command_name, ref desc, ref args) in subcommands { + let mut scmd = SubCommand::new(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + for &(ref arg_name, ref flag, ref desc, ref required, ref multi, ref protocols) in args { + let mut arg = Arg::with_name(match (arg_name, flag) { + (&Some(an), _) => an, + (_, &Some(f)) => f, + _ => unreachable!(), + }); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if let &Some(ref protocols) = protocols { + arg = arg.possible_values(protocols.clone()); + arg = arg.requires("file"); + arg = arg.requires("mime"); + + scmd = scmd.arg(Arg::with_name("file") + .short("f") + .required(false) + .help("The file to upload") + .takes_value(true)); + scmd = scmd.arg(Arg::with_name("mime") + .short("m") + .required(false) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); + } + let matches = app.get_matches(); + + } \ No newline at end of file diff --git a/gen/dfareporting2d1/README.md b/gen/dfareporting2d1/README.md index 5601ca3e941..1f8051cf955 100644 --- a/gen/dfareporting2d1/README.md +++ b/gen/dfareporting2d1/README.md @@ -288,7 +288,7 @@ These will always take a single argument, for which the following statements are * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](http://byron.github.io/google-apis-rs/google_dfareporting2d1/trait.RequestValue.html) are borrowed +* [request values](http://byron.github.io/google-apis-rs/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 e4cb861b7bf..b3fe3969149 100644 --- a/gen/dfareporting2d1/src/lib.rs +++ b/gen/dfareporting2d1/src/lib.rs @@ -289,7 +289,7 @@ //! //! * [PODs][wiki-pod] are handed by copy //! * strings are passed as `&str` -//! * [request values](trait.RequestValue.html) are borrowed +//! * [request values](trait.RequestValue.html) are moved //! //! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. //! @@ -13258,7 +13258,7 @@ impl<'a, C, A> UserRolePermissionGroupGetCall<'a, C, A> where C: BorrowMut UserRolePermissionGroupListCall<'a, C, A> where C: BorrowMut PlatformTypeGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13997,7 +13997,7 @@ impl<'a, C, A> PlatformTypeListCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14252,7 +14252,7 @@ impl<'a, C, A> CreativeFieldValuePatchCall<'a, C, A> where C: BorrowMut CreativeFieldValueGetCall<'a, C, A> where C: BorrowMut CreativeFieldValueDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldValueInsertCall<'a, C, A> where C: BorrowMut CreativeFieldValueUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldValueListCall<'a, C, A> where C: BorrowMut CreativeFieldUpdateCall<'a, C, A> where C: BorrowMut CreativeFieldListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16513,7 +16513,7 @@ impl<'a, C, A> CreativeFieldDeleteCall<'a, C, A> where C: BorrowMut CreativeFieldGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17015,7 +17015,7 @@ impl<'a, C, A> CreativeFieldInsertCall<'a, C, A> where C: BorrowMut CreativeFieldPatchCall<'a, C, A> where C: BorrowMut UserRoleInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17806,7 +17806,7 @@ impl<'a, C, A> UserRoleGetCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18067,7 +18067,7 @@ impl<'a, C, A> UserRoleUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18319,7 +18319,7 @@ impl<'a, C, A> UserRoleDeleteCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18572,7 +18572,7 @@ impl<'a, C, A> UserRolePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18877,7 +18877,7 @@ impl<'a, C, A> UserRoleListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19175,7 +19175,7 @@ impl<'a, C, A> OperatingSystemVersionGetCall<'a, C, A> where C: BorrowMut OperatingSystemVersionListCall<'a, C, A> where C: BorrowMut LandingPageGetCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19940,7 +19940,7 @@ impl<'a, C, A> LandingPageUpdateCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20203,7 +20203,7 @@ impl<'a, C, A> LandingPageListCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20466,7 +20466,7 @@ impl<'a, C, A> LandingPageInsertCall<'a, C, A> where C: BorrowMut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -20743,7 +20743,7 @@ impl<'a, C, A> LandingPagePatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21017,7 +21017,7 @@ impl<'a, C, A> LandingPageDeleteCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21322,7 +21322,7 @@ impl<'a, C, A> CreativeAssetInsertCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -21671,7 +21671,7 @@ impl<'a, C, A> CampaignCreativeAssociationInsertCall<'a, C, A> where C: BorrowMu request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -21949,7 +21949,7 @@ impl<'a, C, A> CampaignCreativeAssociationListCall<'a, C, A> where C: BorrowMut< access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22281,7 +22281,7 @@ impl<'a, C, A> ChangeLogListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22595,7 +22595,7 @@ impl<'a, C, A> ChangeLogGetCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22846,7 +22846,7 @@ impl<'a, C, A> RemarketingListShareGetCall<'a, C, A> where C: BorrowMut RemarketingListSharePatchCall<'a, C, A> where C: BorrowMut RemarketingListShareUpdateCall<'a, C, A> where C: BorrowMut ReportRunCall<'a, C, A> where C: BorrowMut, A: oau access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23910,7 +23910,7 @@ impl<'a, C, A> ReportPatchCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24193,7 +24193,7 @@ impl<'a, C, A> ReportFileListCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24482,7 +24482,7 @@ impl<'a, C, A> ReportInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -24747,7 +24747,7 @@ impl<'a, C, A> ReportUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -25020,7 +25020,7 @@ impl<'a, C, A> ReportCompatibleFieldQueryCall<'a, C, A> where C: BorrowMut ReportGetCall<'a, C, A> where C: BorrowMut, A: oau access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25547,7 +25547,7 @@ impl<'a, C, A> ReportFileGetCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -25807,7 +25807,7 @@ impl<'a, C, A> ReportDeleteCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26071,7 +26071,7 @@ impl<'a, C, A> ReportListCall<'a, C, A> where C: BorrowMut, A: oa access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -26357,7 +26357,7 @@ impl<'a, C, A> AdvertiserInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -26622,7 +26622,7 @@ impl<'a, C, A> AdvertiserPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -26955,7 +26955,7 @@ impl<'a, C, A> AdvertiserListCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27293,7 +27293,7 @@ impl<'a, C, A> AdvertiserUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -27546,7 +27546,7 @@ impl<'a, C, A> AdvertiserGetCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -27817,7 +27817,7 @@ impl<'a, C, A> DimensionValueQueryCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupGetCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupListCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityGroupUpdateCall<'a, C, A> where C: BorrowMut MetroListCall<'a, C, A> where C: BorrowMut, A: oau access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30010,7 +30010,7 @@ impl<'a, C, A> OrderListCall<'a, C, A> where C: BorrowMut, A: oau access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30314,7 +30314,7 @@ impl<'a, C, A> OrderGetCall<'a, C, A> where C: BorrowMut, A: oaut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -30575,7 +30575,7 @@ impl<'a, C, A> DirectorySiteContactGetCall<'a, C, A> where C: BorrowMut DirectorySiteContactListCall<'a, C, A> where C: BorrowMut UserProfileListCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31360,7 +31360,7 @@ impl<'a, C, A> UserProfileGetCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -31613,7 +31613,7 @@ impl<'a, C, A> AdPatchCall<'a, C, A> where C: BorrowMut, A: oauth request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -31886,7 +31886,7 @@ impl<'a, C, A> AdInsertCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -32297,7 +32297,7 @@ impl<'a, C, A> AdListCall<'a, C, A> where C: BorrowMut, A: oauth2 access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32716,7 +32716,7 @@ impl<'a, C, A> AdGetCall<'a, C, A> where C: BorrowMut, A: oauth2: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -32977,7 +32977,7 @@ impl<'a, C, A> AdUpdateCall<'a, C, A> where C: BorrowMut, A: oaut request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -33230,7 +33230,7 @@ impl<'a, C, A> AccountPermissionGetCall<'a, C, A> where C: BorrowMut AccountPermissionListCall<'a, C, A> where C: BorrowMut ConnectionTypeListCall<'a, C, A> where C: BorrowMut ConnectionTypeGetCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -34210,7 +34210,7 @@ impl<'a, C, A> AdvertiserGroupGetCall<'a, C, A> where C: BorrowMut AdvertiserGroupListCall<'a, C, A> where C: BorrowMut AdvertiserGroupInsertCall<'a, C, A> where C: BorrowMut AdvertiserGroupUpdateCall<'a, C, A> where C: BorrowMut AdvertiserGroupPatchCall<'a, C, A> where C: BorrowMut AdvertiserGroupDeleteCall<'a, C, A> where C: BorrowMut SiteInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -36081,7 +36081,7 @@ impl<'a, C, A> SiteGetCall<'a, C, A> where C: BorrowMut, A: oauth access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -36417,7 +36417,7 @@ impl<'a, C, A> SiteListCall<'a, C, A> where C: BorrowMut, A: oaut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -36776,7 +36776,7 @@ impl<'a, C, A> SiteUpdateCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -37041,7 +37041,7 @@ impl<'a, C, A> SitePatchCall<'a, C, A> where C: BorrowMut, A: oau request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -37304,7 +37304,7 @@ impl<'a, C, A> FloodlightActivityGetCall<'a, C, A> where C: BorrowMut FloodlightActivityListCall<'a, C, A> where C: BorrowMut FloodlightActivityInsertCall<'a, C, A> where C: BorrowMut FloodlightActivityDeleteCall<'a, C, A> where C: BorrowMut FloodlightActivityPatchCall<'a, C, A> where C: BorrowMut FloodlightActivityGeneratetagCall<'a, C, A> where C: BorrowMut FloodlightActivityUpdateCall<'a, C, A> where C: BorrowMut RegionListCall<'a, C, A> where C: BorrowMut, A: oa access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -39501,7 +39501,7 @@ impl<'a, C, A> CreativeGroupInsertCall<'a, C, A> where C: BorrowMut CreativeGroupGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -40015,7 +40015,7 @@ impl<'a, C, A> CreativeGroupUpdateCall<'a, C, A> where C: BorrowMut CreativeGroupListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -40625,7 +40625,7 @@ impl<'a, C, A> CreativeGroupPatchCall<'a, C, A> where C: BorrowMut TargetableRemarketingListListCall<'a, C, A> where C: BorrowMut TargetableRemarketingListGetCall<'a, C, A> where C: BorrowMut SubaccountPatchCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -41747,7 +41747,7 @@ impl<'a, C, A> SubaccountInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -42032,7 +42032,7 @@ impl<'a, C, A> SubaccountListCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42326,7 +42326,7 @@ impl<'a, C, A> SubaccountUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -42579,7 +42579,7 @@ impl<'a, C, A> SubaccountGetCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -42830,7 +42830,7 @@ impl<'a, C, A> MobileCarrierGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -43079,7 +43079,7 @@ impl<'a, C, A> MobileCarrierListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -43320,7 +43320,7 @@ impl<'a, C, A> FloodlightConfigurationGetCall<'a, C, A> where C: BorrowMut FloodlightConfigurationUpdateCall<'a, C, A> where C: BorrowMut FloodlightConfigurationPatchCall<'a, C, A> where C: BorrowMut FloodlightConfigurationListCall<'a, C, A> where C: BorrowMut OperatingSystemListCall<'a, C, A> where C: BorrowMut OperatingSystemGetCall<'a, C, A> where C: BorrowMut FileListCall<'a, C, A> where C: BorrowMut, A: oaut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45175,7 +45175,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut, A: oauth access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -45531,7 +45531,7 @@ impl<'a, C, A> PlacementGroupListCall<'a, C, A> where C: BorrowMut PlacementGroupUpdateCall<'a, C, A> where C: BorrowMut PlacementGroupInsertCall<'a, C, A> where C: BorrowMut PlacementGroupGetCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -46674,7 +46674,7 @@ impl<'a, C, A> PlacementGroupPatchCall<'a, C, A> where C: BorrowMut InventoryItemListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -47301,7 +47301,7 @@ impl<'a, C, A> InventoryItemGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -47562,7 +47562,7 @@ impl<'a, C, A> UserRolePermissionGetCall<'a, C, A> where C: BorrowMut UserRolePermissionListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupListCall<'a, C, A> where C: BorrowMut AccountPermissionGroupGetCall<'a, C, A> where C: BorrowMut ContentCategoryListCall<'a, C, A> where C: BorrowMut ContentCategoryUpdateCall<'a, C, A> where C: BorrowMut ContentCategoryInsertCall<'a, C, A> where C: BorrowMut ContentCategoryDeleteCall<'a, C, A> where C: BorrowMut ContentCategoryGetCall<'a, C, A> where C: BorrowMut ContentCategoryPatchCall<'a, C, A> where C: BorrowMut CreativeUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -50440,7 +50440,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -50693,7 +50693,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -51046,7 +51046,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -51417,7 +51417,7 @@ impl<'a, C, A> CreativePatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -51680,7 +51680,7 @@ impl<'a, C, A> CampaignGetCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -51945,7 +51945,7 @@ impl<'a, C, A> CampaignInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -52230,7 +52230,7 @@ impl<'a, C, A> CampaignPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -52503,7 +52503,7 @@ impl<'a, C, A> CampaignUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -52835,7 +52835,7 @@ impl<'a, C, A> CampaignListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -53170,7 +53170,7 @@ impl<'a, C, A> EventTagDeleteCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -53467,7 +53467,7 @@ impl<'a, C, A> EventTagListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -53790,7 +53790,7 @@ impl<'a, C, A> EventTagInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54055,7 +54055,7 @@ impl<'a, C, A> EventTagPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54328,7 +54328,7 @@ impl<'a, C, A> EventTagUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -54581,7 +54581,7 @@ impl<'a, C, A> EventTagGetCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -54832,7 +54832,7 @@ impl<'a, C, A> RemarketingListGetCall<'a, C, A> where C: BorrowMut RemarketingListUpdateCall<'a, C, A> where C: BorrowMut RemarketingListListCall<'a, C, A> where C: BorrowMut RemarketingListPatchCall<'a, C, A> where C: BorrowMut RemarketingListInsertCall<'a, C, A> where C: BorrowMut CityListCall<'a, C, A> where C: BorrowMut, A: oaut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -56531,7 +56531,7 @@ impl<'a, C, A> PlacementStrategyUpdateCall<'a, C, A> where C: BorrowMut PlacementStrategyGetCall<'a, C, A> where C: BorrowMut PlacementStrategyListCall<'a, C, A> where C: BorrowMut PlacementStrategyDeleteCall<'a, C, A> where C: BorrowMut PlacementStrategyInsertCall<'a, C, A> where C: BorrowMut PlacementStrategyPatchCall<'a, C, A> where C: BorrowMut ProjectListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -58462,7 +58462,7 @@ impl<'a, C, A> ProjectGetCall<'a, C, A> where C: BorrowMut, A: oa access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -58723,7 +58723,7 @@ impl<'a, C, A> DirectorySiteInsertCall<'a, C, A> where C: BorrowMut DirectorySiteListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59376,7 +59376,7 @@ impl<'a, C, A> DirectorySiteGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -59637,7 +59637,7 @@ impl<'a, C, A> SizeInsertCall<'a, C, A> where C: BorrowMut, A: oa request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -59912,7 +59912,7 @@ impl<'a, C, A> SizeListCall<'a, C, A> where C: BorrowMut, A: oaut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -60182,7 +60182,7 @@ impl<'a, C, A> SizeGetCall<'a, C, A> where C: BorrowMut, A: oauth access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -60433,7 +60433,7 @@ impl<'a, C, A> AccountActiveAdSummaryGetCall<'a, C, A> where C: BorrowMut AccountUserProfileUpdateCall<'a, C, A> where C: BorrowMut AccountUserProfileListCall<'a, C, A> where C: BorrowMut AccountUserProfileInsertCall<'a, C, A> where C: BorrowMut AccountUserProfilePatchCall<'a, C, A> where C: BorrowMut AccountUserProfileGetCall<'a, C, A> where C: BorrowMut CountryListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62327,7 +62327,7 @@ impl<'a, C, A> CountryGetCall<'a, C, A> where C: BorrowMut, A: oa access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62580,7 +62580,7 @@ impl<'a, C, A> OrderDocumentGetCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -62898,7 +62898,7 @@ impl<'a, C, A> OrderDocumentListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63215,7 +63215,7 @@ impl<'a, C, A> PostalCodeGetCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63464,7 +63464,7 @@ impl<'a, C, A> PostalCodeListCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63703,7 +63703,7 @@ impl<'a, C, A> BrowserListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -63944,7 +63944,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut, A: oa access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -64232,7 +64232,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -64533,7 +64533,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -64798,7 +64798,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -65073,7 +65073,7 @@ impl<'a, C, A> PlacementPatchCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -65468,7 +65468,7 @@ impl<'a, C, A> PlacementListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -65856,7 +65856,7 @@ impl<'a, C, A> PlacementInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -66119,7 +66119,7 @@ impl<'a, C, A> PlacementUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -66393,7 +66393,7 @@ impl<'a, C, A> PlacementGeneratetagCall<'a, C, A> where C: BorrowMut PlacementGetCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); diff --git a/gen/discovery1-cli/Cargo.toml b/gen/discovery1-cli/Cargo.toml index eb0c9d50723..5e1b2b0cf7a 100644 --- a/gen/discovery1-cli/Cargo.toml +++ b/gen/discovery1-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-discovery1-cli" -version = "0.1.0+00000000" +version = "0.2.0+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" @@ -20,8 +20,7 @@ name = "discovery1" hyper = "*" mime = "*" yup-oauth2 = "*" -docopt = "*" -docopt_macros = "*" +clap = "*" rustc-serialize = "*" yup-hyper-mock = "*" serde = ">= 0.3.0" diff --git a/gen/discovery1-cli/README.md b/gen/discovery1-cli/README.md index b5a9e60dc0a..f75cf04fd6f 100644 --- a/gen/discovery1-cli/README.md +++ b/gen/discovery1-cli/README.md @@ -10,9 +10,12 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. +Everything else about the *discovery* API can be found at the +[official documentation site](https://developers.google.com/discovery/). + # Usage -This documentation was generated from the *discovery* API at revision *00000000*. The CLI is at version *0.1.0*. +This documentation was generated from the *discovery* API at revision *00000000*. The CLI is at version *0.2.0*. ```bash discovery1 [options] apis get-rest [-p ...] [-o ] diff --git a/gen/discovery1-cli/mkdocs.yml b/gen/discovery1-cli/mkdocs.yml index 8ed74f72fcb..dc406e3fed0 100644 --- a/gen/discovery1-cli/mkdocs.yml +++ b/gen/discovery1-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: discovery v0.1.0+00000000 +site_name: discovery v0.2.0+00000000 site_url: http://byron.github.io/google-apis-rs/google-discovery1-cli site_description: Write integrating applications with bcore diff --git a/gen/discovery1-cli/src/main.rs b/gen/discovery1-cli/src/main.rs index 8669b9b718e..9561bfce302 100644 --- a/gen/discovery1-cli/src/main.rs +++ b/gen/discovery1-cli/src/main.rs @@ -2,10 +2,9 @@ // This file was generated automatically from 'src/mako/cli/main.rs.mako' // DO NOT EDIT ! #![feature(plugin, exit_status)] -#![plugin(docopt_macros)] #![allow(unused_variables, unused_imports, dead_code, unused_mut)] -extern crate docopt; +extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate rustc_serialize; @@ -16,234 +15,77 @@ extern crate google_discovery1 as api; use std::env; use std::io::{self, Write}; - -docopt!(Options derive Debug, " -Usage: - discovery1 [options] apis get-rest [-p ...] [-o ] - discovery1 [options] apis list [-p ...] [-o ] - discovery1 --help - -All documentation details can be found at -http://byron.github.io/google-apis-rs/google_discovery1_cli/index.html - -Configuration: - --config-dir - A directory into which we will store our persistent data. Defaults to - a user-writable directory that we will create during the first invocation. - [default: ~/.google-service-cli] - --debug - Output all server communication to standard error. `tx` and `rx` are placed - into the same stream. - --debug-auth - Output all communication related to authentication to standard error. `tx` - and `rx` are placed into the same stream. -"); - -mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, - input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError}; - -use std::default::Default; -use std::str::FromStr; - -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use rustc_serialize::json; - -struct Engine { - opt: Options, - hub: api::Discovery>, -} - - -impl Engine { - fn _apis_get_rest(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.apis().get_rest(&self.opt.arg_api, &self.opt.arg_version); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _apis_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.apis().list(); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "preferred" => { - call = call.preferred(arg_from_str(value.unwrap_or("false"), err, "preferred", "boolean")); - }, - "name" => { - call = call.name(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _doit(&self, dry_run: bool) -> (Option, Option) { - let mut err = InvalidOptionsError::new(); - let mut call_result: Option; - let mut err_opt: Option = None; - - if self.opt.cmd_apis { - if self.opt.cmd_get_rest { - call_result = self._apis_get_rest(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._apis_list(dry_run, &mut err); - } else { - unreachable!(); - } - } else { - unreachable!(); - } - - if dry_run { - if err.issues.len() > 0 { - err_opt = Some(err); - } - } - (call_result, err_opt) - } - - // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: Options) -> Result { - let (config_dir, secret) = { - let config_dir = match cmn::assure_config_dir_exists(&opt.flag_config_dir) { - Err(e) => return Err(InvalidOptionsError::single(e, 3)), - Ok(p) => p, - }; - - match cmn::application_secret_from_directory(&config_dir, "discovery1-secret.json", - "{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") { - Ok(secret) => (config_dir, secret), - Err(e) => return Err(InvalidOptionsError::single(e, 4)) - } - }; - - let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, - if opt.flag_debug_auth { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }, - JsonTokenStorage { - program_name: "discovery1", - db_dir: config_dir.clone(), - }, None); - - let client = - if opt.flag_debug { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }; - let engine = Engine { - opt: opt, - hub: api::Discovery::new(client, auth), - }; - - match engine._doit(true) { - (_, Some(err)) => Err(err), - _ => Ok(engine), - } - } - - // Execute the call with all the bells and whistles, informing the caller only if there was an error. - // The absense of one indicates success. - fn doit(&self) -> Option { - self._doit(false).0 - } -} +use clap::{App, SubCommand, Arg}; fn main() { - let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit()); - let debug = opts.flag_debug; - match Engine::new(opts) { - Err(err) => { - writeln!(io::stderr(), "{}", err).ok(); - env::set_exit_status(err.exit_code); - }, - Ok(engine) => { - if let Some(err) = engine.doit() { - if debug { - writeln!(io::stderr(), "{:?}", err).ok(); - } else { - writeln!(io::stderr(), "{}", err).ok(); - } - env::set_exit_status(1); - } - } - } + let matches = + App::new("discovery1") + .author("Sebastian Thiel ") + .version("0.2.0") + .about("Lets you discover information about other Google APIs, such as what APIs are available, the resource and method details for each API.") + .after_help("All documentation details can be found athttp://byron.github.io/google-apis-rs/google_discovery1_cli/index.html") + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ${CONFIG_DIR}]") + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .takes_value(false)) + .subcommand( + SubCommand::new("apis") + .subcommand( + SubCommand::new("get-rest") + .about("Retrieve the description of a particular version of an api.") + .arg( + Arg::with_name("api") + .help("The name of the API.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("version") + .help("The version of the API.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Retrieve the list of APIs supported at this endpoint.") + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .get_matches(); + + } \ No newline at end of file diff --git a/gen/discovery1/README.md b/gen/discovery1/README.md index 4dcb56e4df2..133844e10aa 100644 --- a/gen/discovery1/README.md +++ b/gen/discovery1/README.md @@ -157,7 +157,7 @@ These will always take a single argument, for which the following statements are * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](http://byron.github.io/google-apis-rs/google_discovery1/trait.RequestValue.html) are borrowed +* [request values](http://byron.github.io/google-apis-rs/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 634908fd3ac..6cb3ac33064 100644 --- a/gen/discovery1/src/lib.rs +++ b/gen/discovery1/src/lib.rs @@ -158,7 +158,7 @@ //! //! * [PODs][wiki-pod] are handed by copy //! * strings are passed as `&str` -//! * [request values](trait.RequestValue.html) are borrowed +//! * [request values](trait.RequestValue.html) are moved //! //! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. //! @@ -978,7 +978,7 @@ impl<'a, C, A> ApiGetRestCall<'a, C, A> where C: BorrowMut, A: oa loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); @@ -1176,7 +1176,7 @@ impl<'a, C, A> ApiListCall<'a, C, A> where C: BorrowMut, A: oauth loop { let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())); dlg.pre_request(); diff --git a/gen/youtube3-cli/Cargo.toml b/gen/youtube3-cli/Cargo.toml index 7a09ca49839..7c612f17363 100644 --- a/gen/youtube3-cli/Cargo.toml +++ b/gen/youtube3-cli/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "google-youtube3-cli" -version = "0.1.0+20150414" +version = "0.2.0+20150414" 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" @@ -20,8 +20,7 @@ name = "youtube3" hyper = "*" mime = "*" yup-oauth2 = "*" -docopt = "*" -docopt_macros = "*" +clap = "*" rustc-serialize = "*" yup-hyper-mock = "*" serde = ">= 0.3.0" diff --git a/gen/youtube3-cli/README.md b/gen/youtube3-cli/README.md index 75e71df54b2..f7708ca3371 100644 --- a/gen/youtube3-cli/README.md +++ b/gen/youtube3-cli/README.md @@ -10,9 +10,12 @@ capabilities. Errors will be printed to standard error, and cause the program's If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools. +Everything else about the *YouTube* API can be found at the +[official documentation site](https://developers.google.com/youtube/v3). + # Usage -This documentation was generated from the *YouTube* API at revision *20150414*. The CLI is at version *0.1.0*. +This documentation was generated from the *YouTube* API at revision *20150414*. The CLI is at version *0.2.0*. ```bash youtube3 [options] activities insert -r ... [-p ...] [-o ] diff --git a/gen/youtube3-cli/mkdocs.yml b/gen/youtube3-cli/mkdocs.yml index 8bd38a256eb..c9119faf60d 100644 --- a/gen/youtube3-cli/mkdocs.yml +++ b/gen/youtube3-cli/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: YouTube v0.1.0+20150414 +site_name: YouTube v0.2.0+20150414 site_url: http://byron.github.io/google-apis-rs/google-youtube3-cli site_description: Write integrating applications with bcore diff --git a/gen/youtube3-cli/src/main.rs b/gen/youtube3-cli/src/main.rs index 0bbf6d03184..e8f594bb4ff 100644 --- a/gen/youtube3-cli/src/main.rs +++ b/gen/youtube3-cli/src/main.rs @@ -2,10 +2,9 @@ // This file was generated automatically from 'src/mako/cli/main.rs.mako' // DO NOT EDIT ! #![feature(plugin, exit_status)] -#![plugin(docopt_macros)] #![allow(unused_variables, unused_imports, dead_code, unused_mut)] -extern crate docopt; +extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate rustc_serialize; @@ -16,9843 +15,1618 @@ extern crate google_youtube3 as api; use std::env; use std::io::{self, Write}; - -docopt!(Options derive Debug, " -Usage: - youtube3 [options] activities insert -r ... [-p ...] [-o ] - youtube3 [options] activities list [-p ...] [-o ] - youtube3 [options] captions delete [-p ...] - youtube3 [options] captions download [-p ...] [-o ] - youtube3 [options] captions insert -r ... -u (simple|resumable) [-p ...] [-o ] - youtube3 [options] captions list [-p ...] [-o ] - youtube3 [options] captions update -r ... -u (simple|resumable) [-p ...] [-o ] - youtube3 [options] channel-banners insert -r ... -u (simple|resumable) [-p ...] [-o ] - youtube3 [options] channel-sections delete [-p ...] - youtube3 [options] channel-sections insert -r ... [-p ...] [-o ] - youtube3 [options] channel-sections list [-p ...] [-o ] - youtube3 [options] channel-sections update -r ... [-p ...] [-o ] - youtube3 [options] channels list [-p ...] [-o ] - youtube3 [options] channels update -r ... [-p ...] [-o ] - youtube3 [options] comment-threads insert -r ... [-p ...] [-o ] - youtube3 [options] comment-threads list [-p ...] [-o ] - youtube3 [options] comment-threads update -r ... [-p ...] [-o ] - youtube3 [options] comments delete [-p ...] - youtube3 [options] comments insert -r ... [-p ...] [-o ] - youtube3 [options] comments list [-p ...] [-o ] - youtube3 [options] comments mark-as-spam [-p ...] - youtube3 [options] comments set-moderation-status [-p ...] - youtube3 [options] comments update -r ... [-p ...] [-o ] - youtube3 [options] guide-categories list [-p ...] [-o ] - youtube3 [options] i18n-languages list [-p ...] [-o ] - youtube3 [options] i18n-regions list [-p ...] [-o ] - youtube3 [options] live-broadcasts bind [-p ...] [-o ] - youtube3 [options] live-broadcasts control [-p ...] [-o ] - youtube3 [options] live-broadcasts delete [-p ...] - youtube3 [options] live-broadcasts insert -r ... [-p ...] [-o ] - youtube3 [options] live-broadcasts list [-p ...] [-o ] - youtube3 [options] live-broadcasts transition [-p ...] [-o ] - youtube3 [options] live-broadcasts update -r ... [-p ...] [-o ] - youtube3 [options] live-streams delete [-p ...] - youtube3 [options] live-streams insert -r ... [-p ...] [-o ] - youtube3 [options] live-streams list [-p ...] [-o ] - youtube3 [options] live-streams update -r ... [-p ...] [-o ] - youtube3 [options] playlist-items delete [-p ...] - youtube3 [options] playlist-items insert -r ... [-p ...] [-o ] - youtube3 [options] playlist-items list [-p ...] [-o ] - youtube3 [options] playlist-items update -r ... [-p ...] [-o ] - youtube3 [options] playlists delete [-p ...] - youtube3 [options] playlists insert -r ... [-p ...] [-o ] - youtube3 [options] playlists list [-p ...] [-o ] - youtube3 [options] playlists update -r ... [-p ...] [-o ] - youtube3 [options] search list [-p ...] [-o ] - youtube3 [options] subscriptions delete [-p ...] - youtube3 [options] subscriptions insert -r ... [-p ...] [-o ] - youtube3 [options] subscriptions list [-p ...] [-o ] - youtube3 [options] thumbnails set -u (simple|resumable) [-p ...] [-o ] - youtube3 [options] video-abuse-report-reasons list [-p ...] [-o ] - youtube3 [options] video-categories list [-p ...] [-o ] - youtube3 [options] videos delete [-p ...] - youtube3 [options] videos get-rating [-p ...] [-o ] - youtube3 [options] videos insert -r ... -u (simple|resumable) [-p ...] [-o ] - youtube3 [options] videos list [-p ...] [-o ] - youtube3 [options] videos rate [-p ...] - youtube3 [options] videos report-abuse -r ... [-p ...] - youtube3 [options] videos update -r ... [-p ...] [-o ] - youtube3 [options] watermarks set -r ... -u (simple|resumable) [-p ...] - youtube3 [options] watermarks unset [-p ...] - youtube3 --help - -All documentation details can be found at -http://byron.github.io/google-apis-rs/google_youtube3_cli/index.html - -Configuration: - --scope - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. - If unset, it defaults to the shortest scope url for a particular method. - --config-dir - A directory into which we will store our persistent data. Defaults to - a user-writable directory that we will create during the first invocation. - [default: ~/.google-service-cli] - --debug - Output all server communication to standard error. `tx` and `rx` are placed - into the same stream. - --debug-auth - Output all communication related to authentication to standard error. `tx` - and `rx` are placed into the same stream. -"); - -mod cmn; -use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, - input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError}; - -use std::default::Default; -use std::str::FromStr; - -use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; -use rustc_serialize::json; - -struct Engine { - opt: Options, - hub: api::YouTube>, -} - - -impl Engine { - fn _activities_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Activity::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_bulletin_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().bulletin.is_none() { - request.content_details.as_mut().unwrap().bulletin = Some(Default::default()); - } - } - - fn request_content_details_bulletin_resource_id_init(request: &mut api::Activity) { - request_content_details_bulletin_init(request); - if request.content_details.as_mut().unwrap().bulletin.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().bulletin.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_channel_item_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().channel_item.is_none() { - request.content_details.as_mut().unwrap().channel_item = Some(Default::default()); - } - } - - fn request_content_details_channel_item_resource_id_init(request: &mut api::Activity) { - request_content_details_channel_item_init(request); - if request.content_details.as_mut().unwrap().channel_item.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().channel_item.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_comment_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().comment.is_none() { - request.content_details.as_mut().unwrap().comment = Some(Default::default()); - } - } - - fn request_content_details_comment_resource_id_init(request: &mut api::Activity) { - request_content_details_comment_init(request); - if request.content_details.as_mut().unwrap().comment.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().comment.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_favorite_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().favorite.is_none() { - request.content_details.as_mut().unwrap().favorite = Some(Default::default()); - } - } - - fn request_content_details_favorite_resource_id_init(request: &mut api::Activity) { - request_content_details_favorite_init(request); - if request.content_details.as_mut().unwrap().favorite.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().favorite.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_init(request: &mut api::Activity) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_content_details_like_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().like.is_none() { - request.content_details.as_mut().unwrap().like = Some(Default::default()); - } - } - - fn request_content_details_like_resource_id_init(request: &mut api::Activity) { - request_content_details_like_init(request); - if request.content_details.as_mut().unwrap().like.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().like.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_playlist_item_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().playlist_item.is_none() { - request.content_details.as_mut().unwrap().playlist_item = Some(Default::default()); - } - } - - fn request_content_details_playlist_item_resource_id_init(request: &mut api::Activity) { - request_content_details_playlist_item_init(request); - if request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_promoted_item_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().promoted_item.is_none() { - request.content_details.as_mut().unwrap().promoted_item = Some(Default::default()); - } - } - - fn request_content_details_recommendation_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().recommendation.is_none() { - request.content_details.as_mut().unwrap().recommendation = Some(Default::default()); - } - } - - fn request_content_details_recommendation_resource_id_init(request: &mut api::Activity) { - request_content_details_recommendation_init(request); - if request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_recommendation_seed_resource_id_init(request: &mut api::Activity) { - request_content_details_recommendation_init(request); - if request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().seed_resource_id.is_none() { - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().seed_resource_id = Some(Default::default()); - } - } - - fn request_content_details_social_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().social.is_none() { - request.content_details.as_mut().unwrap().social = Some(Default::default()); - } - } - - fn request_content_details_social_resource_id_init(request: &mut api::Activity) { - request_content_details_social_init(request); - if request.content_details.as_mut().unwrap().social.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().social.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_subscription_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().subscription.is_none() { - request.content_details.as_mut().unwrap().subscription = Some(Default::default()); - } - } - - fn request_content_details_subscription_resource_id_init(request: &mut api::Activity) { - request_content_details_subscription_init(request); - if request.content_details.as_mut().unwrap().subscription.as_mut().unwrap().resource_id.is_none() { - request.content_details.as_mut().unwrap().subscription.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_content_details_upload_init(request: &mut api::Activity) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().upload.is_none() { - request.content_details.as_mut().unwrap().upload = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Activity) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Activity) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Activity) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Activity) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Activity) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Activity) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Activity) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "snippet.title" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.type" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "snippet.group-id" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().group_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "content-details.comment.resource-id.kind" => { - request_content_details_comment_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().comment.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.comment.resource-id.channel-id" => { - request_content_details_comment_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().comment.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.comment.resource-id.playlist-id" => { - request_content_details_comment_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().comment.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.comment.resource-id.video-id" => { - request_content_details_comment_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().comment.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.playlist-item.resource-id.kind" => { - request_content_details_playlist_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.playlist-item.resource-id.channel-id" => { - request_content_details_playlist_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.playlist-item.resource-id.playlist-id" => { - request_content_details_playlist_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.playlist-item.resource-id.video-id" => { - request_content_details_playlist_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.playlist-item.playlist-id" => { - request_content_details_playlist_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.playlist-item.playlist-item-id" => { - request_content_details_playlist_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().playlist_item.as_mut().unwrap().playlist_item_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.like.resource-id.kind" => { - request_content_details_like_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().like.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.like.resource-id.channel-id" => { - request_content_details_like_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().like.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.like.resource-id.playlist-id" => { - request_content_details_like_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().like.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.like.resource-id.video-id" => { - request_content_details_like_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().like.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.cta-type" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().cta_type = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.ad-tag" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().ad_tag = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.destination-url" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().destination_url = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.forecasting-url" => { - request_content_details_promoted_item_init(&mut request); - if request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().forecasting_url.is_none() { - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().forecasting_url = Some(Default::default()); - } - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().forecasting_url.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.impression-url" => { - request_content_details_promoted_item_init(&mut request); - if request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().impression_url.is_none() { - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().impression_url = Some(Default::default()); - } - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().impression_url.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.creative-view-url" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().creative_view_url = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.video-id" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.description-text" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().description_text = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.custom-cta-button-text" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().custom_cta_button_text = Some(value.unwrap_or("").to_string()); - }, - "content-details.promoted-item.click-tracking-url" => { - request_content_details_promoted_item_init(&mut request); - request.content_details.as_mut().unwrap().promoted_item.as_mut().unwrap().click_tracking_url = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.resource-id.kind" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.resource-id.channel-id" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.resource-id.playlist-id" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.resource-id.video-id" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.image-url" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().image_url = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.type" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.reference-url" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().reference_url = Some(value.unwrap_or("").to_string()); - }, - "content-details.social.author" => { - request_content_details_social_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().social.as_mut().unwrap().author = Some(value.unwrap_or("").to_string()); - }, - "content-details.favorite.resource-id.kind" => { - request_content_details_favorite_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().favorite.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.favorite.resource-id.channel-id" => { - request_content_details_favorite_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().favorite.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.favorite.resource-id.playlist-id" => { - request_content_details_favorite_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().favorite.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.favorite.resource-id.video-id" => { - request_content_details_favorite_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().favorite.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.upload.video-id" => { - request_content_details_upload_init(&mut request); - request.content_details.as_mut().unwrap().upload.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.resource-id.kind" => { - request_content_details_recommendation_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.resource-id.channel-id" => { - request_content_details_recommendation_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.resource-id.playlist-id" => { - request_content_details_recommendation_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.resource-id.video-id" => { - request_content_details_recommendation_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.reason" => { - request_content_details_recommendation_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().reason = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.seed-resource-id.kind" => { - request_content_details_recommendation_seed_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().seed_resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.seed-resource-id.channel-id" => { - request_content_details_recommendation_seed_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().seed_resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.seed-resource-id.playlist-id" => { - request_content_details_recommendation_seed_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().seed_resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.recommendation.seed-resource-id.video-id" => { - request_content_details_recommendation_seed_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().recommendation.as_mut().unwrap().seed_resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.subscription.resource-id.kind" => { - request_content_details_subscription_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().subscription.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.subscription.resource-id.channel-id" => { - request_content_details_subscription_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().subscription.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.subscription.resource-id.playlist-id" => { - request_content_details_subscription_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().subscription.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.subscription.resource-id.video-id" => { - request_content_details_subscription_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().subscription.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.bulletin.resource-id.kind" => { - request_content_details_bulletin_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().bulletin.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.bulletin.resource-id.channel-id" => { - request_content_details_bulletin_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().bulletin.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.bulletin.resource-id.playlist-id" => { - request_content_details_bulletin_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().bulletin.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.bulletin.resource-id.video-id" => { - request_content_details_bulletin_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().bulletin.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.channel-item.resource-id.kind" => { - request_content_details_channel_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().channel_item.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.channel-item.resource-id.channel-id" => { - request_content_details_channel_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().channel_item.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.channel-item.resource-id.playlist-id" => { - request_content_details_channel_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().channel_item.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.channel-item.resource-id.video-id" => { - request_content_details_channel_item_resource_id_init(&mut request); - request.content_details.as_mut().unwrap().channel_item.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_content_details_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_content_details_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_content_details_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.activities().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _activities_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.activities().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "region-code" => { - call = call.region_code(value.unwrap_or("")); - }, - "published-before" => { - call = call.published_before(value.unwrap_or("")); - }, - "published-after" => { - call = call.published_after(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "home" => { - call = call.home(arg_from_str(value.unwrap_or("false"), err, "home", "boolean")); - }, - "channel-id" => { - call = call.channel_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _captions_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.captions().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of" => { - call = call.on_behalf_of(value.unwrap_or("")); - }, - "debug-project-id-override" => { - call = call.debug_project_id_override(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _captions_download(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut download_mode = false; - let mut call = self.hub.captions().download(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "tlang" => { - call = call.tlang(value.unwrap_or("")); - }, - "tfmt" => { - call = call.tfmt(value.unwrap_or("")); - }, - "on-behalf-of" => { - call = call.on_behalf_of(value.unwrap_or("")); - }, - "debug-project-id-override" => { - call = call.debug_project_id_override(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - if key == "alt" && value.unwrap_or("unset") == "media" { - download_mode = true; - } - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - if !download_mode { - } else { - io::copy(&mut response, &mut ostream).unwrap(); - } - None - } - } - } - } - - fn _captions_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Caption::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_snippet_init(request: &mut api::Caption) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.status" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "snippet.audio-track-type" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().audio_track_type = Some(value.unwrap_or("").to_string()); - }, - "snippet.language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().language = Some(value.unwrap_or("").to_string()); - }, - "snippet.name" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().name = Some(value.unwrap_or("").to_string()); - }, - "snippet.video-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.is-draft" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_draft = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-draft", "boolean")); - }, - "snippet.is-auto-synced" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_auto_synced = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-auto-synced", "boolean")); - }, - "snippet.track-kind" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().track_kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.last-updated" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().last_updated = Some(value.unwrap_or("").to_string()); - }, - "snippet.is-cc" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_cc = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-cc", "boolean")); - }, - "snippet.is-easy-reader" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_easy_reader = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-easy-reader", "boolean")); - }, - "snippet.is-large" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_large = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-large", "boolean")); - }, - "snippet.failure-reason" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().failure_reason = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_snippet_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.captions().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sync" => { - call = call.sync(arg_from_str(value.unwrap_or("false"), err, "sync", "boolean")); - }, - "on-behalf-of" => { - call = call.on_behalf_of(value.unwrap_or("")); - }, - "debug-project-id-override" => { - call = call.debug_project_id_override(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _captions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.captions().list(&self.opt.arg_part, &self.opt.arg_video_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of" => { - call = call.on_behalf_of(value.unwrap_or("")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "debug-project-id-override" => { - call = call.debug_project_id_override(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _captions_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Caption::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_snippet_init(request: &mut api::Caption) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.status" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().status = Some(value.unwrap_or("").to_string()); - }, - "snippet.audio-track-type" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().audio_track_type = Some(value.unwrap_or("").to_string()); - }, - "snippet.language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().language = Some(value.unwrap_or("").to_string()); - }, - "snippet.name" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().name = Some(value.unwrap_or("").to_string()); - }, - "snippet.video-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.is-draft" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_draft = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-draft", "boolean")); - }, - "snippet.is-auto-synced" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_auto_synced = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-auto-synced", "boolean")); - }, - "snippet.track-kind" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().track_kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.last-updated" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().last_updated = Some(value.unwrap_or("").to_string()); - }, - "snippet.is-cc" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_cc = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-cc", "boolean")); - }, - "snippet.is-easy-reader" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_easy_reader = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-easy-reader", "boolean")); - }, - "snippet.is-large" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_large = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-large", "boolean")); - }, - "snippet.failure-reason" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().failure_reason = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_snippet_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.captions().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "sync" => { - call = call.sync(arg_from_str(value.unwrap_or("false"), err, "sync", "boolean")); - }, - "on-behalf-of" => { - call = call.on_behalf_of(value.unwrap_or("")); - }, - "debug-project-id-override" => { - call = call.debug_project_id_override(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _channel_banners_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::ChannelBannerResource::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "url" => { - request.url = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request.etag = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.channel_banners().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _channel_sections_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.channel_sections().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _channel_sections_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::ChannelSection::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::ChannelSection) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::ChannelSection) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::ChannelSection) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_targeting_init(request: &mut api::ChannelSection) { - if request.targeting.is_none() { - request.targeting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "targeting.languages" => { - request_targeting_init(&mut request); - if request.targeting.as_mut().unwrap().languages.is_none() { - request.targeting.as_mut().unwrap().languages = Some(Default::default()); - } - request.targeting.as_mut().unwrap().languages.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "targeting.regions" => { - request_targeting_init(&mut request); - if request.targeting.as_mut().unwrap().regions.is_none() { - request.targeting.as_mut().unwrap().regions = Some(Default::default()); - } - request.targeting.as_mut().unwrap().regions.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "targeting.countries" => { - request_targeting_init(&mut request); - if request.targeting.as_mut().unwrap().countries.is_none() { - request.targeting.as_mut().unwrap().countries = Some(Default::default()); - } - request.targeting.as_mut().unwrap().countries.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.channels" => { - request_content_details_init(&mut request); - if request.content_details.as_mut().unwrap().channels.is_none() { - request.content_details.as_mut().unwrap().channels = Some(Default::default()); - } - request.content_details.as_mut().unwrap().channels.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.playlists" => { - request_content_details_init(&mut request); - if request.content_details.as_mut().unwrap().playlists.is_none() { - request.content_details.as_mut().unwrap().playlists = Some(Default::default()); - } - request.content_details.as_mut().unwrap().playlists.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "snippet.style" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().style = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.position" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().position = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.position", "integer")); - }, - "snippet.type" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.channel_sections().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _channel_sections_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.channel_sections().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "channel-id" => { - call = call.channel_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _channel_sections_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::ChannelSection::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::ChannelSection) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::ChannelSection) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::ChannelSection) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_targeting_init(request: &mut api::ChannelSection) { - if request.targeting.is_none() { - request.targeting = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "targeting.languages" => { - request_targeting_init(&mut request); - if request.targeting.as_mut().unwrap().languages.is_none() { - request.targeting.as_mut().unwrap().languages = Some(Default::default()); - } - request.targeting.as_mut().unwrap().languages.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "targeting.regions" => { - request_targeting_init(&mut request); - if request.targeting.as_mut().unwrap().regions.is_none() { - request.targeting.as_mut().unwrap().regions = Some(Default::default()); - } - request.targeting.as_mut().unwrap().regions.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "targeting.countries" => { - request_targeting_init(&mut request); - if request.targeting.as_mut().unwrap().countries.is_none() { - request.targeting.as_mut().unwrap().countries = Some(Default::default()); - } - request.targeting.as_mut().unwrap().countries.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.channels" => { - request_content_details_init(&mut request); - if request.content_details.as_mut().unwrap().channels.is_none() { - request.content_details.as_mut().unwrap().channels = Some(Default::default()); - } - request.content_details.as_mut().unwrap().channels.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.playlists" => { - request_content_details_init(&mut request); - if request.content_details.as_mut().unwrap().playlists.is_none() { - request.content_details.as_mut().unwrap().playlists = Some(Default::default()); - } - request.content_details.as_mut().unwrap().playlists.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "snippet.style" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().style = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.position" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().position = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.position", "integer")); - }, - "snippet.type" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.channel_sections().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _channels_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.channels().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "my-subscribers" => { - call = call.my_subscribers(arg_from_str(value.unwrap_or("false"), err, "my-subscribers", "boolean")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "managed-by-me" => { - call = call.managed_by_me(arg_from_str(value.unwrap_or("false"), err, "managed-by-me", "boolean")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "for-username" => { - call = call.for_username(value.unwrap_or("")); - }, - "category-id" => { - call = call.category_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _channels_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Channel::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_audit_details_init(request: &mut api::Channel) { - if request.audit_details.is_none() { - request.audit_details = Some(Default::default()); - } - } - - fn request_branding_settings_channel_init(request: &mut api::Channel) { - request_branding_settings_init(request); - if request.branding_settings.as_mut().unwrap().channel.is_none() { - request.branding_settings.as_mut().unwrap().channel = Some(Default::default()); - } - } - - fn request_branding_settings_image_background_image_url_default_language_init(request: &mut api::Channel) { - request_branding_settings_image_background_image_url_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().background_image_url.as_mut().unwrap().default_language.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().background_image_url.as_mut().unwrap().default_language = Some(Default::default()); - } - } - - fn request_branding_settings_image_background_image_url_init(request: &mut api::Channel) { - request_branding_settings_image_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().background_image_url.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().background_image_url = Some(Default::default()); - } - } - - fn request_branding_settings_image_init(request: &mut api::Channel) { - request_branding_settings_init(request); - if request.branding_settings.as_mut().unwrap().image.is_none() { - request.branding_settings.as_mut().unwrap().image = Some(Default::default()); - } - } - - fn request_branding_settings_image_large_branded_banner_image_imap_script_default_language_init(request: &mut api::Channel) { - request_branding_settings_image_large_branded_banner_image_imap_script_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_imap_script.as_mut().unwrap().default_language.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_imap_script.as_mut().unwrap().default_language = Some(Default::default()); - } - } - - fn request_branding_settings_image_large_branded_banner_image_imap_script_init(request: &mut api::Channel) { - request_branding_settings_image_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_imap_script.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_imap_script = Some(Default::default()); - } - } - - fn request_branding_settings_image_large_branded_banner_image_url_default_language_init(request: &mut api::Channel) { - request_branding_settings_image_large_branded_banner_image_url_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_url.as_mut().unwrap().default_language.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_url.as_mut().unwrap().default_language = Some(Default::default()); - } - } - - fn request_branding_settings_image_large_branded_banner_image_url_init(request: &mut api::Channel) { - request_branding_settings_image_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_url.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_url = Some(Default::default()); - } - } - - fn request_branding_settings_image_small_branded_banner_image_imap_script_default_language_init(request: &mut api::Channel) { - request_branding_settings_image_small_branded_banner_image_imap_script_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_imap_script.as_mut().unwrap().default_language.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_imap_script.as_mut().unwrap().default_language = Some(Default::default()); - } - } - - fn request_branding_settings_image_small_branded_banner_image_imap_script_init(request: &mut api::Channel) { - request_branding_settings_image_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_imap_script.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_imap_script = Some(Default::default()); - } - } - - fn request_branding_settings_image_small_branded_banner_image_url_default_language_init(request: &mut api::Channel) { - request_branding_settings_image_small_branded_banner_image_url_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_url.as_mut().unwrap().default_language.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_url.as_mut().unwrap().default_language = Some(Default::default()); - } - } - - fn request_branding_settings_image_small_branded_banner_image_url_init(request: &mut api::Channel) { - request_branding_settings_image_init(request); - if request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_url.is_none() { - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_url = Some(Default::default()); - } - } - - fn request_branding_settings_init(request: &mut api::Channel) { - if request.branding_settings.is_none() { - request.branding_settings = Some(Default::default()); - } - } - - fn request_branding_settings_watch_init(request: &mut api::Channel) { - request_branding_settings_init(request); - if request.branding_settings.as_mut().unwrap().watch.is_none() { - request.branding_settings.as_mut().unwrap().watch = Some(Default::default()); - } - } - - fn request_content_details_init(request: &mut api::Channel) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_content_details_related_playlists_init(request: &mut api::Channel) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().related_playlists.is_none() { - request.content_details.as_mut().unwrap().related_playlists = Some(Default::default()); - } - } - - fn request_content_owner_details_init(request: &mut api::Channel) { - if request.content_owner_details.is_none() { - request.content_owner_details = Some(Default::default()); - } - } - - fn request_invideo_promotion_default_timing_init(request: &mut api::Channel) { - request_invideo_promotion_init(request); - if request.invideo_promotion.as_mut().unwrap().default_timing.is_none() { - request.invideo_promotion.as_mut().unwrap().default_timing = Some(Default::default()); - } - } - - fn request_invideo_promotion_init(request: &mut api::Channel) { - if request.invideo_promotion.is_none() { - request.invideo_promotion = Some(Default::default()); - } - } - - fn request_invideo_promotion_position_init(request: &mut api::Channel) { - request_invideo_promotion_init(request); - if request.invideo_promotion.as_mut().unwrap().position.is_none() { - request.invideo_promotion.as_mut().unwrap().position = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Channel) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::Channel) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Channel) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Channel) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Channel) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Channel) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Channel) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Channel) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_statistics_init(request: &mut api::Channel) { - if request.statistics.is_none() { - request.statistics = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::Channel) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - fn request_topic_details_init(request: &mut api::Channel) { - if request.topic_details.is_none() { - request.topic_details = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "status.is-linked" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().is_linked = Some(arg_from_str(value.unwrap_or("false"), err, "status.is-linked", "boolean")); - }, - "status.long-uploads-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().long_uploads_status = Some(value.unwrap_or("").to_string()); - }, - "invideo-promotion.default-timing.offset-ms" => { - request_invideo_promotion_default_timing_init(&mut request); - request.invideo_promotion.as_mut().unwrap().default_timing.as_mut().unwrap().offset_ms = Some(value.unwrap_or("").to_string()); - }, - "invideo-promotion.default-timing.type" => { - request_invideo_promotion_default_timing_init(&mut request); - request.invideo_promotion.as_mut().unwrap().default_timing.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "invideo-promotion.default-timing.duration-ms" => { - request_invideo_promotion_default_timing_init(&mut request); - request.invideo_promotion.as_mut().unwrap().default_timing.as_mut().unwrap().duration_ms = Some(value.unwrap_or("").to_string()); - }, - "invideo-promotion.position.corner-position" => { - request_invideo_promotion_position_init(&mut request); - request.invideo_promotion.as_mut().unwrap().position.as_mut().unwrap().corner_position = Some(value.unwrap_or("").to_string()); - }, - "invideo-promotion.position.type" => { - request_invideo_promotion_position_init(&mut request); - request.invideo_promotion.as_mut().unwrap().position.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "invideo-promotion.use-smart-timing" => { - request_invideo_promotion_position_init(&mut request); - request.invideo_promotion.as_mut().unwrap().use_smart_timing = Some(arg_from_str(value.unwrap_or("false"), err, "invideo-promotion.use-smart-timing", "boolean")); - }, - "kind" => { - request_invideo_promotion_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "statistics.comment-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().comment_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.comment-count", "int64")); - }, - "statistics.subscriber-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().subscriber_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.subscriber-count", "int64")); - }, - "statistics.video-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().video_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.video-count", "int64")); - }, - "statistics.hidden-subscriber-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().hidden_subscriber_count = Some(arg_from_str(value.unwrap_or("false"), err, "statistics.hidden-subscriber-count", "boolean")); - }, - "statistics.view-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().view_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.view-count", "int64")); - }, - "content-owner-details.content-owner" => { - request_content_owner_details_init(&mut request); - request.content_owner_details.as_mut().unwrap().content_owner = Some(value.unwrap_or("").to_string()); - }, - "content-owner-details.time-linked" => { - request_content_owner_details_init(&mut request); - request.content_owner_details.as_mut().unwrap().time_linked = Some(value.unwrap_or("").to_string()); - }, - "topic-details.topic-ids" => { - request_topic_details_init(&mut request); - if request.topic_details.as_mut().unwrap().topic_ids.is_none() { - request.topic_details.as_mut().unwrap().topic_ids = Some(Default::default()); - } - request.topic_details.as_mut().unwrap().topic_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.related-playlists.watch-later" => { - request_content_details_related_playlists_init(&mut request); - request.content_details.as_mut().unwrap().related_playlists.as_mut().unwrap().watch_later = Some(value.unwrap_or("").to_string()); - }, - "content-details.related-playlists.watch-history" => { - request_content_details_related_playlists_init(&mut request); - request.content_details.as_mut().unwrap().related_playlists.as_mut().unwrap().watch_history = Some(value.unwrap_or("").to_string()); - }, - "content-details.related-playlists.uploads" => { - request_content_details_related_playlists_init(&mut request); - request.content_details.as_mut().unwrap().related_playlists.as_mut().unwrap().uploads = Some(value.unwrap_or("").to_string()); - }, - "content-details.related-playlists.favorites" => { - request_content_details_related_playlists_init(&mut request); - request.content_details.as_mut().unwrap().related_playlists.as_mut().unwrap().favorites = Some(value.unwrap_or("").to_string()); - }, - "content-details.related-playlists.likes" => { - request_content_details_related_playlists_init(&mut request); - request.content_details.as_mut().unwrap().related_playlists.as_mut().unwrap().likes = Some(value.unwrap_or("").to_string()); - }, - "content-details.google-plus-user-id" => { - request_content_details_related_playlists_init(&mut request); - request.content_details.as_mut().unwrap().google_plus_user_id = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.large-branded-banner-image-imap-script.default" => { - request_branding_settings_image_large_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_imap_script.as_mut().unwrap().default = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.large-branded-banner-image-imap-script.default-language.value" => { - request_branding_settings_image_large_branded_banner_image_imap_script_default_language_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_imap_script.as_mut().unwrap().default_language.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.small-branded-banner-image-url.default" => { - request_branding_settings_image_small_branded_banner_image_url_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_url.as_mut().unwrap().default = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.small-branded-banner-image-url.default-language.value" => { - request_branding_settings_image_small_branded_banner_image_url_default_language_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_url.as_mut().unwrap().default_language.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tv-image-url" => { - request_branding_settings_image_small_branded_banner_image_url_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tv_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tv-low-image-url" => { - request_branding_settings_image_small_branded_banner_image_url_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tv_low_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.large-branded-banner-image-url.default" => { - request_branding_settings_image_large_branded_banner_image_url_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_url.as_mut().unwrap().default = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.large-branded-banner-image-url.default-language.value" => { - request_branding_settings_image_large_branded_banner_image_url_default_language_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().large_branded_banner_image_url.as_mut().unwrap().default_language.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tv-high-image-url" => { - request_branding_settings_image_large_branded_banner_image_url_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tv_high_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.background-image-url.default" => { - request_branding_settings_image_background_image_url_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().background_image_url.as_mut().unwrap().default = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.background-image-url.default-language.value" => { - request_branding_settings_image_background_image_url_default_language_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().background_image_url.as_mut().unwrap().default_language.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.small-branded-banner-image-imap-script.default" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_imap_script.as_mut().unwrap().default = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.small-branded-banner-image-imap-script.default-language.value" => { - request_branding_settings_image_small_branded_banner_image_imap_script_default_language_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().small_branded_banner_image_imap_script.as_mut().unwrap().default_language.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-external-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_external_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.watch-icon-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().watch_icon_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tv-medium-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tv_medium_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-mobile-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_mobile_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tablet-hd-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tablet_hd_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tablet-low-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tablet_low_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.tracking-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().tracking_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-mobile-extra-hd-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_mobile_extra_hd_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tablet-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tablet_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-mobile-low-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_mobile_low_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-mobile-medium-hd-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_mobile_medium_hd_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-tablet-extra-hd-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_tablet_extra_hd_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.image.banner-mobile-hd-image-url" => { - request_branding_settings_image_small_branded_banner_image_imap_script_init(&mut request); - request.branding_settings.as_mut().unwrap().image.as_mut().unwrap().banner_mobile_hd_image_url = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.watch.text-color" => { - request_branding_settings_watch_init(&mut request); - request.branding_settings.as_mut().unwrap().watch.as_mut().unwrap().text_color = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.watch.featured-playlist-id" => { - request_branding_settings_watch_init(&mut request); - request.branding_settings.as_mut().unwrap().watch.as_mut().unwrap().featured_playlist_id = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.watch.background-color" => { - request_branding_settings_watch_init(&mut request); - request.branding_settings.as_mut().unwrap().watch.as_mut().unwrap().background_color = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.description" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.title" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.country" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().country = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.show-browse-view" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().show_browse_view = Some(arg_from_str(value.unwrap_or("false"), err, "branding-settings.channel.show-browse-view", "boolean")); - }, - "branding-settings.channel.featured-channels-title" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().featured_channels_title = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.default-language" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.unsubscribed-trailer" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().unsubscribed_trailer = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.keywords" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().keywords = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.profile-color" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().profile_color = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.default-tab" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().default_tab = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.moderate-comments" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().moderate_comments = Some(arg_from_str(value.unwrap_or("false"), err, "branding-settings.channel.moderate-comments", "boolean")); - }, - "branding-settings.channel.featured-channels-urls" => { - request_branding_settings_channel_init(&mut request); - if request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().featured_channels_urls.is_none() { - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().featured_channels_urls = Some(Default::default()); - } - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().featured_channels_urls.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.tracking-analytics-account-id" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().tracking_analytics_account_id = Some(value.unwrap_or("").to_string()); - }, - "branding-settings.channel.show-related-channels" => { - request_branding_settings_channel_init(&mut request); - request.branding_settings.as_mut().unwrap().channel.as_mut().unwrap().show_related_channels = Some(arg_from_str(value.unwrap_or("false"), err, "branding-settings.channel.show-related-channels", "boolean")); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "snippet.title" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.country" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().country = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_thumbnails_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.description" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "audit-details.community-guidelines-good-standing" => { - request_audit_details_init(&mut request); - request.audit_details.as_mut().unwrap().community_guidelines_good_standing = Some(arg_from_str(value.unwrap_or("false"), err, "audit-details.community-guidelines-good-standing", "boolean")); - }, - "audit-details.content-id-claims-good-standing" => { - request_audit_details_init(&mut request); - request.audit_details.as_mut().unwrap().content_id_claims_good_standing = Some(arg_from_str(value.unwrap_or("false"), err, "audit-details.content-id-claims-good-standing", "boolean")); - }, - "audit-details.overall-good-standing" => { - request_audit_details_init(&mut request); - request.audit_details.as_mut().unwrap().overall_good_standing = Some(arg_from_str(value.unwrap_or("false"), err, "audit-details.overall-good-standing", "boolean")); - }, - "audit-details.copyright-strikes-good-standing" => { - request_audit_details_init(&mut request); - request.audit_details.as_mut().unwrap().copyright_strikes_good_standing = Some(arg_from_str(value.unwrap_or("false"), err, "audit-details.copyright-strikes-good-standing", "boolean")); - }, - "etag" => { - request_audit_details_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_audit_details_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.channels().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _comment_threads_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CommentThread::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_snippet_init(request: &mut api::CommentThread) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_top_level_comment_init(request: &mut api::CommentThread) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().top_level_comment.is_none() { - request.snippet.as_mut().unwrap().top_level_comment = Some(Default::default()); - } - } - - fn request_snippet_top_level_comment_snippet_author_channel_id_init(request: &mut api::CommentThread) { - request_snippet_top_level_comment_snippet_init(request); - if request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_id.is_none() { - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_id = Some(Default::default()); - } - } - - fn request_snippet_top_level_comment_snippet_init(request: &mut api::CommentThread) { - request_snippet_top_level_comment_init(request); - if request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.is_none() { - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.is-public" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_public = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-public", "boolean")); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.video-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.can-reply" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().can_reply = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.can-reply", "boolean")); - }, - "snippet.total-reply-count" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().total_reply_count = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.total-reply-count", "integer")); - }, - "snippet.top-level-comment.snippet.author-channel-url" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.viewer-rating" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().viewer_rating = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-display-name" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_display_name = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.channel-id" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.video-id" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.published-at" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.like-count" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().like_count = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.top-level-comment.snippet.like-count", "integer")); - }, - "snippet.top-level-comment.snippet.text-original" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().text_original = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-channel-id.value" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.parent-id" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().parent_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.moderation-status" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().moderation_status = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.can-rate" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().can_rate = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.top-level-comment.snippet.can-rate", "boolean")); - }, - "snippet.top-level-comment.snippet.updated-at" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().updated_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-profile-image-url" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_profile_image_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-googleplus-profile-url" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_googleplus_profile_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.text-display" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().text_display = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.kind" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.etag" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.id" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_snippet_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.comment_threads().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "share-on-google-plus" => { - call = call.share_on_google_plus(arg_from_str(value.unwrap_or("false"), err, "share-on-google-plus", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _comment_threads_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.comment_threads().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "video-id" => { - call = call.video_id(value.unwrap_or("")); - }, - "text-format" => { - call = call.text_format(value.unwrap_or("")); - }, - "search-terms" => { - call = call.search_terms(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "moderation-status" => { - call = call.moderation_status(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "channel-id" => { - call = call.channel_id(value.unwrap_or("")); - }, - "all-threads-related-to-channel-id" => { - call = call.all_threads_related_to_channel_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _comment_threads_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::CommentThread::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_snippet_init(request: &mut api::CommentThread) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_top_level_comment_init(request: &mut api::CommentThread) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().top_level_comment.is_none() { - request.snippet.as_mut().unwrap().top_level_comment = Some(Default::default()); - } - } - - fn request_snippet_top_level_comment_snippet_author_channel_id_init(request: &mut api::CommentThread) { - request_snippet_top_level_comment_snippet_init(request); - if request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_id.is_none() { - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_id = Some(Default::default()); - } - } - - fn request_snippet_top_level_comment_snippet_init(request: &mut api::CommentThread) { - request_snippet_top_level_comment_init(request); - if request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.is_none() { - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.is-public" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().is_public = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.is-public", "boolean")); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.video-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.can-reply" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().can_reply = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.can-reply", "boolean")); - }, - "snippet.total-reply-count" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().total_reply_count = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.total-reply-count", "integer")); - }, - "snippet.top-level-comment.snippet.author-channel-url" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.viewer-rating" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().viewer_rating = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-display-name" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_display_name = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.channel-id" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.video-id" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.published-at" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.like-count" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().like_count = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.top-level-comment.snippet.like-count", "integer")); - }, - "snippet.top-level-comment.snippet.text-original" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().text_original = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-channel-id.value" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_channel_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.parent-id" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().parent_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.moderation-status" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().moderation_status = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.can-rate" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().can_rate = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.top-level-comment.snippet.can-rate", "boolean")); - }, - "snippet.top-level-comment.snippet.updated-at" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().updated_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-profile-image-url" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_profile_image_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.author-googleplus-profile-url" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().author_googleplus_profile_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.snippet.text-display" => { - request_snippet_top_level_comment_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().snippet.as_mut().unwrap().text_display = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.kind" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.etag" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().etag = Some(value.unwrap_or("").to_string()); - }, - "snippet.top-level-comment.id" => { - request_snippet_top_level_comment_snippet_init(&mut request); - request.snippet.as_mut().unwrap().top_level_comment.as_mut().unwrap().id = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_snippet_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.comment_threads().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _comments_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.comments().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _comments_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Comment::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_snippet_author_channel_id_init(request: &mut api::Comment) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().author_channel_id.is_none() { - request.snippet.as_mut().unwrap().author_channel_id = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Comment) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.author-channel-url" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().author_channel_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.viewer-rating" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().viewer_rating = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-display-name" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().author_display_name = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.video-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.like-count" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().like_count = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.like-count", "integer")); - }, - "snippet.text-original" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().text_original = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-channel-id.value" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().author_channel_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "snippet.parent-id" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().parent_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.moderation-status" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().moderation_status = Some(value.unwrap_or("").to_string()); - }, - "snippet.can-rate" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().can_rate = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.can-rate", "boolean")); - }, - "snippet.updated-at" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().updated_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-profile-image-url" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().author_profile_image_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-googleplus-profile-url" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().author_googleplus_profile_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.text-display" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().text_display = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_snippet_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.comments().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _comments_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.comments().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "text-format" => { - call = call.text_format(value.unwrap_or("")); - }, - "parent-id" => { - call = call.parent_id(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _comments_mark_as_spam(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.comments().mark_as_spam(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _comments_set_moderation_status(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.comments().set_moderation_status(&self.opt.arg_id, &self.opt.arg_moderation_status); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "ban-author" => { - call = call.ban_author(arg_from_str(value.unwrap_or("false"), err, "ban-author", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _comments_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Comment::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_snippet_author_channel_id_init(request: &mut api::Comment) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().author_channel_id.is_none() { - request.snippet.as_mut().unwrap().author_channel_id = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Comment) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "snippet.author-channel-url" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().author_channel_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.viewer-rating" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().viewer_rating = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-display-name" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().author_display_name = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.video-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.like-count" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().like_count = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.like-count", "integer")); - }, - "snippet.text-original" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().text_original = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-channel-id.value" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().author_channel_id.as_mut().unwrap().value = Some(value.unwrap_or("").to_string()); - }, - "snippet.parent-id" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().parent_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.moderation-status" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().moderation_status = Some(value.unwrap_or("").to_string()); - }, - "snippet.can-rate" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().can_rate = Some(arg_from_str(value.unwrap_or("false"), err, "snippet.can-rate", "boolean")); - }, - "snippet.updated-at" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().updated_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-profile-image-url" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().author_profile_image_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.author-googleplus-profile-url" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().author_googleplus_profile_url = Some(value.unwrap_or("").to_string()); - }, - "snippet.text-display" => { - request_snippet_author_channel_id_init(&mut request); - request.snippet.as_mut().unwrap().text_display = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_snippet_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.comments().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _guide_categories_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.guide_categories().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "region-code" => { - call = call.region_code(value.unwrap_or("")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _i18n_languages_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.i18n_languages().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _i18n_regions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.i18n_regions().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_broadcasts_bind(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_broadcasts().bind(&self.opt.arg_id, &self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "stream-id" => { - call = call.stream_id(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_broadcasts_control(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_broadcasts().control(&self.opt.arg_id, &self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "walltime" => { - call = call.walltime(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "offset-time-ms" => { - call = call.offset_time_ms(value.unwrap_or("")); - }, - "display-slate" => { - call = call.display_slate(arg_from_str(value.unwrap_or("false"), err, "display-slate", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_broadcasts_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_broadcasts().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _live_broadcasts_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LiveBroadcast::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::LiveBroadcast) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_content_details_monitor_stream_init(request: &mut api::LiveBroadcast) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().monitor_stream.is_none() { - request.content_details.as_mut().unwrap().monitor_stream = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::LiveBroadcast) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::LiveBroadcast) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::LiveBroadcast) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.recording-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().recording_status = Some(value.unwrap_or("").to_string()); - }, - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "status.life-cycle-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().life_cycle_status = Some(value.unwrap_or("").to_string()); - }, - "status.is-default-broadcast" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().is_default_broadcast = Some(arg_from_str(value.unwrap_or("false"), err, "status.is-default-broadcast", "boolean")); - }, - "status.live-broadcast-priority" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().live_broadcast_priority = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.start-with-slate" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().start_with_slate = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.start-with-slate", "boolean")); - }, - "content-details.bound-stream-id" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().bound_stream_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.enable-embed" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_embed = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-embed", "boolean")); - }, - "content-details.enable-closed-captions" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_closed_captions = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-closed-captions", "boolean")); - }, - "content-details.enable-content-encryption" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_content_encryption = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-content-encryption", "boolean")); - }, - "content-details.record-from-start" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().record_from_start = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.record-from-start", "boolean")); - }, - "content-details.enable-dvr" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_dvr = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-dvr", "boolean")); - }, - "content-details.monitor-stream.broadcast-stream-delay-ms" => { - request_content_details_monitor_stream_init(&mut request); - request.content_details.as_mut().unwrap().monitor_stream.as_mut().unwrap().broadcast_stream_delay_ms = Some(arg_from_str(value.unwrap_or("-0"), err, "content-details.monitor-stream.broadcast-stream-delay-ms", "integer")); - }, - "content-details.monitor-stream.embed-html" => { - request_content_details_monitor_stream_init(&mut request); - request.content_details.as_mut().unwrap().monitor_stream.as_mut().unwrap().embed_html = Some(value.unwrap_or("").to_string()); - }, - "content-details.monitor-stream.enable-monitor-stream" => { - request_content_details_monitor_stream_init(&mut request); - request.content_details.as_mut().unwrap().monitor_stream.as_mut().unwrap().enable_monitor_stream = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.monitor-stream.enable-monitor-stream", "boolean")); - }, - "snippet.actual-end-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().actual_end_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.scheduled-start-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().scheduled_start_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.actual-start-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().actual_start_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.scheduled-end-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().scheduled_end_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.live_broadcasts().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_broadcasts_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_broadcasts().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "broadcast-status" => { - call = call.broadcast_status(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_broadcasts_transition(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_broadcasts().transition(&self.opt.arg_broadcast_status, &self.opt.arg_id, &self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_broadcasts_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LiveBroadcast::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::LiveBroadcast) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_content_details_monitor_stream_init(request: &mut api::LiveBroadcast) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().monitor_stream.is_none() { - request.content_details.as_mut().unwrap().monitor_stream = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::LiveBroadcast) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::LiveBroadcast) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::LiveBroadcast) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::LiveBroadcast) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.recording-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().recording_status = Some(value.unwrap_or("").to_string()); - }, - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "status.life-cycle-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().life_cycle_status = Some(value.unwrap_or("").to_string()); - }, - "status.is-default-broadcast" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().is_default_broadcast = Some(arg_from_str(value.unwrap_or("false"), err, "status.is-default-broadcast", "boolean")); - }, - "status.live-broadcast-priority" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().live_broadcast_priority = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.start-with-slate" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().start_with_slate = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.start-with-slate", "boolean")); - }, - "content-details.bound-stream-id" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().bound_stream_id = Some(value.unwrap_or("").to_string()); - }, - "content-details.enable-embed" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_embed = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-embed", "boolean")); - }, - "content-details.enable-closed-captions" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_closed_captions = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-closed-captions", "boolean")); - }, - "content-details.enable-content-encryption" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_content_encryption = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-content-encryption", "boolean")); - }, - "content-details.record-from-start" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().record_from_start = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.record-from-start", "boolean")); - }, - "content-details.enable-dvr" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().enable_dvr = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.enable-dvr", "boolean")); - }, - "content-details.monitor-stream.broadcast-stream-delay-ms" => { - request_content_details_monitor_stream_init(&mut request); - request.content_details.as_mut().unwrap().monitor_stream.as_mut().unwrap().broadcast_stream_delay_ms = Some(arg_from_str(value.unwrap_or("-0"), err, "content-details.monitor-stream.broadcast-stream-delay-ms", "integer")); - }, - "content-details.monitor-stream.embed-html" => { - request_content_details_monitor_stream_init(&mut request); - request.content_details.as_mut().unwrap().monitor_stream.as_mut().unwrap().embed_html = Some(value.unwrap_or("").to_string()); - }, - "content-details.monitor-stream.enable-monitor-stream" => { - request_content_details_monitor_stream_init(&mut request); - request.content_details.as_mut().unwrap().monitor_stream.as_mut().unwrap().enable_monitor_stream = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.monitor-stream.enable-monitor-stream", "boolean")); - }, - "snippet.actual-end-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().actual_end_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.scheduled-start-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().scheduled_start_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.actual-start-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().actual_start_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.scheduled-end-time" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().scheduled_end_time = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.live_broadcasts().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_streams_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_streams().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _live_streams_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LiveStream::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_cdn_ingestion_info_init(request: &mut api::LiveStream) { - request_cdn_init(request); - if request.cdn.as_mut().unwrap().ingestion_info.is_none() { - request.cdn.as_mut().unwrap().ingestion_info = Some(Default::default()); - } - } - - fn request_cdn_init(request: &mut api::LiveStream) { - if request.cdn.is_none() { - request.cdn = Some(Default::default()); - } - } - - fn request_content_details_init(request: &mut api::LiveStream) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::LiveStream) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::LiveStream) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.is-default-stream" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().is_default_stream = Some(arg_from_str(value.unwrap_or("false"), err, "status.is-default-stream", "boolean")); - }, - "status.stream-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().stream_status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.is-reusable" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().is_reusable = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.is-reusable", "boolean")); - }, - "content-details.closed-captions-ingestion-url" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().closed_captions_ingestion_url = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-type" => { - request_cdn_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_type = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-info.backup-ingestion-address" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_info.as_mut().unwrap().backup_ingestion_address = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-info.stream-name" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_info.as_mut().unwrap().stream_name = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-info.ingestion-address" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_info.as_mut().unwrap().ingestion_address = Some(value.unwrap_or("").to_string()); - }, - "cdn.format" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().format = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.live_streams().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_streams_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.live_streams().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _live_streams_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::LiveStream::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_cdn_ingestion_info_init(request: &mut api::LiveStream) { - request_cdn_init(request); - if request.cdn.as_mut().unwrap().ingestion_info.is_none() { - request.cdn.as_mut().unwrap().ingestion_info = Some(Default::default()); - } - } - - fn request_cdn_init(request: &mut api::LiveStream) { - if request.cdn.is_none() { - request.cdn = Some(Default::default()); - } - } - - fn request_content_details_init(request: &mut api::LiveStream) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::LiveStream) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::LiveStream) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.is-default-stream" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().is_default_stream = Some(arg_from_str(value.unwrap_or("false"), err, "status.is-default-stream", "boolean")); - }, - "status.stream-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().stream_status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.is-reusable" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().is_reusable = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.is-reusable", "boolean")); - }, - "content-details.closed-captions-ingestion-url" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().closed_captions_ingestion_url = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-type" => { - request_cdn_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_type = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-info.backup-ingestion-address" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_info.as_mut().unwrap().backup_ingestion_address = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-info.stream-name" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_info.as_mut().unwrap().stream_name = Some(value.unwrap_or("").to_string()); - }, - "cdn.ingestion-info.ingestion-address" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().ingestion_info.as_mut().unwrap().ingestion_address = Some(value.unwrap_or("").to_string()); - }, - "cdn.format" => { - request_cdn_ingestion_info_init(&mut request); - request.cdn.as_mut().unwrap().format = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.live_streams().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _playlist_items_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.playlist_items().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _playlist_items_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlaylistItem::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::PlaylistItem) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::PlaylistItem) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_resource_id_init(request: &mut api::PlaylistItem) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().resource_id.is_none() { - request.snippet.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::PlaylistItem) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::PlaylistItem) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.note" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().note = Some(value.unwrap_or("").to_string()); - }, - "content-details.start-at" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().start_at = Some(value.unwrap_or("").to_string()); - }, - "content-details.end-at" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().end_at = Some(value.unwrap_or("").to_string()); - }, - "content-details.video-id" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.playlist-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.kind" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.channel-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.playlist-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.video-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.position" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().position = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.position", "integer")); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.playlist_items().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _playlist_items_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.playlist_items().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "video-id" => { - call = call.video_id(value.unwrap_or("")); - }, - "playlist-id" => { - call = call.playlist_id(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _playlist_items_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::PlaylistItem::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::PlaylistItem) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::PlaylistItem) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_resource_id_init(request: &mut api::PlaylistItem) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().resource_id.is_none() { - request.snippet.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::PlaylistItem) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::PlaylistItem) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::PlaylistItem) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.note" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().note = Some(value.unwrap_or("").to_string()); - }, - "content-details.start-at" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().start_at = Some(value.unwrap_or("").to_string()); - }, - "content-details.end-at" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().end_at = Some(value.unwrap_or("").to_string()); - }, - "content-details.video-id" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.playlist-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.kind" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.channel-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.playlist-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.video-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.position" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().position = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.position", "integer")); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.playlist_items().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _playlists_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.playlists().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _playlists_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Playlist::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::Playlist) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_player_init(request: &mut api::Playlist) { - if request.player.is_none() { - request.player = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Playlist) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::Playlist) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Playlist) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::Playlist) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.item-count" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().item_count = Some(arg_from_str(value.unwrap_or("-0"), err, "content-details.item-count", "integer")); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.tags" => { - request_snippet_init(&mut request); - if request.snippet.as_mut().unwrap().tags.is_none() { - request.snippet.as_mut().unwrap().tags = Some(Default::default()); - } - request.snippet.as_mut().unwrap().tags.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.description" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "player.embed-html" => { - request_player_init(&mut request); - request.player.as_mut().unwrap().embed_html = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_player_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_player_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.playlists().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _playlists_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.playlists().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "channel-id" => { - call = call.channel_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _playlists_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Playlist::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::Playlist) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_player_init(request: &mut api::Playlist) { - if request.player.is_none() { - request.player = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Playlist) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::Playlist) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Playlist) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Playlist) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::Playlist) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "kind" => { - request_status_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.item-count" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().item_count = Some(arg_from_str(value.unwrap_or("-0"), err, "content-details.item-count", "integer")); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.tags" => { - request_snippet_init(&mut request); - if request.snippet.as_mut().unwrap().tags.is_none() { - request.snippet.as_mut().unwrap().tags = Some(Default::default()); - } - request.snippet.as_mut().unwrap().tags.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.description" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "player.embed-html" => { - request_player_init(&mut request); - request.player.as_mut().unwrap().embed_html = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_player_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "id" => { - request_player_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.playlists().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _search_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.search().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "video-type" => { - call = call.video_type(value.unwrap_or("")); - }, - "video-syndicated" => { - call = call.video_syndicated(value.unwrap_or("")); - }, - "video-license" => { - call = call.video_license(value.unwrap_or("")); - }, - "video-embeddable" => { - call = call.video_embeddable(value.unwrap_or("")); - }, - "video-duration" => { - call = call.video_duration(value.unwrap_or("")); - }, - "video-dimension" => { - call = call.video_dimension(value.unwrap_or("")); - }, - "video-definition" => { - call = call.video_definition(value.unwrap_or("")); - }, - "video-category-id" => { - call = call.video_category_id(value.unwrap_or("")); - }, - "video-caption" => { - call = call.video_caption(value.unwrap_or("")); - }, - "type" => { - call = call.type_(value.unwrap_or("")); - }, - "topic-id" => { - call = call.topic_id(value.unwrap_or("")); - }, - "safe-search" => { - call = call.safe_search(value.unwrap_or("")); - }, - "relevance-language" => { - call = call.relevance_language(value.unwrap_or("")); - }, - "related-to-video-id" => { - call = call.related_to_video_id(value.unwrap_or("")); - }, - "region-code" => { - call = call.region_code(value.unwrap_or("")); - }, - "q" => { - call = call.q(value.unwrap_or("")); - }, - "published-before" => { - call = call.published_before(value.unwrap_or("")); - }, - "published-after" => { - call = call.published_after(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "order" => { - call = call.order(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "location-radius" => { - call = call.location_radius(value.unwrap_or("")); - }, - "location" => { - call = call.location(value.unwrap_or("")); - }, - "for-mine" => { - call = call.for_mine(arg_from_str(value.unwrap_or("false"), err, "for-mine", "boolean")); - }, - "for-developer" => { - call = call.for_developer(arg_from_str(value.unwrap_or("false"), err, "for-developer", "boolean")); - }, - "for-content-owner" => { - call = call.for_content_owner(arg_from_str(value.unwrap_or("false"), err, "for-content-owner", "boolean")); - }, - "event-type" => { - call = call.event_type(value.unwrap_or("")); - }, - "channel-type" => { - call = call.channel_type(value.unwrap_or("")); - }, - "channel-id" => { - call = call.channel_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subscriptions_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.subscriptions().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _subscriptions_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Subscription::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_content_details_init(request: &mut api::Subscription) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Subscription) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_resource_id_init(request: &mut api::Subscription) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().resource_id.is_none() { - request.snippet.as_mut().unwrap().resource_id = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Subscription) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Subscription) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Subscription) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Subscription) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Subscription) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Subscription) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_subscriber_snippet_init(request: &mut api::Subscription) { - if request.subscriber_snippet.is_none() { - request.subscriber_snippet = Some(Default::default()); - } - } - - fn request_subscriber_snippet_thumbnails_default_init(request: &mut api::Subscription) { - request_subscriber_snippet_thumbnails_init(request); - if request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_subscriber_snippet_thumbnails_high_init(request: &mut api::Subscription) { - request_subscriber_snippet_thumbnails_init(request); - if request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_subscriber_snippet_thumbnails_init(request: &mut api::Subscription) { - request_subscriber_snippet_init(request); - if request.subscriber_snippet.as_mut().unwrap().thumbnails.is_none() { - request.subscriber_snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_subscriber_snippet_thumbnails_maxres_init(request: &mut api::Subscription) { - request_subscriber_snippet_thumbnails_init(request); - if request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_subscriber_snippet_thumbnails_medium_init(request: &mut api::Subscription) { - request_subscriber_snippet_thumbnails_init(request); - if request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_subscriber_snippet_thumbnails_standard_init(request: &mut api::Subscription) { - request_subscriber_snippet_thumbnails_init(request); - if request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "kind" => { - request.kind = Some(value.unwrap_or("").to_string()); - }, - "content-details.new-item-count" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().new_item_count = Some(arg_from_str(value.unwrap_or("-0"), err, "content-details.new-item-count", "integer")); - }, - "content-details.activity-type" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().activity_type = Some(value.unwrap_or("").to_string()); - }, - "content-details.total-item-count" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().total_item_count = Some(arg_from_str(value.unwrap_or("-0"), err, "content-details.total-item-count", "integer")); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.kind" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().kind = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.channel-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.playlist-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().playlist_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.resource-id.video-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().resource_id.as_mut().unwrap().video_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_resource_id_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "etag" => { - request_snippet_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.title" => { - request_subscriber_snippet_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.channel-id" => { - request_subscriber_snippet_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.description" => { - request_subscriber_snippet_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.thumbnails.default.url" => { - request_subscriber_snippet_thumbnails_default_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.thumbnails.default.width" => { - request_subscriber_snippet_thumbnails_default_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.default.width", "integer")); - }, - "subscriber-snippet.thumbnails.default.height" => { - request_subscriber_snippet_thumbnails_default_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.default.height", "integer")); - }, - "subscriber-snippet.thumbnails.high.url" => { - request_subscriber_snippet_thumbnails_high_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.thumbnails.high.width" => { - request_subscriber_snippet_thumbnails_high_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.high.width", "integer")); - }, - "subscriber-snippet.thumbnails.high.height" => { - request_subscriber_snippet_thumbnails_high_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.high.height", "integer")); - }, - "subscriber-snippet.thumbnails.medium.url" => { - request_subscriber_snippet_thumbnails_medium_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.thumbnails.medium.width" => { - request_subscriber_snippet_thumbnails_medium_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.medium.width", "integer")); - }, - "subscriber-snippet.thumbnails.medium.height" => { - request_subscriber_snippet_thumbnails_medium_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.medium.height", "integer")); - }, - "subscriber-snippet.thumbnails.maxres.url" => { - request_subscriber_snippet_thumbnails_maxres_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.thumbnails.maxres.width" => { - request_subscriber_snippet_thumbnails_maxres_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.maxres.width", "integer")); - }, - "subscriber-snippet.thumbnails.maxres.height" => { - request_subscriber_snippet_thumbnails_maxres_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.maxres.height", "integer")); - }, - "subscriber-snippet.thumbnails.standard.url" => { - request_subscriber_snippet_thumbnails_standard_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "subscriber-snippet.thumbnails.standard.width" => { - request_subscriber_snippet_thumbnails_standard_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.standard.width", "integer")); - }, - "subscriber-snippet.thumbnails.standard.height" => { - request_subscriber_snippet_thumbnails_standard_init(&mut request); - request.subscriber_snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "subscriber-snippet.thumbnails.standard.height", "integer")); - }, - "id" => { - request_subscriber_snippet_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.subscriptions().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _subscriptions_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.subscriptions().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "order" => { - call = call.order(value.unwrap_or("")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "my-subscribers" => { - call = call.my_subscribers(arg_from_str(value.unwrap_or("false"), err, "my-subscribers", "boolean")); - }, - "mine" => { - call = call.mine(arg_from_str(value.unwrap_or("false"), err, "mine", "boolean")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "for-channel-id" => { - call = call.for_channel_id(value.unwrap_or("")); - }, - "channel-id" => { - call = call.channel_id(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _thumbnails_set(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.thumbnails().set(&self.opt.arg_video_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _video_abuse_report_reasons_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.video_abuse_report_reasons().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _video_categories_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.video_categories().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "region-code" => { - call = call.region_code(value.unwrap_or("")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _videos_delete(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.videos().delete(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _videos_get_rating(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.videos().get_rating(&self.opt.arg_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _videos_insert(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Video::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_age_gating_init(request: &mut api::Video) { - if request.age_gating.is_none() { - request.age_gating = Some(Default::default()); - } - } - - fn request_content_details_content_rating_init(request: &mut api::Video) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().content_rating.is_none() { - request.content_details.as_mut().unwrap().content_rating = Some(Default::default()); - } - } - - fn request_content_details_country_restriction_init(request: &mut api::Video) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().country_restriction.is_none() { - request.content_details.as_mut().unwrap().country_restriction = Some(Default::default()); - } - } - - fn request_content_details_init(request: &mut api::Video) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_content_details_region_restriction_init(request: &mut api::Video) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().region_restriction.is_none() { - request.content_details.as_mut().unwrap().region_restriction = Some(Default::default()); - } - } - - fn request_file_details_init(request: &mut api::Video) { - if request.file_details.is_none() { - request.file_details = Some(Default::default()); - } - } - - fn request_file_details_recording_location_init(request: &mut api::Video) { - request_file_details_init(request); - if request.file_details.as_mut().unwrap().recording_location.is_none() { - request.file_details.as_mut().unwrap().recording_location = Some(Default::default()); - } - } - - fn request_live_streaming_details_init(request: &mut api::Video) { - if request.live_streaming_details.is_none() { - request.live_streaming_details = Some(Default::default()); - } - } - - fn request_monetization_details_access_init(request: &mut api::Video) { - request_monetization_details_init(request); - if request.monetization_details.as_mut().unwrap().access.is_none() { - request.monetization_details.as_mut().unwrap().access = Some(Default::default()); - } - } - - fn request_monetization_details_init(request: &mut api::Video) { - if request.monetization_details.is_none() { - request.monetization_details = Some(Default::default()); - } - } - - fn request_player_init(request: &mut api::Video) { - if request.player.is_none() { - request.player = Some(Default::default()); - } - } - - fn request_processing_details_init(request: &mut api::Video) { - if request.processing_details.is_none() { - request.processing_details = Some(Default::default()); - } - } - - fn request_processing_details_processing_progress_init(request: &mut api::Video) { - request_processing_details_init(request); - if request.processing_details.as_mut().unwrap().processing_progress.is_none() { - request.processing_details.as_mut().unwrap().processing_progress = Some(Default::default()); - } - } - - fn request_project_details_init(request: &mut api::Video) { - if request.project_details.is_none() { - request.project_details = Some(Default::default()); - } - } - - fn request_recording_details_init(request: &mut api::Video) { - if request.recording_details.is_none() { - request.recording_details = Some(Default::default()); - } - } - - fn request_recording_details_location_init(request: &mut api::Video) { - request_recording_details_init(request); - if request.recording_details.as_mut().unwrap().location.is_none() { - request.recording_details.as_mut().unwrap().location = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Video) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::Video) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Video) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_statistics_init(request: &mut api::Video) { - if request.statistics.is_none() { - request.statistics = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::Video) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - fn request_suggestions_init(request: &mut api::Video) { - if request.suggestions.is_none() { - request.suggestions = Some(Default::default()); - } - } - - fn request_topic_details_init(request: &mut api::Video) { - if request.topic_details.is_none() { - request.topic_details = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.license" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().license = Some(value.unwrap_or("").to_string()); - }, - "status.embeddable" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().embeddable = Some(arg_from_str(value.unwrap_or("false"), err, "status.embeddable", "boolean")); - }, - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "status.publish-at" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().publish_at = Some(value.unwrap_or("").to_string()); - }, - "status.public-stats-viewable" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().public_stats_viewable = Some(arg_from_str(value.unwrap_or("false"), err, "status.public-stats-viewable", "boolean")); - }, - "status.upload-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().upload_status = Some(value.unwrap_or("").to_string()); - }, - "status.rejection-reason" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().rejection_reason = Some(value.unwrap_or("").to_string()); - }, - "status.failure-reason" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().failure_reason = Some(value.unwrap_or("").to_string()); - }, - "topic-details.topic-ids" => { - request_topic_details_init(&mut request); - if request.topic_details.as_mut().unwrap().topic_ids.is_none() { - request.topic_details.as_mut().unwrap().topic_ids = Some(Default::default()); - } - request.topic_details.as_mut().unwrap().topic_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "topic-details.relevant-topic-ids" => { - request_topic_details_init(&mut request); - if request.topic_details.as_mut().unwrap().relevant_topic_ids.is_none() { - request.topic_details.as_mut().unwrap().relevant_topic_ids = Some(Default::default()); - } - request.topic_details.as_mut().unwrap().relevant_topic_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_topic_details_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "statistics.comment-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().comment_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.comment-count", "int64")); - }, - "statistics.view-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().view_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.view-count", "int64")); - }, - "statistics.favorite-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().favorite_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.favorite-count", "int64")); - }, - "statistics.dislike-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().dislike_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.dislike-count", "int64")); - }, - "statistics.like-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().like_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.like-count", "int64")); - }, - "content-details.definition" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().definition = Some(value.unwrap_or("").to_string()); - }, - "content-details.country-restriction.exception" => { - request_content_details_country_restriction_init(&mut request); - if request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().exception.is_none() { - request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().exception = Some(Default::default()); - } - request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().exception.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.country-restriction.allowed" => { - request_content_details_country_restriction_init(&mut request); - request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().allowed = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.country-restriction.allowed", "boolean")); - }, - "content-details.content-rating.yt-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().yt_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.catvfr-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().catvfr_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cbfc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cbfc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.bfvc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().bfvc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mda-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mda_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.acb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().acb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nfvcb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nfvcb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.bmukk-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().bmukk_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.chfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().chfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.resorteviolencia-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().resorteviolencia_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.csa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().csa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.moctw-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().moctw_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.anatel-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().anatel_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.catv-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().catv_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.pefilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().pefilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.djctq-rating-reasons" => { - request_content_details_content_rating_init(&mut request); - if request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating_reasons.is_none() { - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating_reasons = Some(Default::default()); - } - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating_reasons.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.incaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().incaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.oflc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().oflc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fpb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fpb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mccaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mccaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.tvpg-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().tvpg_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.rtc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().rtc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cscf-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cscf_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fsk-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fsk_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.bbfc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().bbfc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.kmrb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().kmrb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.smsa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().smsa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.egfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().egfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cicf-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cicf_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nbcpl-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nbcpl_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nbc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nbc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.djctq-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.ifco-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().ifco_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fco-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fco_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.eefilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().eefilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.medietilsynet-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().medietilsynet_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.grfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().grfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.ccc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().ccc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.rte-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().rte_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.czfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().czfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.lsf-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().lsf_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fmoc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fmoc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.eirin-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().eirin_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cce-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cce_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nkclv-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nkclv_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mtrcb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mtrcb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mibac-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mibac_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.ilfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().ilfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.smais-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().smais_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.russia-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().russia_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mpaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mpaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.kfcb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().kfcb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.agcom-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().agcom_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.chvrs-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().chvrs_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cna-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cna_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.icaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().icaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mccyp-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mccyp_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nfrc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nfrc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.skfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().skfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.moc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().moc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.rcnof-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().rcnof_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.meku-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().meku_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fcbm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fcbm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.kijkwijzer-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().kijkwijzer_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.caption" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().caption = Some(value.unwrap_or("").to_string()); - }, - "content-details.region-restriction.blocked" => { - request_content_details_region_restriction_init(&mut request); - if request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().blocked.is_none() { - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().blocked = Some(Default::default()); - } - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().blocked.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.region-restriction.allowed" => { - request_content_details_region_restriction_init(&mut request); - if request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().allowed.is_none() { - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().allowed = Some(Default::default()); - } - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().allowed.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.duration" => { - request_content_details_region_restriction_init(&mut request); - request.content_details.as_mut().unwrap().duration = Some(value.unwrap_or("").to_string()); - }, - "content-details.licensed-content" => { - request_content_details_region_restriction_init(&mut request); - request.content_details.as_mut().unwrap().licensed_content = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.licensed-content", "boolean")); - }, - "content-details.dimension" => { - request_content_details_region_restriction_init(&mut request); - request.content_details.as_mut().unwrap().dimension = Some(value.unwrap_or("").to_string()); - }, - "monetization-details.access.exception" => { - request_monetization_details_access_init(&mut request); - if request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().exception.is_none() { - request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().exception = Some(Default::default()); - } - request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().exception.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "monetization-details.access.allowed" => { - request_monetization_details_access_init(&mut request); - request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().allowed = Some(arg_from_str(value.unwrap_or("false"), err, "monetization-details.access.allowed", "boolean")); - }, - "age-gating.restricted" => { - request_age_gating_init(&mut request); - request.age_gating.as_mut().unwrap().restricted = Some(arg_from_str(value.unwrap_or("false"), err, "age-gating.restricted", "boolean")); - }, - "age-gating.alcohol-content" => { - request_age_gating_init(&mut request); - request.age_gating.as_mut().unwrap().alcohol_content = Some(arg_from_str(value.unwrap_or("false"), err, "age-gating.alcohol-content", "boolean")); - }, - "age-gating.video-game-rating" => { - request_age_gating_init(&mut request); - request.age_gating.as_mut().unwrap().video_game_rating = Some(value.unwrap_or("").to_string()); - }, - "suggestions.processing-errors" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().processing_errors.is_none() { - request.suggestions.as_mut().unwrap().processing_errors = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().processing_errors.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "suggestions.editor-suggestions" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().editor_suggestions.is_none() { - request.suggestions.as_mut().unwrap().editor_suggestions = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().editor_suggestions.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "suggestions.processing-warnings" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().processing_warnings.is_none() { - request.suggestions.as_mut().unwrap().processing_warnings = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().processing_warnings.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "suggestions.processing-hints" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().processing_hints.is_none() { - request.suggestions.as_mut().unwrap().processing_hints = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().processing_hints.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "live-streaming-details.concurrent-viewers" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().concurrent_viewers = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.scheduled-start-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().scheduled_start_time = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.scheduled-end-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().scheduled_end_time = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.actual-start-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().actual_start_time = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.actual-end-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().actual_end_time = Some(value.unwrap_or("").to_string()); - }, - "file-details.bitrate-bps" => { - request_file_details_init(&mut request); - request.file_details.as_mut().unwrap().bitrate_bps = Some(value.unwrap_or("").to_string()); - }, - "file-details.container" => { - request_file_details_init(&mut request); - request.file_details.as_mut().unwrap().container = Some(value.unwrap_or("").to_string()); - }, - "file-details.recording-location.latitude" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().recording_location.as_mut().unwrap().latitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "file-details.recording-location.latitude", "number")); - }, - "file-details.recording-location.altitude" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().recording_location.as_mut().unwrap().altitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "file-details.recording-location.altitude", "number")); - }, - "file-details.recording-location.longitude" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().recording_location.as_mut().unwrap().longitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "file-details.recording-location.longitude", "number")); - }, - "file-details.file-type" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().file_type = Some(value.unwrap_or("").to_string()); - }, - "file-details.creation-time" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().creation_time = Some(value.unwrap_or("").to_string()); - }, - "file-details.duration-ms" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().duration_ms = Some(value.unwrap_or("").to_string()); - }, - "file-details.file-name" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().file_name = Some(value.unwrap_or("").to_string()); - }, - "file-details.file-size" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().file_size = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.tags" => { - request_snippet_init(&mut request); - if request.snippet.as_mut().unwrap().tags.is_none() { - request.snippet.as_mut().unwrap().tags = Some(Default::default()); - } - request.snippet.as_mut().unwrap().tags.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.live-broadcast-content" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().live_broadcast_content = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.category-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().category_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.description" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "player.embed-html" => { - request_player_init(&mut request); - request.player.as_mut().unwrap().embed_html = Some(value.unwrap_or("").to_string()); - }, - "processing-details.file-details-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().file_details_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.editor-suggestions-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().editor_suggestions_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-status" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().processing_status = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-issues-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().processing_issues_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-failure-reason" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().processing_failure_reason = Some(value.unwrap_or("").to_string()); - }, - "processing-details.thumbnails-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().thumbnails_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-progress.time-left-ms" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().processing_progress.as_mut().unwrap().time_left_ms = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-progress.parts-processed" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().processing_progress.as_mut().unwrap().parts_processed = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-progress.parts-total" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().processing_progress.as_mut().unwrap().parts_total = Some(value.unwrap_or("").to_string()); - }, - "processing-details.tag-suggestions-availability" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().tag_suggestions_availability = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_processing_details_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "project-details.tags" => { - request_project_details_init(&mut request); - if request.project_details.as_mut().unwrap().tags.is_none() { - request.project_details.as_mut().unwrap().tags = Some(Default::default()); - } - request.project_details.as_mut().unwrap().tags.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "recording-details.recording-date" => { - request_recording_details_init(&mut request); - request.recording_details.as_mut().unwrap().recording_date = Some(value.unwrap_or("").to_string()); - }, - "recording-details.location-description" => { - request_recording_details_init(&mut request); - request.recording_details.as_mut().unwrap().location_description = Some(value.unwrap_or("").to_string()); - }, - "recording-details.location.latitude" => { - request_recording_details_location_init(&mut request); - request.recording_details.as_mut().unwrap().location.as_mut().unwrap().latitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "recording-details.location.latitude", "number")); - }, - "recording-details.location.altitude" => { - request_recording_details_location_init(&mut request); - request.recording_details.as_mut().unwrap().location.as_mut().unwrap().altitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "recording-details.location.altitude", "number")); - }, - "recording-details.location.longitude" => { - request_recording_details_location_init(&mut request); - request.recording_details.as_mut().unwrap().location.as_mut().unwrap().longitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "recording-details.location.longitude", "number")); - }, - "id" => { - request_recording_details_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.videos().insert(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "stabilize" => { - call = call.stabilize(arg_from_str(value.unwrap_or("false"), err, "stabilize", "boolean")); - }, - "on-behalf-of-content-owner-channel" => { - call = call.on_behalf_of_content_owner_channel(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "notify-subscribers" => { - call = call.notify_subscribers(arg_from_str(value.unwrap_or("false"), err, "notify-subscribers", "boolean")); - }, - "auto-levels" => { - call = call.auto_levels(arg_from_str(value.unwrap_or("false"), err, "auto-levels", "boolean")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _videos_list(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.videos().list(&self.opt.arg_part); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "video-category-id" => { - call = call.video_category_id(value.unwrap_or("")); - }, - "region-code" => { - call = call.region_code(value.unwrap_or("")); - }, - "page-token" => { - call = call.page_token(value.unwrap_or("")); - }, - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "my-rating" => { - call = call.my_rating(value.unwrap_or("")); - }, - "max-results" => { - call = call.max_results(arg_from_str(value.unwrap_or("-0"), err, "max-results", "integer")); - }, - "locale" => { - call = call.locale(value.unwrap_or("")); - }, - "id" => { - call = call.id(value.unwrap_or("")); - }, - "hl" => { - call = call.hl(value.unwrap_or("")); - }, - "chart" => { - call = call.chart(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _videos_rate(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.videos().rate(&self.opt.arg_id, &self.opt.arg_rating); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _videos_report_abuse(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::VideoAbuseReport::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - match &temp_cursor.to_string()[..] { - "secondary-reason-id" => { - request.secondary_reason_id = Some(value.unwrap_or("").to_string()); - }, - "reason-id" => { - request.reason_id = Some(value.unwrap_or("").to_string()); - }, - "language" => { - request.language = Some(value.unwrap_or("").to_string()); - }, - "comments" => { - request.comments = Some(value.unwrap_or("").to_string()); - }, - "video-id" => { - request.video_id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.videos().report_abuse(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _videos_update(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::Video::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_age_gating_init(request: &mut api::Video) { - if request.age_gating.is_none() { - request.age_gating = Some(Default::default()); - } - } - - fn request_content_details_content_rating_init(request: &mut api::Video) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().content_rating.is_none() { - request.content_details.as_mut().unwrap().content_rating = Some(Default::default()); - } - } - - fn request_content_details_country_restriction_init(request: &mut api::Video) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().country_restriction.is_none() { - request.content_details.as_mut().unwrap().country_restriction = Some(Default::default()); - } - } - - fn request_content_details_init(request: &mut api::Video) { - if request.content_details.is_none() { - request.content_details = Some(Default::default()); - } - } - - fn request_content_details_region_restriction_init(request: &mut api::Video) { - request_content_details_init(request); - if request.content_details.as_mut().unwrap().region_restriction.is_none() { - request.content_details.as_mut().unwrap().region_restriction = Some(Default::default()); - } - } - - fn request_file_details_init(request: &mut api::Video) { - if request.file_details.is_none() { - request.file_details = Some(Default::default()); - } - } - - fn request_file_details_recording_location_init(request: &mut api::Video) { - request_file_details_init(request); - if request.file_details.as_mut().unwrap().recording_location.is_none() { - request.file_details.as_mut().unwrap().recording_location = Some(Default::default()); - } - } - - fn request_live_streaming_details_init(request: &mut api::Video) { - if request.live_streaming_details.is_none() { - request.live_streaming_details = Some(Default::default()); - } - } - - fn request_monetization_details_access_init(request: &mut api::Video) { - request_monetization_details_init(request); - if request.monetization_details.as_mut().unwrap().access.is_none() { - request.monetization_details.as_mut().unwrap().access = Some(Default::default()); - } - } - - fn request_monetization_details_init(request: &mut api::Video) { - if request.monetization_details.is_none() { - request.monetization_details = Some(Default::default()); - } - } - - fn request_player_init(request: &mut api::Video) { - if request.player.is_none() { - request.player = Some(Default::default()); - } - } - - fn request_processing_details_init(request: &mut api::Video) { - if request.processing_details.is_none() { - request.processing_details = Some(Default::default()); - } - } - - fn request_processing_details_processing_progress_init(request: &mut api::Video) { - request_processing_details_init(request); - if request.processing_details.as_mut().unwrap().processing_progress.is_none() { - request.processing_details.as_mut().unwrap().processing_progress = Some(Default::default()); - } - } - - fn request_project_details_init(request: &mut api::Video) { - if request.project_details.is_none() { - request.project_details = Some(Default::default()); - } - } - - fn request_recording_details_init(request: &mut api::Video) { - if request.recording_details.is_none() { - request.recording_details = Some(Default::default()); - } - } - - fn request_recording_details_location_init(request: &mut api::Video) { - request_recording_details_init(request); - if request.recording_details.as_mut().unwrap().location.is_none() { - request.recording_details.as_mut().unwrap().location = Some(Default::default()); - } - } - - fn request_snippet_init(request: &mut api::Video) { - if request.snippet.is_none() { - request.snippet = Some(Default::default()); - } - } - - fn request_snippet_localized_init(request: &mut api::Video) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().localized.is_none() { - request.snippet.as_mut().unwrap().localized = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_default_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_high_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_init(request: &mut api::Video) { - request_snippet_init(request); - if request.snippet.as_mut().unwrap().thumbnails.is_none() { - request.snippet.as_mut().unwrap().thumbnails = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_maxres_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_medium_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium = Some(Default::default()); - } - } - - fn request_snippet_thumbnails_standard_init(request: &mut api::Video) { - request_snippet_thumbnails_init(request); - if request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.is_none() { - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard = Some(Default::default()); - } - } - - fn request_statistics_init(request: &mut api::Video) { - if request.statistics.is_none() { - request.statistics = Some(Default::default()); - } - } - - fn request_status_init(request: &mut api::Video) { - if request.status.is_none() { - request.status = Some(Default::default()); - } - } - - fn request_suggestions_init(request: &mut api::Video) { - if request.suggestions.is_none() { - request.suggestions = Some(Default::default()); - } - } - - fn request_topic_details_init(request: &mut api::Video) { - if request.topic_details.is_none() { - request.topic_details = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "status.license" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().license = Some(value.unwrap_or("").to_string()); - }, - "status.embeddable" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().embeddable = Some(arg_from_str(value.unwrap_or("false"), err, "status.embeddable", "boolean")); - }, - "status.privacy-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().privacy_status = Some(value.unwrap_or("").to_string()); - }, - "status.publish-at" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().publish_at = Some(value.unwrap_or("").to_string()); - }, - "status.public-stats-viewable" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().public_stats_viewable = Some(arg_from_str(value.unwrap_or("false"), err, "status.public-stats-viewable", "boolean")); - }, - "status.upload-status" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().upload_status = Some(value.unwrap_or("").to_string()); - }, - "status.rejection-reason" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().rejection_reason = Some(value.unwrap_or("").to_string()); - }, - "status.failure-reason" => { - request_status_init(&mut request); - request.status.as_mut().unwrap().failure_reason = Some(value.unwrap_or("").to_string()); - }, - "topic-details.topic-ids" => { - request_topic_details_init(&mut request); - if request.topic_details.as_mut().unwrap().topic_ids.is_none() { - request.topic_details.as_mut().unwrap().topic_ids = Some(Default::default()); - } - request.topic_details.as_mut().unwrap().topic_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "topic-details.relevant-topic-ids" => { - request_topic_details_init(&mut request); - if request.topic_details.as_mut().unwrap().relevant_topic_ids.is_none() { - request.topic_details.as_mut().unwrap().relevant_topic_ids = Some(Default::default()); - } - request.topic_details.as_mut().unwrap().relevant_topic_ids.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "kind" => { - request_topic_details_init(&mut request); - request.kind = Some(value.unwrap_or("").to_string()); - }, - "statistics.comment-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().comment_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.comment-count", "int64")); - }, - "statistics.view-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().view_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.view-count", "int64")); - }, - "statistics.favorite-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().favorite_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.favorite-count", "int64")); - }, - "statistics.dislike-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().dislike_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.dislike-count", "int64")); - }, - "statistics.like-count" => { - request_statistics_init(&mut request); - request.statistics.as_mut().unwrap().like_count = Some(arg_from_str(value.unwrap_or("-0"), err, "statistics.like-count", "int64")); - }, - "content-details.definition" => { - request_content_details_init(&mut request); - request.content_details.as_mut().unwrap().definition = Some(value.unwrap_or("").to_string()); - }, - "content-details.country-restriction.exception" => { - request_content_details_country_restriction_init(&mut request); - if request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().exception.is_none() { - request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().exception = Some(Default::default()); - } - request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().exception.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.country-restriction.allowed" => { - request_content_details_country_restriction_init(&mut request); - request.content_details.as_mut().unwrap().country_restriction.as_mut().unwrap().allowed = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.country-restriction.allowed", "boolean")); - }, - "content-details.content-rating.yt-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().yt_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.catvfr-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().catvfr_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cbfc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cbfc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.bfvc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().bfvc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mda-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mda_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.acb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().acb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nfvcb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nfvcb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.bmukk-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().bmukk_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.chfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().chfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.resorteviolencia-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().resorteviolencia_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.csa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().csa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.moctw-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().moctw_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.anatel-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().anatel_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.catv-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().catv_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.pefilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().pefilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.djctq-rating-reasons" => { - request_content_details_content_rating_init(&mut request); - if request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating_reasons.is_none() { - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating_reasons = Some(Default::default()); - } - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating_reasons.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.incaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().incaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.oflc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().oflc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fpb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fpb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mccaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mccaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.tvpg-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().tvpg_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.rtc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().rtc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cscf-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cscf_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fsk-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fsk_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.bbfc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().bbfc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.kmrb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().kmrb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.smsa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().smsa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.egfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().egfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cicf-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cicf_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nbcpl-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nbcpl_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nbc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nbc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.djctq-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().djctq_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.ifco-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().ifco_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fco-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fco_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.eefilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().eefilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.medietilsynet-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().medietilsynet_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.grfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().grfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.ccc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().ccc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.rte-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().rte_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.czfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().czfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.lsf-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().lsf_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fmoc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fmoc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.eirin-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().eirin_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cce-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cce_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nkclv-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nkclv_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mtrcb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mtrcb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mibac-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mibac_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.ilfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().ilfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.smais-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().smais_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.russia-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().russia_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mpaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mpaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.kfcb-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().kfcb_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.agcom-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().agcom_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.chvrs-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().chvrs_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.cna-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().cna_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.icaa-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().icaa_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.mccyp-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().mccyp_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.nfrc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().nfrc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.skfilm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().skfilm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.moc-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().moc_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.rcnof-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().rcnof_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.meku-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().meku_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.fcbm-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().fcbm_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.content-rating.kijkwijzer-rating" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().content_rating.as_mut().unwrap().kijkwijzer_rating = Some(value.unwrap_or("").to_string()); - }, - "content-details.caption" => { - request_content_details_content_rating_init(&mut request); - request.content_details.as_mut().unwrap().caption = Some(value.unwrap_or("").to_string()); - }, - "content-details.region-restriction.blocked" => { - request_content_details_region_restriction_init(&mut request); - if request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().blocked.is_none() { - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().blocked = Some(Default::default()); - } - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().blocked.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.region-restriction.allowed" => { - request_content_details_region_restriction_init(&mut request); - if request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().allowed.is_none() { - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().allowed = Some(Default::default()); - } - request.content_details.as_mut().unwrap().region_restriction.as_mut().unwrap().allowed.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "content-details.duration" => { - request_content_details_region_restriction_init(&mut request); - request.content_details.as_mut().unwrap().duration = Some(value.unwrap_or("").to_string()); - }, - "content-details.licensed-content" => { - request_content_details_region_restriction_init(&mut request); - request.content_details.as_mut().unwrap().licensed_content = Some(arg_from_str(value.unwrap_or("false"), err, "content-details.licensed-content", "boolean")); - }, - "content-details.dimension" => { - request_content_details_region_restriction_init(&mut request); - request.content_details.as_mut().unwrap().dimension = Some(value.unwrap_or("").to_string()); - }, - "monetization-details.access.exception" => { - request_monetization_details_access_init(&mut request); - if request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().exception.is_none() { - request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().exception = Some(Default::default()); - } - request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().exception.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "monetization-details.access.allowed" => { - request_monetization_details_access_init(&mut request); - request.monetization_details.as_mut().unwrap().access.as_mut().unwrap().allowed = Some(arg_from_str(value.unwrap_or("false"), err, "monetization-details.access.allowed", "boolean")); - }, - "age-gating.restricted" => { - request_age_gating_init(&mut request); - request.age_gating.as_mut().unwrap().restricted = Some(arg_from_str(value.unwrap_or("false"), err, "age-gating.restricted", "boolean")); - }, - "age-gating.alcohol-content" => { - request_age_gating_init(&mut request); - request.age_gating.as_mut().unwrap().alcohol_content = Some(arg_from_str(value.unwrap_or("false"), err, "age-gating.alcohol-content", "boolean")); - }, - "age-gating.video-game-rating" => { - request_age_gating_init(&mut request); - request.age_gating.as_mut().unwrap().video_game_rating = Some(value.unwrap_or("").to_string()); - }, - "suggestions.processing-errors" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().processing_errors.is_none() { - request.suggestions.as_mut().unwrap().processing_errors = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().processing_errors.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "suggestions.editor-suggestions" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().editor_suggestions.is_none() { - request.suggestions.as_mut().unwrap().editor_suggestions = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().editor_suggestions.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "suggestions.processing-warnings" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().processing_warnings.is_none() { - request.suggestions.as_mut().unwrap().processing_warnings = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().processing_warnings.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "suggestions.processing-hints" => { - request_suggestions_init(&mut request); - if request.suggestions.as_mut().unwrap().processing_hints.is_none() { - request.suggestions.as_mut().unwrap().processing_hints = Some(Default::default()); - } - request.suggestions.as_mut().unwrap().processing_hints.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "live-streaming-details.concurrent-viewers" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().concurrent_viewers = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.scheduled-start-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().scheduled_start_time = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.scheduled-end-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().scheduled_end_time = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.actual-start-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().actual_start_time = Some(value.unwrap_or("").to_string()); - }, - "live-streaming-details.actual-end-time" => { - request_live_streaming_details_init(&mut request); - request.live_streaming_details.as_mut().unwrap().actual_end_time = Some(value.unwrap_or("").to_string()); - }, - "file-details.bitrate-bps" => { - request_file_details_init(&mut request); - request.file_details.as_mut().unwrap().bitrate_bps = Some(value.unwrap_or("").to_string()); - }, - "file-details.container" => { - request_file_details_init(&mut request); - request.file_details.as_mut().unwrap().container = Some(value.unwrap_or("").to_string()); - }, - "file-details.recording-location.latitude" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().recording_location.as_mut().unwrap().latitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "file-details.recording-location.latitude", "number")); - }, - "file-details.recording-location.altitude" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().recording_location.as_mut().unwrap().altitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "file-details.recording-location.altitude", "number")); - }, - "file-details.recording-location.longitude" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().recording_location.as_mut().unwrap().longitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "file-details.recording-location.longitude", "number")); - }, - "file-details.file-type" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().file_type = Some(value.unwrap_or("").to_string()); - }, - "file-details.creation-time" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().creation_time = Some(value.unwrap_or("").to_string()); - }, - "file-details.duration-ms" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().duration_ms = Some(value.unwrap_or("").to_string()); - }, - "file-details.file-name" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().file_name = Some(value.unwrap_or("").to_string()); - }, - "file-details.file-size" => { - request_file_details_recording_location_init(&mut request); - request.file_details.as_mut().unwrap().file_size = Some(value.unwrap_or("").to_string()); - }, - "snippet.description" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.tags" => { - request_snippet_init(&mut request); - if request.snippet.as_mut().unwrap().tags.is_none() { - request.snippet.as_mut().unwrap().tags = Some(Default::default()); - } - request.snippet.as_mut().unwrap().tags.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "snippet.channel-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.published-at" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().published_at = Some(value.unwrap_or("").to_string()); - }, - "snippet.live-broadcast-content" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().live_broadcast_content = Some(value.unwrap_or("").to_string()); - }, - "snippet.default-language" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().default_language = Some(value.unwrap_or("").to_string()); - }, - "snippet.channel-title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().channel_title = Some(value.unwrap_or("").to_string()); - }, - "snippet.title" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.category-id" => { - request_snippet_init(&mut request); - request.snippet.as_mut().unwrap().category_id = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.description" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().description = Some(value.unwrap_or("").to_string()); - }, - "snippet.localized.title" => { - request_snippet_localized_init(&mut request); - request.snippet.as_mut().unwrap().localized.as_mut().unwrap().title = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.url" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.default.width" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.width", "integer")); - }, - "snippet.thumbnails.default.height" => { - request_snippet_thumbnails_default_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().default.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.default.height", "integer")); - }, - "snippet.thumbnails.high.url" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.high.width" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.width", "integer")); - }, - "snippet.thumbnails.high.height" => { - request_snippet_thumbnails_high_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().high.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.high.height", "integer")); - }, - "snippet.thumbnails.medium.url" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.medium.width" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.width", "integer")); - }, - "snippet.thumbnails.medium.height" => { - request_snippet_thumbnails_medium_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().medium.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.medium.height", "integer")); - }, - "snippet.thumbnails.maxres.url" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.maxres.width" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.width", "integer")); - }, - "snippet.thumbnails.maxres.height" => { - request_snippet_thumbnails_maxres_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().maxres.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.maxres.height", "integer")); - }, - "snippet.thumbnails.standard.url" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().url = Some(value.unwrap_or("").to_string()); - }, - "snippet.thumbnails.standard.width" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().width = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.width", "integer")); - }, - "snippet.thumbnails.standard.height" => { - request_snippet_thumbnails_standard_init(&mut request); - request.snippet.as_mut().unwrap().thumbnails.as_mut().unwrap().standard.as_mut().unwrap().height = Some(arg_from_str(value.unwrap_or("-0"), err, "snippet.thumbnails.standard.height", "integer")); - }, - "player.embed-html" => { - request_player_init(&mut request); - request.player.as_mut().unwrap().embed_html = Some(value.unwrap_or("").to_string()); - }, - "processing-details.file-details-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().file_details_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.editor-suggestions-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().editor_suggestions_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-status" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().processing_status = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-issues-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().processing_issues_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-failure-reason" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().processing_failure_reason = Some(value.unwrap_or("").to_string()); - }, - "processing-details.thumbnails-availability" => { - request_processing_details_init(&mut request); - request.processing_details.as_mut().unwrap().thumbnails_availability = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-progress.time-left-ms" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().processing_progress.as_mut().unwrap().time_left_ms = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-progress.parts-processed" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().processing_progress.as_mut().unwrap().parts_processed = Some(value.unwrap_or("").to_string()); - }, - "processing-details.processing-progress.parts-total" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().processing_progress.as_mut().unwrap().parts_total = Some(value.unwrap_or("").to_string()); - }, - "processing-details.tag-suggestions-availability" => { - request_processing_details_processing_progress_init(&mut request); - request.processing_details.as_mut().unwrap().tag_suggestions_availability = Some(value.unwrap_or("").to_string()); - }, - "etag" => { - request_processing_details_init(&mut request); - request.etag = Some(value.unwrap_or("").to_string()); - }, - "project-details.tags" => { - request_project_details_init(&mut request); - if request.project_details.as_mut().unwrap().tags.is_none() { - request.project_details.as_mut().unwrap().tags = Some(Default::default()); - } - request.project_details.as_mut().unwrap().tags.as_mut().unwrap().push(value.unwrap_or("").to_string()); - }, - "recording-details.recording-date" => { - request_recording_details_init(&mut request); - request.recording_details.as_mut().unwrap().recording_date = Some(value.unwrap_or("").to_string()); - }, - "recording-details.location-description" => { - request_recording_details_init(&mut request); - request.recording_details.as_mut().unwrap().location_description = Some(value.unwrap_or("").to_string()); - }, - "recording-details.location.latitude" => { - request_recording_details_location_init(&mut request); - request.recording_details.as_mut().unwrap().location.as_mut().unwrap().latitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "recording-details.location.latitude", "number")); - }, - "recording-details.location.altitude" => { - request_recording_details_location_init(&mut request); - request.recording_details.as_mut().unwrap().location.as_mut().unwrap().altitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "recording-details.location.altitude", "number")); - }, - "recording-details.location.longitude" => { - request_recording_details_location_init(&mut request); - request.recording_details.as_mut().unwrap().location.as_mut().unwrap().longitude = Some(arg_from_str(value.unwrap_or("0.0"), err, "recording-details.location.longitude", "number")); - }, - "id" => { - request_recording_details_init(&mut request); - request.id = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.videos().update(request); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out); - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok((mut response, output_schema)) => { - serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap(); - None - } - } - } - } - - fn _watermarks_set(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - - let mut request = api::InvideoBranding::default(); - let mut field_cursor = FieldCursor::default(); - for kvarg in self.opt.arg_kv.iter() { - let last_errc = err.issues.len(); - let (key, value) = parse_kv_arg(&*kvarg, err, false); - let mut temp_cursor = field_cursor.clone(); - if let Err(field_err) = temp_cursor.set(&*key) { - err.issues.push(field_err); - } - if value.is_none() { - field_cursor = temp_cursor.clone(); - if err.issues.len() > last_errc { - err.issues.remove(last_errc); - } - continue; - } - fn request_position_init(request: &mut api::InvideoBranding) { - if request.position.is_none() { - request.position = Some(Default::default()); - } - } - - fn request_timing_init(request: &mut api::InvideoBranding) { - if request.timing.is_none() { - request.timing = Some(Default::default()); - } - } - - match &temp_cursor.to_string()[..] { - "target-channel-id" => { - request.target_channel_id = Some(value.unwrap_or("").to_string()); - }, - "position.corner-position" => { - request_position_init(&mut request); - request.position.as_mut().unwrap().corner_position = Some(value.unwrap_or("").to_string()); - }, - "position.type" => { - request_position_init(&mut request); - request.position.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "image-url" => { - request_position_init(&mut request); - request.image_url = Some(value.unwrap_or("").to_string()); - }, - "timing.offset-ms" => { - request_timing_init(&mut request); - request.timing.as_mut().unwrap().offset_ms = Some(value.unwrap_or("").to_string()); - }, - "timing.type" => { - request_timing_init(&mut request); - request.timing.as_mut().unwrap().type_ = Some(value.unwrap_or("").to_string()); - }, - "timing.duration-ms" => { - request_timing_init(&mut request); - request.timing.as_mut().unwrap().duration_ms = Some(value.unwrap_or("").to_string()); - }, - "image-bytes" => { - request_timing_init(&mut request); - request.image_bytes = Some(value.unwrap_or("").to_string()); - }, - _ => { - err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string()))); - } - } - } - let mut call = self.hub.watermarks().set(request, &self.opt.arg_channel_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = - if self.opt.cmd_simple { - "simple" - } else if self.opt.cmd_resumable { - "resumable" - } else { - unreachable!() - }; - let mut input_file = input_file_from_opts(&self.opt.arg_file, err); - let mime_type = input_mime_from_opts(&self.opt.arg_mime, err); - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "simple" => call.upload(input_file.unwrap(), mime_type.unwrap()), - "resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _watermarks_unset(&self, dry_run: bool, err: &mut InvalidOptionsError) - -> Option { - let mut call = self.hub.watermarks().unset(&self.opt.arg_channel_id); - for parg in self.opt.arg_v.iter() { - let (key, value) = parse_kv_arg(&*parg, err, false); - match key { - "on-behalf-of-content-owner" => { - call = call.on_behalf_of_content_owner(value.unwrap_or("")); - }, - "alt" - |"fields" - |"key" - |"oauth-token" - |"pretty-print" - |"quota-user" - |"user-ip" => { - let map = [ - ("oauth-token", "oauth_token"), - ("pretty-print", "prettyPrint"), - ("quota-user", "quotaUser"), - ("user-ip", "userIp"), - ]; - call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset")) - }, - _ => err.issues.push(CLIError::UnknownParameter(key.to_string())), - } - } - let protocol = "standard-request"; - if dry_run { - None - } else { - assert!(err.issues.len() == 0); - if self.opt.flag_scope.len() > 0 { - call = call.add_scope(&self.opt.flag_scope); - } - match match protocol { - "standard-request" => call.doit(), - _ => unreachable!(), - } { - Err(api_err) => Some(api_err), - Ok(mut response) => { - None - } - } - } - } - - fn _doit(&self, dry_run: bool) -> (Option, Option) { - let mut err = InvalidOptionsError::new(); - let mut call_result: Option; - let mut err_opt: Option = None; - - if self.opt.cmd_activities { - if self.opt.cmd_insert { - call_result = self._activities_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._activities_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_captions { - if self.opt.cmd_delete { - call_result = self._captions_delete(dry_run, &mut err); - } else if self.opt.cmd_download { - call_result = self._captions_download(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._captions_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._captions_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._captions_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_channel_banners { - if self.opt.cmd_insert { - call_result = self._channel_banners_insert(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_channel_sections { - if self.opt.cmd_delete { - call_result = self._channel_sections_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._channel_sections_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._channel_sections_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._channel_sections_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_channels { - if self.opt.cmd_list { - call_result = self._channels_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._channels_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_comment_threads { - if self.opt.cmd_insert { - call_result = self._comment_threads_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._comment_threads_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._comment_threads_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_comments { - if self.opt.cmd_delete { - call_result = self._comments_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._comments_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._comments_list(dry_run, &mut err); - } else if self.opt.cmd_mark_as_spam { - call_result = self._comments_mark_as_spam(dry_run, &mut err); - } else if self.opt.cmd_set_moderation_status { - call_result = self._comments_set_moderation_status(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._comments_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_guide_categories { - if self.opt.cmd_list { - call_result = self._guide_categories_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_i18n_languages { - if self.opt.cmd_list { - call_result = self._i18n_languages_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_i18n_regions { - if self.opt.cmd_list { - call_result = self._i18n_regions_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_live_broadcasts { - if self.opt.cmd_bind { - call_result = self._live_broadcasts_bind(dry_run, &mut err); - } else if self.opt.cmd_control { - call_result = self._live_broadcasts_control(dry_run, &mut err); - } else if self.opt.cmd_delete { - call_result = self._live_broadcasts_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._live_broadcasts_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._live_broadcasts_list(dry_run, &mut err); - } else if self.opt.cmd_transition { - call_result = self._live_broadcasts_transition(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._live_broadcasts_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_live_streams { - if self.opt.cmd_delete { - call_result = self._live_streams_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._live_streams_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._live_streams_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._live_streams_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_playlist_items { - if self.opt.cmd_delete { - call_result = self._playlist_items_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._playlist_items_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._playlist_items_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._playlist_items_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_playlists { - if self.opt.cmd_delete { - call_result = self._playlists_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._playlists_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._playlists_list(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._playlists_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_search { - if self.opt.cmd_list { - call_result = self._search_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_subscriptions { - if self.opt.cmd_delete { - call_result = self._subscriptions_delete(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._subscriptions_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._subscriptions_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_thumbnails { - if self.opt.cmd_set { - call_result = self._thumbnails_set(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_video_abuse_report_reasons { - if self.opt.cmd_list { - call_result = self._video_abuse_report_reasons_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_video_categories { - if self.opt.cmd_list { - call_result = self._video_categories_list(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_videos { - if self.opt.cmd_delete { - call_result = self._videos_delete(dry_run, &mut err); - } else if self.opt.cmd_get_rating { - call_result = self._videos_get_rating(dry_run, &mut err); - } else if self.opt.cmd_insert { - call_result = self._videos_insert(dry_run, &mut err); - } else if self.opt.cmd_list { - call_result = self._videos_list(dry_run, &mut err); - } else if self.opt.cmd_rate { - call_result = self._videos_rate(dry_run, &mut err); - } else if self.opt.cmd_report_abuse { - call_result = self._videos_report_abuse(dry_run, &mut err); - } else if self.opt.cmd_update { - call_result = self._videos_update(dry_run, &mut err); - } else { - unreachable!(); - } - } - else if self.opt.cmd_watermarks { - if self.opt.cmd_set { - call_result = self._watermarks_set(dry_run, &mut err); - } else if self.opt.cmd_unset { - call_result = self._watermarks_unset(dry_run, &mut err); - } else { - unreachable!(); - } - } else { - unreachable!(); - } - - if dry_run { - if err.issues.len() > 0 { - err_opt = Some(err); - } - } - (call_result, err_opt) - } - - // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: Options) -> Result { - let (config_dir, secret) = { - let config_dir = match cmn::assure_config_dir_exists(&opt.flag_config_dir) { - Err(e) => return Err(InvalidOptionsError::single(e, 3)), - Ok(p) => p, - }; - - match cmn::application_secret_from_directory(&config_dir, "youtube3-secret.json", - "{ - \"installed\": { - \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\", - \"client_secret\": \"UqkDJd5RFwnHoiG5x5Rub8SI\", - \"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\": \"14070749909-vgip2f1okm7bkvajhi9jugan6126io9v.apps.googleusercontent.com\", - \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\" - } -}") { - Ok(secret) => (config_dir, secret), - Err(e) => return Err(InvalidOptionsError::single(e, 4)) - } - }; - - let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate, - if opt.flag_debug_auth { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }, - JsonTokenStorage { - program_name: "youtube3", - db_dir: config_dir.clone(), - }, None); - - let client = - if opt.flag_debug { - hyper::Client::with_connector(mock::TeeConnector { - connector: hyper::net::HttpConnector(None) - }) - } else { - hyper::Client::new() - }; - let engine = Engine { - opt: opt, - hub: api::YouTube::new(client, auth), - }; - - match engine._doit(true) { - (_, Some(err)) => Err(err), - _ => Ok(engine), - } - } - - // Execute the call with all the bells and whistles, informing the caller only if there was an error. - // The absense of one indicates success. - fn doit(&self) -> Option { - self._doit(false).0 - } -} +use clap::{App, SubCommand, Arg}; fn main() { - let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit()); - let debug = opts.flag_debug; - match Engine::new(opts) { - Err(err) => { - writeln!(io::stderr(), "{}", err).ok(); - env::set_exit_status(err.exit_code); - }, - Ok(engine) => { - if let Some(err) = engine.doit() { - if debug { - writeln!(io::stderr(), "{:?}", err).ok(); - } else { - writeln!(io::stderr(), "{}", err).ok(); - } - env::set_exit_status(1); - } - } - } + let matches = + App::new("youtube3") + .author("Sebastian Thiel ") + .version("0.2.0") + .about("Programmatic access to YouTube features.") + .after_help("All documentation details can be found athttp://byron.github.io/google-apis-rs/google_youtube3_cli/index.html") + .arg(Arg::with_name("url") + .long("scope") + .help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.") + .takes_value(true)) + .arg(Arg::with_name("folder") + .long("config-dir") + .help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ${CONFIG_DIR}]") + .takes_value(true)) + .arg(Arg::with_name("debug") + .long("debug") + .help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.") + .takes_value(false)) + .arg(Arg::with_name("debug-auth") + .long("debug-auth") + .help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.") + .takes_value(false)) + .subcommand( + SubCommand::new("activities") + .subcommand( + SubCommand::new("insert") + .about("Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) + + Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite.") + .after_help("Posts a bulletin for a specific channel. (The user submitting the request must be authorized to act on the channel's behalf.) + + Note: Even though an activity resource can contain information about actions like a user rating a video or marking a video as a favorite, you need to use other API methods to generate those activity resources. For example, you would use the API's videos.rate() method to rate a video and the playlistItems.insert() method to mark a video as a favorite.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user.") + .after_help("Returns a list of channel activity events that match the request criteria. For example, you can retrieve events associated with a particular channel, events associated with the user's subscriptions and Google+ friends, or the YouTube home page feed, which is customized for each user.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more activity resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, and contentDetails. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a activity resource, the snippet property contains other properties that identify the type of activity, a display title for the activity, and so forth. If you set part=snippet, the API response will also contain all of those nested properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("captions") + .subcommand( + SubCommand::new("delete") + .about("Deletes a specified caption track.") + .after_help("Deletes a specified caption track.") + .arg( + Arg::with_name("id") + .help("The id parameter identifies the caption track that is being deleted. The value is a caption track ID as identified by the id property in a caption resource.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("download") + .about("Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter.") + .after_help("Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter.") + .arg( + Arg::with_name("id") + .help("The id parameter identifies the caption track that is being retrieved. The value is a caption track ID as identified by the id property in a caption resource.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("insert") + .about("Uploads a caption track.") + .after_help("Uploads a caption track.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("mode") + .short("u") + .help("Specify which file to upload") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track.") + .after_help("Returns a list of caption tracks that are associated with a specified video. Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more caption resource parts that the API response will include. The part names that you can include in the parameter value are id and snippet.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("video-id") + .help("The videoId parameter specifies the YouTube video ID of the video for which the API should return caption tracks.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both.") + .after_help("Updates a caption track. When updating a caption track, you can change the track's draft status, upload a new caption file for the track, or both.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("mode") + .short("u") + .help("Specify which file to upload") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("channel-banners") + .subcommand( + SubCommand::new("insert") + .about("Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: + + - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. + - Extract the url property's value from the response that the API returns for step 1. + - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2.") + .after_help("Uploads a channel banner image to YouTube. This method represents the first two steps in a three-step process to update the banner image for a channel: + + - Call the channelBanners.insert method to upload the binary image data to YouTube. The image must have a 16:9 aspect ratio and be at least 2120x1192 pixels. + - Extract the url property's value from the response that the API returns for step 1. + - Call the channels.update method to update the channel's branding settings. Set the brandingSettings.image.bannerExternalUrl property's value to the URL obtained in step 2.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("mode") + .short("u") + .help("Specify which file to upload") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("channel-sections") + .subcommand( + SubCommand::new("delete") + .about("Deletes a channelSection.") + .after_help("Deletes a channelSection.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube channelSection ID for the resource that is being deleted. In a channelSection resource, the id property specifies the YouTube channelSection ID.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Adds a channelSection for the authenticated user's channel.") + .after_help("Adds a channelSection for the authenticated user's channel.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns channelSection resources that match the API request criteria.") + .after_help("Returns channelSection resources that match the API request criteria.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more channelSection resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, and contentDetails. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a channelSection resource, the snippet property contains other properties, such as a display title for the channelSection. If you set part=snippet, the API response will also contain all of those nested properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Update a channelSection.") + .after_help("Update a channelSection.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("channels") + .subcommand( + SubCommand::new("list") + .about("Returns a collection of zero or more channel resources that match the request criteria.") + .after_help("Returns a collection of zero or more channel resources that match the request criteria.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more channel resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, statistics, topicDetails, and invideoPromotion. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a channel resource, the contentDetails property contains other properties, such as the uploads properties. As such, if you set part=contentDetails, the API response will also contain all of those nested properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Updates a channel's metadata.") + .after_help("Updates a channel's metadata.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("comment-threads") + .subcommand( + SubCommand::new("insert") + .about("Creates a new comment thread and top level comment.") + .after_help("Creates a new comment thread and top level comment.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of comment threads that match the API request parameters.") + .after_help("Returns a list of comment threads that match the API request parameters.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies the commentThread resource parts that the API response will include. Supported values are id, snippet and replies.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Modifies an existing comment.") + .after_help("Modifies an existing comment.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("comments") + .subcommand( + SubCommand::new("delete") + .about("Deletes a comment.") + .after_help("Deletes a comment.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the comment ID for the resource that should be deleted.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Creates a new comment. + + Note: to create a top level comment it is also necessary to create a comment thread. Both are accomplished through the commentThreads resource.") + .after_help("Creates a new comment. + + Note: to create a top level comment it is also necessary to create a comment thread. Both are accomplished through the commentThreads resource.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of comments that match the API request parameters.") + .after_help("Returns a list of comments that match the API request parameters.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies the comment resource parts that the API response will include. Supported values are id and snippet.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("mark-as-spam") + .about("Expresses the caller's opinion that a comment is spam.") + .after_help("Expresses the caller's opinion that a comment is spam.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies a comma-separated list of IDs of comments which should get flagged as spam.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("set-moderation-status") + .about("Sets the moderation status of one or more comments.") + .after_help("Sets the moderation status of one or more comments.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies a comma-separated list of IDs of comments whose moderation status should be updated.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("moderation-status") + .help("Determines the new moderation status of the specified comments.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("update") + .about("Modifies an existing comment.") + .after_help("Modifies an existing comment.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("guide-categories") + .subcommand( + SubCommand::new("list") + .about("Returns a list of categories that can be associated with YouTube channels.") + .after_help("Returns a list of categories that can be associated with YouTube channels.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more guideCategory resource properties that the API response will include. The part names that you can include in the parameter value are id and snippet. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a guideCategory resource, the snippet property contains other properties, such as the category's title. If you set part=snippet, the API response will also contain all of those nested properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("i18n-languages") + .subcommand( + SubCommand::new("list") + .about("Returns a list of supported languages.") + .after_help("Returns a list of supported languages.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more i18nLanguage resource properties that the API response will include. The part names that you can include in the parameter value are id and snippet.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("i18n-regions") + .subcommand( + SubCommand::new("list") + .about("Returns a list of supported regions.") + .after_help("Returns a list of supported regions.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more i18nRegion resource properties that the API response will include. The part names that you can include in the parameter value are id and snippet.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("live-broadcasts") + .subcommand( + SubCommand::new("bind") + .about("Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream.") + .after_help("Binds a YouTube broadcast to a stream or removes an existing binding between a broadcast and a stream. A broadcast can only be bound to one video stream.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the unique ID of the broadcast that is being bound to a video stream.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("control") + .about("Controls the settings for a slate that can be displayed in the broadcast stream.") + .after_help("Controls the settings for a slate that can be displayed in the broadcast stream.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube live broadcast ID that uniquely identifies the broadcast in which the slate is being updated.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("delete") + .about("Deletes a broadcast.") + .after_help("Deletes a broadcast.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube live broadcast ID for the resource that is being deleted.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Creates a broadcast.") + .after_help("Creates a broadcast.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of YouTube broadcasts that match the API request parameters.") + .after_help("Returns a list of YouTube broadcasts that match the API request parameters.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("transition") + .about("Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active.") + .after_help("Changes the status of a YouTube live broadcast and initiates any processes associated with the new status. For example, when you transition a broadcast's status to testing, YouTube starts to transmit video to that broadcast's monitor stream. Before calling this method, you should confirm that the value of the status.streamStatus property for the stream bound to your broadcast is active.") + .arg( + Arg::with_name("broadcast-status") + .help("The broadcastStatus parameter identifies the state to which the broadcast is changing. Note that to transition a broadcast to either the testing or live state, the status.streamStatus must be active for the stream that the broadcast is bound to.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("id") + .help("The id parameter specifies the unique ID of the broadcast that is transitioning to another status.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object.") + .after_help("Updates a broadcast. For example, you could modify the broadcast settings defined in the liveBroadcast resource's contentDetails object.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("live-streams") + .subcommand( + SubCommand::new("delete") + .about("Deletes a video stream.") + .after_help("Deletes a video stream.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube live stream ID for the resource that is being deleted.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience.") + .after_help("Creates a video stream. The stream enables you to send your video to YouTube, which can then broadcast the video to your audience.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of video streams that match the API request parameters.") + .after_help("Returns a list of video streams that match the API request parameters.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more liveStream resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, cdn, and status.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings.") + .after_help("Updates a video stream. If the properties that you want to change cannot be updated, then you need to create a new stream with the proper settings.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("playlist-items") + .subcommand( + SubCommand::new("delete") + .about("Deletes a playlist item.") + .after_help("Deletes a playlist item.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube playlist item ID for the playlist item that is being deleted. In a playlistItem resource, the id property specifies the playlist item's ID.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Adds a resource to a playlist.") + .after_help("Adds a resource to a playlist.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs.") + .after_help("Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more playlistItem resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, and status. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a playlistItem resource, the snippet property contains numerous fields, including the title, description, position, and resourceId properties. As such, if you set part=snippet, the API response will contain all of those properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Modifies a playlist item. For example, you could update the item's position in the playlist.") + .after_help("Modifies a playlist item. For example, you could update the item's position in the playlist.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("playlists") + .subcommand( + SubCommand::new("delete") + .about("Deletes a playlist.") + .after_help("Deletes a playlist.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube playlist ID for the playlist that is being deleted. In a playlist resource, the id property specifies the playlist's ID.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Creates a playlist.") + .after_help("Creates a playlist.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs.") + .after_help("Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more playlist resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, status, and contentDetails. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a playlist resource, the snippet property contains properties like author, title, description, tags, and timeCreated. As such, if you set part=snippet, the API response will contain all of those properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("update") + .about("Modifies a playlist. For example, you could change a playlist's title, description, or privacy status.") + .after_help("Modifies a playlist. For example, you could change a playlist's title, description, or privacy status.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("search") + .subcommand( + SubCommand::new("list") + .about("Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource.") + .after_help("Returns a collection of search results that match the query parameters specified in the API request. By default, a search result set identifies matching video, channel, and playlist resources, but you can also configure queries to only retrieve a specific type of resource.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more search resource properties that the API response will include. The part names that you can include in the parameter value are id and snippet. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a search result, the snippet property contains other properties that identify the result's title, description, and so forth. If you set part=snippet, the API response will also contain all of those nested properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("subscriptions") + .subcommand( + SubCommand::new("delete") + .about("Deletes a subscription.") + .after_help("Deletes a subscription.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube subscription ID for the resource that is being deleted. In a subscription resource, the id property specifies the YouTube subscription ID.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("insert") + .about("Adds a subscription for the authenticated user's channel.") + .after_help("Adds a subscription for the authenticated user's channel.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns subscription resources that match the API request criteria.") + .after_help("Returns subscription resources that match the API request criteria.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more subscription resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, and contentDetails. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a subscription resource, the snippet property contains other properties, such as a display title for the subscription. If you set part=snippet, the API response will also contain all of those nested properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("thumbnails") + .subcommand( + SubCommand::new("set") + .about("Uploads a custom video thumbnail to YouTube and sets it for a video.") + .after_help("Uploads a custom video thumbnail to YouTube and sets it for a video.") + .arg( + Arg::with_name("video-id") + .help("The videoId parameter specifies a YouTube video ID for which the custom video thumbnail is being provided.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("mode") + .short("u") + .help("Specify which file to upload") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("video-abuse-report-reasons") + .subcommand( + SubCommand::new("list") + .about("Returns a list of abuse reasons that can be used for reporting abusive videos.") + .after_help("Returns a list of abuse reasons that can be used for reporting abusive videos.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies the videoCategory resource parts that the API response will include. Supported values are id and snippet.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("video-categories") + .subcommand( + SubCommand::new("list") + .about("Returns a list of categories that can be associated with YouTube videos.") + .after_help("Returns a list of categories that can be associated with YouTube videos.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies the videoCategory resource parts that the API response will include. Supported values are id and snippet.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("videos") + .subcommand( + SubCommand::new("delete") + .about("Deletes a YouTube video.") + .after_help("Deletes a YouTube video.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube video ID for the resource that is being deleted. In a video resource, the id property specifies the video's ID.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("get-rating") + .about("Retrieves the ratings that the authorized user gave to a list of specified videos.") + .after_help("Retrieves the ratings that the authorized user gave to a list of specified videos.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies a comma-separated list of the YouTube video ID(s) for the resource(s) for which you are retrieving rating data. In a video resource, the id property specifies the video's ID.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("insert") + .about("Uploads a video to YouTube and optionally sets the video's metadata.") + .after_help("Uploads a video to YouTube and optionally sets the video's metadata.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("mode") + .short("u") + .help("Specify which file to upload") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("list") + .about("Returns a list of videos that match the API request parameters.") + .after_help("Returns a list of videos that match the API request parameters.") + .arg( + Arg::with_name("part") + .help("The part parameter specifies a comma-separated list of one or more video resource properties that the API response will include. The part names that you can include in the parameter value are id, snippet, contentDetails, fileDetails, liveStreamingDetails, localizations, player, processingDetails, recordingDetails, statistics, status, suggestions, and topicDetails. + + If the parameter identifies a property that contains child properties, the child properties will be included in the response. For example, in a video resource, the snippet property contains the channelId, title, description, tags, and categoryId properties. As such, if you set part=snippet, the API response will contain all of those properties.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + .subcommand( + SubCommand::new("rate") + .about("Add a like or dislike rating to a video or remove a rating from a video.") + .after_help("Add a like or dislike rating to a video or remove a rating from a video.") + .arg( + Arg::with_name("id") + .help("The id parameter specifies the YouTube video ID of the video that is being rated or having its rating removed.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("rating") + .help("Specifies the rating to record.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("report-abuse") + .about("Report abuse for a video.") + .after_help("Report abuse for a video.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("update") + .about("Updates a video's metadata.") + .after_help("Updates a video's metadata.") + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + .arg( + Arg::with_name("") + .short("o") + .help("Specify the file into which to write the programs output") + .takes_value(true) + .required(false) + .multiple(false)) + ) + ) + .subcommand( + SubCommand::new("watermarks") + .subcommand( + SubCommand::new("set") + .about("Uploads a watermark image to YouTube and sets it for a channel.") + .after_help("Uploads a watermark image to YouTube and sets it for a channel.") + .arg( + Arg::with_name("channel-id") + .help("The channelId parameter specifies a YouTube channel ID for which the watermark is being provided.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("kv") + .short("r") + .help("Set various fields of the request structure") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("mode") + .short("u") + .help("Specify which file to upload") + .takes_value(true) + .required(true) + .multiple(true)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + .subcommand( + SubCommand::new("unset") + .about("Deletes a watermark.") + .after_help("Deletes a watermark.") + .arg( + Arg::with_name("channel-id") + .help("The channelId parameter specifies a YouTube channel ID for which the watermark is being unset.") + .required(true) + .multiple(false)) + .arg( + Arg::with_name("v") + .short("p") + .help("Set various fields of the request structure") + .takes_value(true) + .required(false) + .multiple(true)) + ) + ) + .get_matches(); + + } \ No newline at end of file diff --git a/gen/youtube3/README.md b/gen/youtube3/README.md index 88570701b21..2e8ceeb4ca2 100644 --- a/gen/youtube3/README.md +++ b/gen/youtube3/README.md @@ -230,7 +230,7 @@ These will always take a single argument, for which the following statements are * [PODs][wiki-pod] are handed by copy * strings are passed as `&str` -* [request values](http://byron.github.io/google-apis-rs/google_youtube3/trait.RequestValue.html) are borrowed +* [request values](http://byron.github.io/google-apis-rs/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 33393c1066f..5cbc95f4364 100644 --- a/gen/youtube3/src/lib.rs +++ b/gen/youtube3/src/lib.rs @@ -231,7 +231,7 @@ //! //! * [PODs][wiki-pod] are handed by copy //! * strings are passed as `&str` -//! * [request values](trait.RequestValue.html) are borrowed +//! * [request values](trait.RequestValue.html) are moved //! //! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. //! @@ -7239,7 +7239,7 @@ impl<'a, C, A> I18nLanguageListCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -7527,7 +7527,7 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -7869,7 +7869,7 @@ impl<'a, C, A> ChannelSectionListCall<'a, C, A> where C: BorrowMut ChannelSectionInsertCall<'a, C, A> where C: BorrowMut ChannelSectionDeleteCall<'a, C, A> where C: BorrowMut ChannelSectionUpdateCall<'a, C, A> where C: BorrowMut GuideCategoryListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9255,7 +9255,7 @@ impl<'a, C, A> PlaylistInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -9575,7 +9575,7 @@ impl<'a, C, A> PlaylistListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -9865,7 +9865,7 @@ impl<'a, C, A> PlaylistDeleteCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -10116,7 +10116,7 @@ impl<'a, C, A> PlaylistUpdateCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -10400,7 +10400,7 @@ impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut, A: response } else { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); if protocol == "simple" { @@ -10721,7 +10721,7 @@ impl<'a, C, A> VideoReportAbuseCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -11014,7 +11014,7 @@ impl<'a, C, A> VideoListCall<'a, C, A> where C: BorrowMut, A: oau access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11329,7 +11329,7 @@ impl<'a, C, A> VideoRateCall<'a, C, A> where C: BorrowMut, A: oau access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11558,7 +11558,7 @@ impl<'a, C, A> VideoGetRatingCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -11786,7 +11786,7 @@ impl<'a, C, A> VideoDeleteCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -12057,7 +12057,7 @@ impl<'a, C, A> VideoUpdateCall<'a, C, A> where C: BorrowMut, A: o request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -12452,7 +12452,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut, A: o _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -12861,7 +12861,7 @@ impl<'a, C, A> SubscriptionInsertCall<'a, C, A> where C: BorrowMut SubscriptionListCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -13468,7 +13468,7 @@ impl<'a, C, A> SubscriptionDeleteCall<'a, C, A> where C: BorrowMut SearchListCall<'a, C, A> where C: BorrowMut, A: oa access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14296,7 +14296,7 @@ impl<'a, C, A> I18nRegionListCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14580,7 +14580,7 @@ impl<'a, C, A> CommentThreadListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -14902,7 +14902,7 @@ impl<'a, C, A> CommentThreadUpdateCall<'a, C, A> where C: BorrowMut CommentThreadInsertCall<'a, C, A> where C: BorrowMut LiveStreamUpdateCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -15750,7 +15750,7 @@ impl<'a, C, A> LiveStreamDeleteCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16022,7 +16022,7 @@ impl<'a, C, A> LiveStreamListCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -16337,7 +16337,7 @@ impl<'a, C, A> LiveStreamInsertCall<'a, C, A> where C: BorrowMut, request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16633,7 +16633,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -16881,7 +16881,7 @@ impl<'a, C, A> CommentSetModerationStatuCall<'a, C, A> where C: BorrowMut CommentDeleteCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17345,7 +17345,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -17634,7 +17634,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -17875,7 +17875,7 @@ impl<'a, C, A> CommentMarkAsSpamCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18117,7 +18117,7 @@ impl<'a, C, A> ChannelUpdateCall<'a, C, A> where C: BorrowMut, A: request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) @@ -18439,7 +18439,7 @@ impl<'a, C, A> ChannelListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -18755,7 +18755,7 @@ impl<'a, C, A> VideoAbuseReportReasonListCall<'a, C, A> where C: BorrowMut PlaylistItemInsertCall<'a, C, A> where C: BorrowMut PlaylistItemDeleteCall<'a, C, A> where C: BorrowMut PlaylistItemListCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -19828,7 +19828,7 @@ impl<'a, C, A> PlaylistItemUpdateCall<'a, C, A> where C: BorrowMut WatermarkSetCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -20434,7 +20434,7 @@ impl<'a, C, A> WatermarkUnsetCall<'a, C, A> where C: BorrowMut, A access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -20689,7 +20689,7 @@ impl<'a, C, A> LiveBroadcastControlCall<'a, C, A> where C: BorrowMut LiveBroadcastUpdateCall<'a, C, A> where C: BorrowMut LiveBroadcastInsertCall<'a, C, A> where C: BorrowMut LiveBroadcastListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -21928,7 +21928,7 @@ impl<'a, C, A> LiveBroadcastDeleteCall<'a, C, A> where C: BorrowMut LiveBroadcastTransitionCall<'a, C, A> where C: BorrowMut LiveBroadcastBindCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -22746,7 +22746,7 @@ impl<'a, C, A> CaptionDeleteCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23037,7 +23037,7 @@ impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -23392,7 +23392,7 @@ impl<'a, C, A> CaptionListCall<'a, C, A> where C: BorrowMut, A: o access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23689,7 +23689,7 @@ impl<'a, C, A> CaptionDownloadCall<'a, C, A> where C: BorrowMut, access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -23994,7 +23994,7 @@ impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut, A: _ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())), }; let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(content_type) @@ -24352,7 +24352,7 @@ impl<'a, C, A> VideoCategoryListCall<'a, C, A> where C: BorrowMut access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24649,7 +24649,7 @@ impl<'a, C, A> ActivityListCall<'a, C, A> where C: BorrowMut, A: access_token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); @@ -24961,7 +24961,7 @@ impl<'a, C, A> ActivityInsertCall<'a, C, A> where C: BorrowMut, A request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); - let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref()) + let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) diff --git a/src/mako/cli/README.md.mako b/src/mako/cli/README.md.mako index 4595cd53821..e1216af8989 100644 --- a/src/mako/cli/README.md.mako +++ b/src/mako/cli/README.md.mako @@ -5,7 +5,7 @@ c = new_context(schemas, resources, context.get('methods')) %>\ <%namespace name="util" file="../lib/util.mako"/>\ -<%namespace name="docopt" file="lib/docopt.mako"/>\ +<%namespace name="argparse" file="lib/argparse.mako"/>\ <%block filter="markdown_comment">\ <%util:gen_info source="${self.uri}" />\ @@ -26,7 +26,7 @@ Everything else about the *${util.canonical_name()}* API can be found at the This documentation was generated from the *${util.canonical_name()}* API at revision *${revision is UNDEFINED and '00000000' or revision}*. The CLI is at version *${cargo.build_version}*. ```bash -${docopt.new(c, usage_only=True)} +${argparse.grammar(c)} ``` # Configuration diff --git a/src/mako/cli/lib/argparse.mako b/src/mako/cli/lib/argparse.mako new file mode 100644 index 00000000000..d89bc179418 --- /dev/null +++ b/src/mako/cli/lib/argparse.mako @@ -0,0 +1,312 @@ +<%namespace name="util" file="../../lib/util.mako"/>\ +<%! + import os + + from util import (put_and, supports_scopes, api_index, indent_by, enclose_in) + from cli import (mangle_subcommand, new_method_context, PARAM_FLAG, STRUCT_FLAG, UPLOAD_FLAG, OUTPUT_FLAG, VALUE_ARG, + CONFIG_DIR, SCOPE_FLAG, is_request_value_property, FIELD_SEP, docopt_mode, FILE_ARG, MIME_ARG, OUT_ARG, + CONFIG_DIR_FLAG, KEY_VALUE_ARG, to_docopt_arg, DEBUG_FLAG, DEBUG_AUTH_FLAG, MODE_ARG, SCOPE_ARG, + CONFIG_DIR_ARG, FILE_FLAG, MIME_FLAG) + + def rust_boolean(v): + return v and 'true' or 'false' + + def rust_optional(v): + if v is None: + return 'None' + if isinstance(v, bool): + v = v and 'true' or 'false' + elif isinstance(v, basestring): + v = '"%s"' % v + elif isinstance(v, list): + v = 'vec![%s]' % ','.join('UploadProtocol::%s' % p.capitalize() for p in v) + return 'Some(%s)' % v +%>\ +<%def name="grammar(c)">\ +${util.program_name()} [options] +% for resource in sorted(c.rta_map.keys()): + ${mangle_subcommand(resource)} + % for method in sorted(c.rta_map[resource]): +<% + mc = new_method_context(resource, method, c) + + args = list() + for p in mc.required_props: + if is_request_value_property(mc, p): + continue + args.append(to_docopt_arg(p)) + # end for each required property + + if mc.request_value: + args.append('(-%s %s)...' % (STRUCT_FLAG, '<%s>' % KEY_VALUE_ARG)) + # end request_value + + if mc.media_params: + upload_protocols = [mp.protocol for mp in mc.media_params] + mode = docopt_mode(upload_protocols) + args.append('(-%s %s -%s <%s> -%s <%s>)' % (UPLOAD_FLAG, mode, FILE_FLAG, FILE_ARG, MIME_FLAG, MIME_ARG)) + # end upload handling + + if mc.optional_props or parameters is not UNDEFINED: + args.append('[-%s %s]...' % (PARAM_FLAG, '<%s>' % VALUE_ARG)) + # end paramters + + if mc.response_schema or mc.m.get('supportsMediaDownload', False): + args.append('[-%s <%s>]' % (OUTPUT_FLAG, OUT_ARG)) + # handle output +%>\ + ${mangle_subcommand(method)} ${' '.join(args)} + % endfor # each method +% endfor # end for each resource + ${util.program_name()} --help + +All documentation details can be found at +${cargo.doc_base_url + '/' + os.path.dirname(api_index(cargo.doc_base_url, name, version, make, check_exists=False))} + +Configuration: +% if supports_scopes(auth): + [--${SCOPE_FLAG} <${SCOPE_ARG}>]... + Specify the authentication a method should be executed in. Each scope + requires the user to grant this application permission to use it. + If unset, it defaults to the shortest scope url for a particular method. +% endif scopes + --${CONFIG_DIR_FLAG} <${CONFIG_DIR_ARG}> + A directory into which we will store our persistent data. Defaults to + a user-writable directory that we will create during the first invocation. + [default: ${CONFIG_DIR}] + --${DEBUG_FLAG} + Output all server communication to standard error. `tx` and `rx` are placed + into the same stream. + --${DEBUG_AUTH_FLAG} + Output all communication related to authentication to standard error. `tx` + and `rx` are placed into the same stream. + + + + +<%def name="new(c)" buffered="True">\ +<% + url_info = "All documentation details can be found at " + \ + cargo.doc_base_url + '/' + os.path.dirname(api_index(cargo.doc_base_url, name, version, make, check_exists=False)) + + # list of tuples + # (0) = long name + # (1) = description + # (2) = argument name, no argument if no argument + # (3) = multiple + global_args = list() + if supports_scopes(auth): + global_args.append(( + SCOPE_FLAG, + "Specify the authentication a method should be executed in. Each scope " + "requires the user to grant this application permission to use it." + "If unset, it defaults to the shortest scope url for a particular method.", + SCOPE_ARG, + True + )) + # end add scope arg + global_args.append(( + CONFIG_DIR_FLAG, + "A directory into which we will store our persistent data. Defaults to " + "a user-writable directory that we will create during the first invocation." + "[default: %s" % CONFIG_DIR, + CONFIG_DIR_ARG, + False, + )) + + global_args.append(( + DEBUG_FLAG, + "Output all server communication to standard error. `tx` and `rx` are placed " + "into the same stream.", + None, + False, + )) + + global_args.append(( + DEBUG_AUTH_FLAG, + "Output all communication related to authentication to standard error. `tx` " + "and `rx` are placed into the same stream.", + None, + False, + )) +%>\ +let arg_data = [ +% for resource in sorted(c.rta_map.keys()): +<%block filter="indent_by(4)">\ +("${mangle_subcommand(resource)}", vec![ + % for method in sorted(c.rta_map[resource]): +<% + mc = new_method_context(resource, method, c) + + # A list of tuples + # (0) = short flag, like -c + # (1) = param description or None + # (2) = argument name, or None if there is no argument + # (3) = is required (bool) + # (4) = allow multi-use + args = list() + for p in mc.required_props: + if is_request_value_property(mc, p): + continue + args.append(( + None, + p.get('description'), + mangle_subcommand(p.name), + True, + False, + None, + )) + # end for each required property + + if mc.request_value: + args.append(( + STRUCT_FLAG, + "Set various fields of the request structure", + KEY_VALUE_ARG, + True, + True, + None + )) + # end request_value + + if mc.media_params: + upload_protocols = [mp.protocol for mp in mc.media_params] + args.append(( + UPLOAD_FLAG, + "Specify which file to upload", + MODE_ARG, + True, + False, + upload_protocols + )) + # end upload handling + + if mc.optional_props or parameters is not UNDEFINED: + args.append(( + PARAM_FLAG, + "Set various fields of the request structure", + VALUE_ARG, + False, + True, + None + )) + # end paramters + + if mc.response_schema or mc.m.get('supportsMediaDownload', False): + args.append(( + OUTPUT_FLAG, + "Specify the file into which to write the programs output", + OUT_ARG, + False, + False, + None + )) + # handle output +%>\ + ("${mangle_subcommand(method)}", ${rust_optional(mc.m.get('description'))}, + vec![ + % for flag, desc, arg_name, required, multi, upload_protocols in args: + (${rust_optional(arg_name)}, + ${rust_optional(flag)}, + ${rust_optional(desc)}, + ${rust_optional(required)}, + ${rust_optional(multi)}, + % if not mc.media_params: + ## Make sure the type is set, even though we don't have any protocol information + % if loop.first: + None::${'>'}\ + % else: + None\ + % endif + % else: + ${rust_optional(upload_protocols)}\ + % endif +), + % if not loop.last: + + % endif + % endfor + ]), + % endfor # each method + ]), + +% endfor # end for each resource +]; + +let mut app = App::new("${util.program_name()}") +<%block filter="indent_by(7)">\ +.author("${', '.join(cargo.authors)}") +.version("${util.crate_version()}") +% if description is not UNDEFINED: +.about("${description}") +% endif +.after_help("${url_info}") +% for flag, desc, arg_name, multiple in global_args: +.arg(Arg::with_name("${arg_name or flag}") + .long("${flag}") + .help("${desc}") + .multiple(${rust_boolean(multiple)}) + .takes_value(${rust_boolean(arg_name)}))\ +% if loop.last: +; +% else: + +% endif +% endfor + +for &(main_command_name, ref subcommands) in arg_data.iter() { + let mut mcmd = SubCommand::new(main_command_name); + + for &(sub_command_name, ref desc, ref args) in subcommands { + let mut scmd = SubCommand::new(sub_command_name); + if let &Some(desc) = desc { + scmd = scmd.about(desc); + } + + for &(ref arg_name, ref flag, ref desc, ref required, ref multi, ref protocols) in args { + let mut arg = Arg::with_name(match (arg_name, flag) { + (&Some(an), _ ) => an, + (_ , &Some(f)) => f, + _ => unreachable!(), + }); + if let &Some(short_flag) = flag { + arg = arg.short(short_flag); + } + if let &Some(desc) = desc { + arg = arg.help(desc); + } + if arg_name.is_some() && flag.is_some() { + arg = arg.takes_value(true); + } + if let &Some(required) = required { + arg = arg.required(required); + } + if let &Some(multi) = multi { + arg = arg.multiple(multi); + } + if let &Some(ref protocols) = protocols { + arg = arg.possible_values(protocols); + arg = arg.requires("${FILE_ARG}"); + arg = arg.requires("${MIME_ARG}"); + + scmd = scmd.arg(Arg::with_name("${FILE_ARG}") + .short("${FILE_FLAG}") + .required(true) + .requires("${MODE_ARG}") + .help("The file to upload") + .takes_value(true)); + scmd = scmd.arg(Arg::with_name("${MIME_ARG}") + .short("${MIME_FLAG}") + .requires("${MODE_ARG}") + .required(true) + .help("The file's mime time, like 'application/octet-stream'") + .takes_value(true)); + } + scmd = scmd.arg(arg); + } + mcmd = mcmd.subcommand(scmd); + } + app = app.subcommand(mcmd); +} + + \ No newline at end of file diff --git a/src/mako/cli/lib/cli.py b/src/mako/cli/lib/cli.py index a2a909c00e1..1d3b7cfa452 100644 --- a/src/mako/cli/lib/cli.py +++ b/src/mako/cli/lib/cli.py @@ -20,9 +20,15 @@ DEBUG_FLAG = 'debug' DEBUG_AUTH_FLAG = 'debug-auth' -FILE_ARG = '' -MIME_ARG = '' -OUT_ARG = '' +MODE_ARG = 'mode' +FILE_ARG = 'file' +FILE_FLAG = 'f' +MIME_ARG = 'mime' +MIME_FLAG = 'm' +OUT_ARG = 'out' + +SCOPE_ARG = 'url' +CONFIG_DIR_ARG = 'folder' FIELD_SEP = '.' @@ -91,16 +97,15 @@ def mangle_subcommand(name): def ident(name): return mangle_subcommand(name).replace('-', '_') -# return the identifier of a command for the given name, suitable to address the command field in the docopt structure -def cmd_ident(name): - return 'cmd_' + ident(name) +# Return a required value in Rust, using unwrap() +def req_value(name): + return 'opt.value_of("' + mangle_subcommand(name) + '").unwrap()' -# Similar to cmd_ident, but for arguments -def arg_ident(name): - return 'arg_' + ident(name) +def opt_value(name, opt='opt', default=''): + return opt + '.value_of("' + mangle_subcommand(name) + ('").unwrap_or("%s")' % default) -def flag_ident(name): - return 'flag_' + ident(name) +def opt_values(name, opt='opt'): + return opt + '.values_of("' + mangle_subcommand(name) + '").unwrap_or(Vec::new()).iter()' def application_secret_path(program_name): return program_name + '-secret.json' diff --git a/src/mako/cli/lib/docopt.mako b/src/mako/cli/lib/docopt.mako deleted file mode 100644 index 5d68c9a2079..00000000000 --- a/src/mako/cli/lib/docopt.mako +++ /dev/null @@ -1,81 +0,0 @@ -<%namespace name="util" file="../../lib/util.mako"/>\ -<%! - from util import (put_and, supports_scopes, api_index) - from cli import (mangle_subcommand, new_method_context, PARAM_FLAG, STRUCT_FLAG, UPLOAD_FLAG, OUTPUT_FLAG, VALUE_ARG, - CONFIG_DIR, SCOPE_FLAG, is_request_value_property, FIELD_SEP, docopt_mode, FILE_ARG, MIME_ARG, OUT_ARG, - CONFIG_DIR_FLAG, KEY_VALUE_ARG, to_docopt_arg, DEBUG_FLAG, DEBUG_AUTH_FLAG) -%>\ -<%def name="new(c, usage_only=False)">\ -<% - param_used = False - struct_used = False - upload_protocols_used = set() - output_used = False -%>\ -% if not usage_only: -docopt!(Options derive Debug, " -Usage: -% endif -% for resource in sorted(c.rta_map.keys()): - % for method in sorted(c.rta_map[resource]): -<% - mc = new_method_context(resource, method, c) - - args = list() - for p in mc.required_props: - if is_request_value_property(mc, p): - continue - args.append(to_docopt_arg(p)) - # end for each required property - - if mc.request_value: - args.append('-%s %s...' % (STRUCT_FLAG, '<%s>' % KEY_VALUE_ARG)) - struct_used = True - # end request_value - - if mc.media_params: - upload_protocols = [mp.protocol for mp in mc.media_params] - mode = docopt_mode(upload_protocols) - args.append('-%s %s %s %s' % (UPLOAD_FLAG, mode, FILE_ARG, MIME_ARG)) - upload_protocols_used = upload_protocols_used|set(upload_protocols) - # end upload handling - - if mc.optional_props or parameters is not UNDEFINED: - args.append('[-%s %s...]' % (PARAM_FLAG, '<%s>' % VALUE_ARG)) - param_used = True - # end paramters - - if mc.response_schema or mc.m.get('supportsMediaDownload', False): - args.append('[-%s %s]' % (OUTPUT_FLAG, OUT_ARG)) - output_used = True - # handle output -%>\ - ${util.program_name()} [options] ${mangle_subcommand(resource)} ${mangle_subcommand(method)} ${' '.join(args)} - % endfor # each method -% endfor # end for each resource - ${util.program_name()} --help - -All documentation details can be found at -${cargo.doc_base_url + '/' + api_index(cargo.doc_base_url, name, version, make, check_exists=False)} - -Configuration: -% if supports_scopes(auth): - --${SCOPE_FLAG} - Specify the authentication a method should be executed in. Each scope - requires the user to grant this application permission to use it. - If unset, it defaults to the shortest scope url for a particular method. -% endif scopes - --${CONFIG_DIR_FLAG} - A directory into which we will store our persistent data. Defaults to - a user-writable directory that we will create during the first invocation. - [default: ${CONFIG_DIR}] - --${DEBUG_FLAG} - Output all server communication to standard error. `tx` and `rx` are placed - into the same stream. - --${DEBUG_AUTH_FLAG} - Output all communication related to authentication to standard error. `tx` - and `rx` are placed into the same stream. -% if not usage_only: -"); -% endif - \ No newline at end of file diff --git a/src/mako/cli/lib/engine.mako b/src/mako/cli/lib/engine.mako index 8667bbc5479..8e3f0ea831e 100644 --- a/src/mako/cli/lib/engine.mako +++ b/src/mako/cli/lib/engine.mako @@ -5,48 +5,47 @@ ADD_SCOPE_FN, TREF) from cli import (mangle_subcommand, new_method_context, PARAM_FLAG, STRUCT_FLAG, UPLOAD_FLAG, OUTPUT_FLAG, VALUE_ARG, CONFIG_DIR, SCOPE_FLAG, is_request_value_property, FIELD_SEP, docopt_mode, FILE_ARG, MIME_ARG, OUT_ARG, - cmd_ident, call_method_ident, arg_ident, POD_TYPES, flag_ident, ident, JSON_TYPE_VALUE_MAP, + call_method_ident, POD_TYPES, opt_value, ident, JSON_TYPE_VALUE_MAP, KEY_VALUE_ARG, to_cli_schema, SchemaEntry, CTYPE_POD, actual_json_type, CTYPE_MAP, CTYPE_ARRAY, - application_secret_path, DEBUG_FLAG, DEBUG_AUTH_FLAG) + application_secret_path, DEBUG_FLAG, DEBUG_AUTH_FLAG, CONFIG_DIR_FLAG, req_value, MODE_ARG, + opt_values, SCOPE_ARG, CONFIG_DIR_ARG) v_arg = '<%s>' % VALUE_ARG - SOPT = 'self.opt.' + SOPT = 'self.opt' def to_opt_arg_ident(p): - return SOPT + arg_ident(p.name) + return opt_value(p.name) def borrow_prefix(p): ptype = p.get('type', None) borrow = '' - if (ptype not in POD_TYPES or ptype in ('string', None) or p.get('repeated', False)) and ptype is not None: + if (ptype not in POD_TYPES or ptype is None or p.get('repeated', False)) and ptype is not None: borrow = '&' return borrow - - STANDARD = 'standard-request' %>\ <%def name="new(c)">\ <% hub_type_name = 'api::' + hub_type(c.schemas, util.canonical_name()) %>\ -mod cmn; use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg, - input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError}; + input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol}; use std::default::Default; use std::str::FromStr; use oauth2::{Authenticator, DefaultAuthenticatorDelegate}; use rustc_serialize::json; +use clap::ArgMatches; -struct Engine { - opt: Options, +struct Engine<'n, 'a> { + opt: ArgMatches<'n, 'a>, hub: ${hub_type_name}>, } -impl Engine { +impl<'n, 'a> Engine<'n, 'a> { % for resource in sorted(c.rta_map.keys()): % for method in sorted(c.rta_map[resource]): - fn ${call_method_ident(resource, method)}(&self, dry_run: bool, err: &mut InvalidOptionsError) + fn ${call_method_ident(resource, method)}(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError) -> Option { ${self._method_call_impl(c, resource, method) | indent_all_but_first_by(2)} } @@ -55,35 +54,29 @@ impl Engine { % endfor fn _doit(&self, dry_run: bool) -> (Option, Option) { let mut err = InvalidOptionsError::new(); - let mut call_result: Option; + let mut call_result: Option = None; let mut err_opt: Option = None; ## RESOURCE LOOP: check for set primary subcommand + match ${SOPT + '.subcommand()'} { % for resource in sorted(c.rta_map.keys()): - - % if loop.first: - if \ - % else: - else if \ - % endif -self.opt.${cmd_ident(resource)} { - ## METHOD LOOP: Check for method subcommand - % for method in sorted(c.rta_map[resource]): - % if loop.first: - if \ - % else: - else if \ - % endif -self.opt.${cmd_ident(method)} { - call_result = self.${call_method_ident(resource, method)}(dry_run, &mut err); - }\ - % endfor # each method - else { - unreachable!(); - } - }\ + ("${mangle_subcommand(resource)}", Some(opt)) => { + match opt.subcommand() { + % for method in sorted(c.rta_map[resource]): + ("${mangle_subcommand(method)}", Some(opt)) => { + call_result = self.${call_method_ident(resource, method)}(opt, dry_run, &mut err); + }, + % endfor # each method + _ => { + err.issues.push(CLIError::MissingMethodError("${mangle_subcommand(resource)}".to_string())); + writeln!(io::stderr(), "{}\n", opt.usage()).ok(); + } + } + }, % endfor # each resource - else { - unreachable!(); + _ => { + err.issues.push(CLIError::MissingCommandError); + writeln!(io::stderr(), "{}\n", ${SOPT}.usage()).ok(); + } } if dry_run { @@ -95,9 +88,9 @@ self.opt.${cmd_ident(method)} { } // Please note that this call will fail if any part of the opt can't be handled - fn new(opt: Options) -> Result { + fn new(opt: ArgMatches<'a, 'n>) -> Result, InvalidOptionsError> { let (config_dir, secret) = { - let config_dir = match cmn::assure_config_dir_exists(&opt.flag_config_dir) { + let config_dir = match cmn::assure_config_dir_exists(opt.value_of("${CONFIG_DIR_ARG}").unwrap_or("${CONFIG_DIR}")) { Err(e) => return Err(InvalidOptionsError::single(e, 3)), Ok(p) => p, }; @@ -138,7 +131,7 @@ self.opt.${cmd_ident(method)} { <%def name="_debug_client(flag_name)" buffered="True">\ -if opt.flag_${mangle_ident(flag_name)} { +if opt.is_present("${flag_name}") { hyper::Client::with_connector(mock::TeeConnector { connector: hyper::net::HttpConnector(None) }) @@ -180,7 +173,7 @@ ${self._request_value_impl(c, request_cli_schema, prop_name, request_prop_type)} % elif p.type != 'string': % if p.get('repeated', False): let ${prop_name}: Vec<${prop_type} = Vec::new(); -for (arg_id, arg) in ${opt_ident}.iter().enumerate() { +for (arg_id, arg) in ${opt_values(mangle_subcommand(p.name))}.enumerate() { ${prop_name}.push(arg_from_str(&arg, err, "<${mangle_subcommand(p.name)}>", arg_id), "${p.type}")); } % else: @@ -205,7 +198,7 @@ let mut download_mode = false; % endif let mut call = self.hub.${mangle_ident(resource)}().${mangle_ident(method)}(${', '.join(call_args)}); % if handle_props: -for parg in ${SOPT + arg_ident(VALUE_ARG)}.iter() { +for parg in ${opt_values(VALUE_ARG)} { let (key, value) = parse_kv_arg(&*parg, err, false); match key { % for p in optional_props: @@ -261,48 +254,36 @@ ${value_unwrap}\ } % endif # handle call parameters % if mc.media_params: -let protocol = -% for p in mc.media_params: - % if loop.first: - if \ - % else: - } else if \ - % endif -${SOPT + cmd_ident(p.protocol)} { - "${p.protocol}" -% endfor # each media param - } else { - unreachable!() - }; -let mut input_file = input_file_from_opts(&${SOPT + arg_ident(FILE_ARG[1:-1])}, err); -let mime_type = input_mime_from_opts(&${SOPT + arg_ident(MIME_ARG[1:-1])}, err); +let protocol = CallType::Upload(UploadProtocol::from(${req_value(MODE_ARG)})); +let mut input_file = input_file_from_opts(${req_value(FILE_ARG)}, err); +let mime_type = input_mime_from_opts(${req_value(MIME_ARG)}, err); % else: -let protocol = "${STANDARD}"; +let protocol = CallType::Standard; % endif # support upload if dry_run { None } else { assert!(err.issues.len() == 0); % if method_default_scope(mc.m): -<% scope_opt = SOPT + flag_ident('scope') %>\ - if ${scope_opt}.len() > 0 { - call = call.${ADD_SCOPE_FN}(&${scope_opt}); + for scope in ${opt_values(SCOPE_ARG, opt=SOPT)} { + call = call.${ADD_SCOPE_FN}(scope); } % endif ## Make the call, handle uploads, handle downloads (also media downloads|json decoding) ## TODO: unify error handling % if handle_output: - let mut ostream = writer_from_opts(${SOPT + flag_ident(OUTPUT_FLAG)}, &${SOPT + arg_ident(OUT_ARG[1:-1])}); + let mut ostream = writer_from_opts(opt.value_of("${(OUT_ARG)}")); % endif # handle output match match protocol { % if mc.media_params: % for p in mc.media_params: - "${p.protocol}" => call.${upload_action_fn(api.terms.upload_action, p.type.suffix)}(input_file.unwrap(), mime_type.unwrap()), + CallType::Upload(UploadProtocol::${p.protocol.capitalize()}) => call.${upload_action_fn(api.terms.upload_action, p.type.suffix)}(input_file.unwrap(), mime_type.unwrap()), % endfor + CallType::Standard => unreachable!() % else: - "${STANDARD}" => call.${api.terms.action}(), + CallType::Standard => call.${api.terms.action}(), + _ => unreachable!() % endif - _ => unreachable!(), } { Err(api_err) => Some(api_err), % if mc.response_schema: @@ -384,7 +365,7 @@ if dry_run { %>\ let mut ${request_prop_name} = api::${request_prop_type}::default(); let mut field_cursor = FieldCursor::default(); -for kvarg in ${SOPT + arg_ident(KEY_VALUE_ARG)}.iter() { +for kvarg in ${opt_values(KEY_VALUE_ARG)} { let last_errc = err.issues.len(); let (key, value) = parse_kv_arg(&*kvarg, err, false); let mut temp_cursor = field_cursor.clone(); diff --git a/src/mako/cli/main.rs.mako b/src/mako/cli/main.rs.mako index 549e531fe39..71f672c9b94 100644 --- a/src/mako/cli/main.rs.mako +++ b/src/mako/cli/main.rs.mako @@ -1,8 +1,10 @@ -<%namespace name="docopt" file="lib/docopt.mako"/>\ +<%namespace name="argparse" file="lib/argparse.mako"/>\ <%namespace name="engine" file="lib/engine.mako"/>\ <%namespace name="util" file="../lib/util.mako"/>\ <% - from util import (new_context, rust_comment, to_extern_crate_name, library_to_crate_name, library_name) + from util import (new_context, rust_comment, to_extern_crate_name, library_to_crate_name, library_name, + indent_all_but_first_by) + from cli import DEBUG_FLAG c = new_context(schemas, resources, context.get('methods')) default_user_agent = "google-cli-rust-client/" + cargo.build_version @@ -11,10 +13,9 @@ <%util:gen_info source="${self.uri}" />\ #![feature(plugin, exit_status)] -#![plugin(docopt_macros)] #![allow(unused_variables, unused_imports, dead_code, unused_mut)] -extern crate docopt; +extern crate clap; extern crate yup_oauth2 as oauth2; extern crate yup_hyper_mock as mock; extern crate rustc_serialize; @@ -25,15 +26,18 @@ extern crate ${to_extern_crate_name(library_to_crate_name(library_name(name, ver use std::env; use std::io::{self, Write}; +use clap::{App, SubCommand, Arg}; -${docopt.new(c)}\ +mod cmn; ${engine.new(c)}\ fn main() { - let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit()); - let debug = opts.flag_debug; - match Engine::new(opts) { + ${argparse.new(c) | indent_all_but_first_by(1)}\ + let matches = app.get_matches(); + + let debug = matches.is_present("${DEBUG_FLAG}"); + match Engine::new(matches) { Err(err) => { writeln!(io::stderr(), "{}", err).ok(); env::set_exit_status(err.exit_code); diff --git a/src/rust/cli/cmn.rs b/src/rust/cli/cmn.rs index 1f6b51b934d..5ba16d68460 100644 --- a/src/rust/cli/cmn.rs +++ b/src/rust/cli/cmn.rs @@ -1,6 +1,7 @@ use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token}; use rustc_serialize::json; use mime::Mime; +use clap::{App, SubCommand}; use std::fs; use std::env; @@ -15,6 +16,44 @@ use std::default::Default; const FIELD_SEP: char = '.'; +pub enum CallType { + Upload(UploadProtocol), + Standard, +} + +pub enum UploadProtocol { + Simple, + Resumable, +} + +impl AsRef for UploadProtocol { + fn as_ref(&self) -> &str { + match *self { + UploadProtocol::Simple => "simple", + UploadProtocol::Resumable => "resumable" + } + } +} + +impl AsRef for CallType { + fn as_ref(&self) -> &str { + match *self { + CallType::Upload(ref proto) => proto.as_ref(), + CallType::Standard => "standard-request" + } + } +} + +impl<'a> From<&'a str> for UploadProtocol { + fn from(this: &'a str) -> UploadProtocol { + match this { + "simple" => UploadProtocol::Simple, + "resumable" => UploadProtocol::Resumable, + _ => panic!("We don't expect to see anything else here, the CLI parser takes care") + } + } +} + #[derive(Clone, Default)] pub struct FieldCursor(Vec); @@ -132,11 +171,11 @@ pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option // May panic if we can't open the file - this is anticipated, we can't currently communicate this // kind of error: TODO: fix this architecture :) -pub fn writer_from_opts(flag: bool, arg: &str) -> Box { - if !flag || arg == "-" { - Box::new(stdout()) - } else { - Box::new(fs::OpenOptions::new().create(true).write(true).open(arg).unwrap()) +pub fn writer_from_opts(arg: Option<&str>) -> Box { + let f = arg.unwrap_or("-"); + match f { + "-" => Box::new(stdout()), + _ => Box::new(fs::OpenOptions::new().create(true).write(true).open(f).unwrap()) } } @@ -314,6 +353,8 @@ pub enum CLIError { InvalidKeyValueSyntax(String, bool), Input(InputError), Field(FieldError), + MissingCommandError, + MissingMethodError(String), } impl fmt::Display for CLIError { @@ -331,6 +372,8 @@ impl fmt::Display for CLIError { 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), } } }