fix(version-up): code updated to v0.1.6, latest CLI

* also includes publishing tag files
This commit is contained in:
Sebastian Thiel
2015-04-26 13:42:31 +02:00
parent 4e275eaadd
commit c2dd9c7a02
770 changed files with 63340 additions and 31427 deletions

View File

View File

@@ -4,7 +4,7 @@
[package]
name = "google-adexchangebuyer1d3-cli"
version = "0.0.1+20150326"
version = "0.1.0+20150326"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3-cli"

View File

@@ -1,4 +1,122 @@
# HELLO ADEXCHANGEBUYER:V1.3
<!---
DO NOT EDIT !
This file was generated automatically from 'src/mako/cli/README.md.mako'
DO NOT EDIT !
-->
The `adexchangebuyer1d3` command-line interface *(CLI)* allows to use most features of the *Google Ad Exchange Buyer* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
# Usage
This documentation was generated from the *Ad Exchange Buyer* API at revision *20150326*. The CLI is at version *0.1.0*.
```bash
adexchangebuyer1d3 [options] accounts get <id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] accounts list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] accounts patch <id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] accounts update <id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] billing-info get <account-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] billing-info list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] budget get <account-id> <billing-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] budget patch <account-id> <billing-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] budget update <account-id> <billing-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] creatives get <account-id> <buyer-creative-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] creatives insert -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] creatives list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] direct-deals get <id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] direct-deals list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] performance-report list <account-id> <end-date-time> <start-date-time> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config delete <account-id> <config-id> [-p <v>...]
adexchangebuyer1d3 [options] pretargeting-config get <account-id> <config-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config insert <account-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config list <account-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config patch <account-id> <config-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config update <account-id> <config-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 --help
All documentation details can be found at
http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/index.html
Configuration:
--scope <url>
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 <folder>
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.
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `adexchangebuyer1d3-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/adexchangebuyer1d3-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/adexchangebuyer1d3-secret.json`, assuming that the required *adexchangebuyer* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
Include information about application secret files, and how we automatically write a default one.
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag
will cause all communication related to authentication to standard error.
If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the
issue at hand.
You may consider redirecting standard error into a file for ease of use, e.g. `adexchangebuyer1d3 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,4 +1,4 @@
site_name: Ad Exchange Buyer v0.0.1+20150326
site_name: Ad Exchange Buyer v0.1.0+20150326
site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli
site_description: Write integrating applications with bcore

View File

@@ -105,7 +105,7 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
let key = &kv[..pos];
if kv.len() <= pos + 1 {
add_err();
return (key, None)
return (key, Some(""))
}
(key, Some(&kv[pos+1..]))
}

View File

@@ -19,46 +19,47 @@ use std::io::{self, Write};
docopt!(Options derive Debug, "
Usage:
adexchangebuyer1d3 [options] accounts get <id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] accounts list [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] accounts patch <id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] accounts update <id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] billing-info get <account-id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] billing-info list [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] budget get <account-id> <billing-id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] budget patch <account-id> <billing-id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] budget update <account-id> <billing-id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] creatives get <account-id> <buyer-creative-id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] creatives insert -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] creatives list [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] direct-deals get <id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] direct-deals list [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] performance-report list <account-id> <end-date-time> <start-date-time> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config delete <account-id> <config-id> [-p <v>]...
adexchangebuyer1d3 [options] pretargeting-config get <account-id> <config-id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config insert <account-id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config list <account-id> [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config patch <account-id> <config-id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config update <account-id> <config-id> -r <kv>... [-p <v>]... [-o <out>]
adexchangebuyer1d3 [options] accounts get <id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] accounts list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] accounts patch <id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] accounts update <id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] billing-info get <account-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] billing-info list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] budget get <account-id> <billing-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] budget patch <account-id> <billing-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] budget update <account-id> <billing-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] creatives get <account-id> <buyer-creative-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] creatives insert -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] creatives list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] direct-deals get <id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] direct-deals list [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] performance-report list <account-id> <end-date-time> <start-date-time> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config delete <account-id> <config-id> [-p <v>...]
adexchangebuyer1d3 [options] pretargeting-config get <account-id> <config-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config insert <account-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config list <account-id> [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config patch <account-id> <config-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 [options] pretargeting-config update <account-id> <config-id> -r <kv>... [-p <v>...] [-o <out>]
adexchangebuyer1d3 --help
All documentation details can be found TODO: <URL to github.io docs here, see #51>
All documentation details can be found at
http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli/index.html
Configuration:
--scope <url>
Specify the authentication a method should be executed in. Each scope requires
the user to grant this application permission to use it.
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 <folder>
A directory into which we will store our persistent data. Defaults to a user-writable
directory that we will create during the first invocation.
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.
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.
Output all communication related to authentication to standard error. `tx`
and `rx` are placed into the same stream.
");
mod cmn;
@@ -108,6 +109,9 @@ impl Engine {
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(),
@@ -151,6 +155,9 @@ impl Engine {
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(),
@@ -167,38 +174,24 @@ impl Engine {
fn _accounts_patch(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::Account::default();
let id: i32 = arg_from_str(&self.opt.arg_id, err, "<id>", "integer");
let mut call = self.hub.accounts().patch(&request, 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 mut field_name = FieldCursor::default();
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);
if let Err(field_err) = field_name.set(&*key) {
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
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());
},
@@ -221,15 +214,41 @@ impl Engine {
request.cookie_matching_url = Some(value.unwrap_or("").to_string());
},
_ => {
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
}
}
}
let id: i32 = arg_from_str(&self.opt.arg_id, err, "<id>", "integer");
let mut call = self.hub.accounts().patch(request, 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(),
@@ -246,38 +265,24 @@ impl Engine {
fn _accounts_update(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::Account::default();
let id: i32 = arg_from_str(&self.opt.arg_id, err, "<id>", "integer");
let mut call = self.hub.accounts().update(&request, 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 mut field_name = FieldCursor::default();
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);
if let Err(field_err) = field_name.set(&*key) {
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
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());
},
@@ -300,15 +305,41 @@ impl Engine {
request.cookie_matching_url = Some(value.unwrap_or("").to_string());
},
_ => {
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
}
}
}
let id: i32 = arg_from_str(&self.opt.arg_id, err, "<id>", "integer");
let mut call = self.hub.accounts().update(request, 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(),
@@ -353,6 +384,9 @@ impl Engine {
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(),
@@ -396,6 +430,9 @@ impl Engine {
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(),
@@ -439,6 +476,9 @@ impl Engine {
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(),
@@ -455,8 +495,48 @@ impl Engine {
fn _budget_patch(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::Budget::default();
let mut call = self.hub.budget().patch(&request, &self.opt.arg_account_id, &self.opt.arg_billing_id);
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());
},
"budget-amount" => {
request.budget_amount = Some(value.unwrap_or("").to_string());
},
"currency-code" => {
request.currency_code = Some(value.unwrap_or("").to_string());
},
"billing-id" => {
request.billing_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.budget().patch(request, &self.opt.arg_account_id, &self.opt.arg_billing_id);
for parg in self.opt.arg_v.iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
@@ -478,42 +558,14 @@ impl Engine {
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
}
}
let mut field_name = FieldCursor::default();
for kvarg in self.opt.arg_kv.iter() {
let (key, value) = parse_kv_arg(&*kvarg, err, false);
if let Err(field_err) = field_name.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
"kind" => {
request.kind = Some(value.unwrap_or("").to_string());
},
"budget-amount" => {
request.budget_amount = Some(value.unwrap_or("").to_string());
},
"currency-code" => {
request.currency_code = Some(value.unwrap_or("").to_string());
},
"billing-id" => {
request.billing_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(field_name.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(),
@@ -530,8 +582,48 @@ impl Engine {
fn _budget_update(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::Budget::default();
let mut call = self.hub.budget().update(&request, &self.opt.arg_account_id, &self.opt.arg_billing_id);
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());
},
"budget-amount" => {
request.budget_amount = Some(value.unwrap_or("").to_string());
},
"currency-code" => {
request.currency_code = Some(value.unwrap_or("").to_string());
},
"billing-id" => {
request.billing_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.budget().update(request, &self.opt.arg_account_id, &self.opt.arg_billing_id);
for parg in self.opt.arg_v.iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
@@ -553,42 +645,14 @@ impl Engine {
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
}
}
let mut field_name = FieldCursor::default();
for kvarg in self.opt.arg_kv.iter() {
let (key, value) = parse_kv_arg(&*kvarg, err, false);
if let Err(field_err) = field_name.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
"kind" => {
request.kind = Some(value.unwrap_or("").to_string());
},
"budget-amount" => {
request.budget_amount = Some(value.unwrap_or("").to_string());
},
"currency-code" => {
request.currency_code = Some(value.unwrap_or("").to_string());
},
"billing-id" => {
request.billing_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(field_name.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(),
@@ -633,6 +697,9 @@ impl Engine {
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(),
@@ -649,43 +716,30 @@ impl Engine {
fn _creatives_insert(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::Creative::default();
let mut call = self.hub.creatives().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 mut field_name = FieldCursor::default();
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);
if let Err(field_err) = field_name.set(&*key) {
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_filtering_reasons_init(request: &mut api::Creative) {
if request.filtering_reasons.is_none() {
request.filtering_reasons = Some(Default::default());
}
}
match &field_name.to_string()[..] {
match &temp_cursor.to_string()[..] {
"product-categories" => {
if request.product_categories.is_none() {
request.product_categories = Some(Default::default());
@@ -765,15 +819,40 @@ impl Engine {
request.account_id = Some(arg_from_str(value.unwrap_or("-0"), err, "account-id", "integer"));
},
_ => {
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
}
}
}
let mut call = self.hub.creatives().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(),
@@ -832,6 +911,9 @@ impl Engine {
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(),
@@ -875,6 +957,9 @@ impl Engine {
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(),
@@ -918,6 +1003,9 @@ impl Engine {
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(),
@@ -967,6 +1055,9 @@ impl Engine {
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(),
@@ -1010,6 +1101,9 @@ impl Engine {
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!(),
@@ -1051,6 +1145,9 @@ impl Engine {
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(),
@@ -1067,37 +1164,24 @@ impl Engine {
fn _pretargeting_config_insert(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::PretargetingConfig::default();
let mut call = self.hub.pretargeting_config().insert(&request, &self.opt.arg_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 mut field_name = FieldCursor::default();
let mut request = api::PretargetingConfig::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);
if let Err(field_err) = field_name.set(&*key) {
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
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()[..] {
"billing-id" => {
request.billing_id = Some(value.unwrap_or("").to_string());
},
@@ -1204,15 +1288,40 @@ impl Engine {
request.supported_creative_attributes.as_mut().unwrap().push(value.unwrap_or("").to_string());
},
_ => {
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
}
}
}
let mut call = self.hub.pretargeting_config().insert(request, &self.opt.arg_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(),
@@ -1256,6 +1365,9 @@ impl Engine {
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(),
@@ -1272,37 +1384,24 @@ impl Engine {
fn _pretargeting_config_patch(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::PretargetingConfig::default();
let mut call = self.hub.pretargeting_config().patch(&request, &self.opt.arg_account_id, &self.opt.arg_config_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 mut field_name = FieldCursor::default();
let mut request = api::PretargetingConfig::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);
if let Err(field_err) = field_name.set(&*key) {
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
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()[..] {
"billing-id" => {
request.billing_id = Some(value.unwrap_or("").to_string());
},
@@ -1409,15 +1508,40 @@ impl Engine {
request.supported_creative_attributes.as_mut().unwrap().push(value.unwrap_or("").to_string());
},
_ => {
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
}
}
}
let mut call = self.hub.pretargeting_config().patch(request, &self.opt.arg_account_id, &self.opt.arg_config_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(),
@@ -1434,37 +1558,24 @@ impl Engine {
fn _pretargeting_config_update(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::PretargetingConfig::default();
let mut call = self.hub.pretargeting_config().update(&request, &self.opt.arg_account_id, &self.opt.arg_config_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 mut field_name = FieldCursor::default();
let mut request = api::PretargetingConfig::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);
if let Err(field_err) = field_name.set(&*key) {
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
match &field_name.to_string()[..] {
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()[..] {
"billing-id" => {
request.billing_id = Some(value.unwrap_or("").to_string());
},
@@ -1571,15 +1682,40 @@ impl Engine {
request.supported_creative_attributes.as_mut().unwrap().push(value.unwrap_or("").to_string());
},
_ => {
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
}
}
}
let mut call = self.hub.pretargeting_config().update(request, &self.opt.arg_account_id, &self.opt.arg_config_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(),
@@ -1743,6 +1879,7 @@ impl Engine {
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();
@@ -1750,8 +1887,11 @@ fn main() {
},
Ok(engine) => {
if let Some(err) = engine.doit() {
writeln!(io::stderr(), "{:?}", err).ok();
writeln!(io::stderr(), "{}", err).ok();
if debug {
writeln!(io::stderr(), "{:?}", err).ok();
} else {
writeln!(io::stderr(), "{}", err).ok();
}
env::set_exit_status(1);
}
}

View File

@@ -4,7 +4,7 @@
[package]
name = "google-adexchangebuyer1d3"
version = "0.1.5+20150326"
version = "0.1.6+20150326"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangebuyer1d3"

View File

@@ -5,7 +5,7 @@ DO NOT EDIT !
-->
The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service.
This documentation was generated from *Ad Exchange Buyer* crate version *0.1.5+20150326*, where *20150326* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.5*.
This documentation was generated from *Ad Exchange Buyer* crate version *0.1.6+20150326*, where *20150326* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
@@ -113,21 +113,22 @@ let mut req = PretargetingConfig::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.pretargeting_config().patch(&req, "accountId", "configId")
let result = hub.pretargeting_config().patch(req, "accountId", "configId")
.doit();
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
Error::HttpError(_)
|Error::MissingAPIKey
|Error::MissingToken
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_) => println!("{}", e),
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}

View File

@@ -60,7 +60,6 @@ pub trait ToParts {
fn to_parts(&self) -> String;
}
/// A utility type which can decode a server response that indicates error
#[derive(Deserialize)]
pub struct JsonServerError {
@@ -68,6 +67,30 @@ pub struct JsonServerError {
pub error_description: Option<String>
}
/// A utility to represent detailed errors we might see in case there are BadRequests.
/// The latter happen if the sent parameters or request structures are unsound
#[derive(Deserialize, Serialize, Debug)]
pub struct ErrorResponse {
error: ServerError,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct ServerError {
errors: Vec<ServerMessage>,
code: u16,
message: String,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct ServerMessage {
domain: String,
reason: String,
message: String,
#[serde(rename="locationType")]
location_type: Option<String>,
location: Option<String>
}
#[derive(Copy, Clone)]
pub struct DummyNetworkStream;
@@ -175,7 +198,7 @@ pub trait Delegate {
///
/// If you choose to retry after a duration, the duration should be chosen using the
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>, _: Option<ServerError>) -> Retry {
Retry::Abort
}
@@ -230,6 +253,10 @@ pub enum Error {
/// even though the maximum upload size is what is stored in field `.1`.
UploadSizeLimitExceeded(u64, u64),
/// Represents information about a request that was not understood by the server.
/// Details are included.
BadRequest(ErrorResponse),
/// We needed an API key for authentication, but didn't obtain one.
/// Neither through the authenticator, nor through the Delegate.
MissingAPIKey,
@@ -245,7 +272,7 @@ pub enum Error {
/// Shows that we failed to decode the server response.
/// This can happen if the protocol changes in conjunction with strict json decoding.
JsonDecodeError(serde::json::Error),
JsonDecodeError(String, serde::json::Error),
/// Indicates an HTTP repsonse with a non-success status code
Failure(hyper::client::Response),
@@ -263,13 +290,16 @@ impl Display for Error {
writeln!(f, "The application's API key was not found in the configuration").ok();
writeln!(f, "It is used as there are no Scopes defined for this method.")
},
Error::BadRequest(ref err)
=> writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message),
Error::MissingToken(ref err) =>
writeln!(f, "Token retrieval failed with error: {}", err),
Error::Cancelled =>
writeln!(f, "Operation cancelled by delegate"),
Error::FieldClash(field) =>
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
Error::JsonDecodeError(ref err) => err.fmt(f),
Error::JsonDecodeError(ref json_str, ref err)
=> writeln!(f, "{}: {}", err, json_str),
Error::Failure(ref response) =>
writeln!(f, "Http status indicates failure: {:?}", response),
}
@@ -280,7 +310,7 @@ impl error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::HttpError(ref err) => err.description(),
Error::JsonDecodeError(ref err) => err.description(),
Error::JsonDecodeError(_, ref err) => err.description(),
_ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead"
}
}
@@ -288,7 +318,7 @@ impl error::Error for Error {
fn cause(&self) -> Option<&error::Error> {
match *self {
Error::HttpError(ref err) => err.cause(),
Error::JsonDecodeError(ref err) => err.cause(),
Error::JsonDecodeError(_, ref err) => err.cause(),
_ => None
}
}
@@ -401,7 +431,7 @@ impl<'a> Read for MultiPartReader<'a> {
// before clearing the last part, we will add the boundary that
// will be written last
self.last_part_boundary = Some(Cursor::new(
format!("{}--{}", LINE_ENDING, BOUNDARY).into_bytes()))
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
}
// We are depleted - this can trigger the next part to come in
self.current_part = None;
@@ -489,7 +519,7 @@ impl Header for ContentRange {
impl HeaderFormat for ContentRange {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(fmt.write_str("bytes="));
try!(fmt.write_str("bytes "));
match self.range {
Some(ref c) => try!(c.fmt(fmt)),
None => try!(fmt.write_str("*"))
@@ -510,7 +540,7 @@ impl Header for RangeResponseHeader {
fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
if let [ref v] = raw {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
const PREFIX: &'static str = "bytes ";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
return Some(RangeResponseHeader(c))
@@ -559,7 +589,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
let h: &RangeResponseHeader = match headers.get() {
Some(hh) if r.status == StatusCode::PermanentRedirect => hh,
None|Some(_) => {
if let Retry::After(d) = self.delegate.http_failure(&r, None) {
if let Retry::After(d) = self.delegate.http_failure(&r, None, None) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
@@ -626,7 +656,9 @@ impl<'a, A> ResumableUploadHelper<'a, A>
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let Retry::After(d) = self.delegate.http_failure(&res, serde::json::from_str(&json_err).ok()) {
if let Retry::After(d) = self.delegate.http_failure(&res,
serde::json::from_str(&json_err).ok(),
serde::json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}

View File

@@ -2,7 +2,7 @@
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.5+20150326*, where *20150326* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.5*.
//! This documentation was generated from *Ad Exchange Buyer* crate version *0.1.6+20150326*, where *20150326* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
//!
//! Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
@@ -114,21 +114,22 @@
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.pretargeting_config().patch(&req, "accountId", "configId")
//! let result = hub.pretargeting_config().patch(req, "accountId", "configId")
//! .doit();
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! Error::HttpError(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_) => println!("{}", e),
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
@@ -216,7 +217,7 @@ use std::io;
use std::fs;
use std::thread::sleep_ms;
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, JsonServerError};
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse};
// ##############
@@ -289,21 +290,22 @@ impl Default for Scope {
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.pretargeting_config().patch(&req, "accountId", "configId")
/// let result = hub.pretargeting_config().patch(req, "accountId", "configId")
/// .doit();
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// Error::HttpError(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_) => println!("{}", e),
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
@@ -324,7 +326,7 @@ impl<'a, C, A> AdExchangeBuyer<C, A>
AdExchangeBuyer {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/0.1.5".to_string(),
_user_agent: "google-api-rust-client/0.1.6".to_string(),
}
}
@@ -351,7 +353,7 @@ impl<'a, C, A> AdExchangeBuyer<C, A>
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/0.1.5`.
/// It defaults to `google-api-rust-client/0.1.6`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
@@ -1189,10 +1191,10 @@ impl<'a, C, A> BudgetMethods<'a, C, A> {
/// * `request` - No description provided.
/// * `accountId` - The account id associated with the budget being updated.
/// * `billingId` - The billing id associated with the budget being updated.
pub fn patch(&self, request: &Budget, account_id: &str, billing_id: &str) -> BudgetPatchCall<'a, C, A> {
pub fn patch(&self, request: Budget, account_id: &str, billing_id: &str) -> BudgetPatchCall<'a, C, A> {
BudgetPatchCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_account_id: account_id.to_string(),
_billing_id: billing_id.to_string(),
_delegate: Default::default(),
@@ -1210,10 +1212,10 @@ impl<'a, C, A> BudgetMethods<'a, C, A> {
/// * `request` - No description provided.
/// * `accountId` - The account id associated with the budget being updated.
/// * `billingId` - The billing id associated with the budget being updated.
pub fn update(&self, request: &Budget, account_id: &str, billing_id: &str) -> BudgetUpdateCall<'a, C, A> {
pub fn update(&self, request: Budget, account_id: &str, billing_id: &str) -> BudgetUpdateCall<'a, C, A> {
BudgetUpdateCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_account_id: account_id.to_string(),
_billing_id: billing_id.to_string(),
_delegate: Default::default(),
@@ -1289,10 +1291,10 @@ impl<'a, C, A> CreativeMethods<'a, C, A> {
/// # Arguments
///
/// * `request` - No description provided.
pub fn insert(&self, request: &Creative) -> CreativeInsertCall<'a, C, A> {
pub fn insert(&self, request: Creative) -> CreativeInsertCall<'a, C, A> {
CreativeInsertCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_delegate: Default::default(),
_scopes: Default::default(),
_additional_params: Default::default(),
@@ -1384,10 +1386,10 @@ impl<'a, C, A> AccountMethods<'a, C, A> {
///
/// * `request` - No description provided.
/// * `id` - The account id
pub fn update(&self, request: &Account, id: i32) -> AccountUpdateCall<'a, C, A> {
pub fn update(&self, request: Account, id: i32) -> AccountUpdateCall<'a, C, A> {
AccountUpdateCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_id: id,
_delegate: Default::default(),
_scopes: Default::default(),
@@ -1403,10 +1405,10 @@ impl<'a, C, A> AccountMethods<'a, C, A> {
///
/// * `request` - No description provided.
/// * `id` - The account id
pub fn patch(&self, request: &Account, id: i32) -> AccountPatchCall<'a, C, A> {
pub fn patch(&self, request: Account, id: i32) -> AccountPatchCall<'a, C, A> {
AccountPatchCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_id: id,
_delegate: Default::default(),
_scopes: Default::default(),
@@ -1576,10 +1578,10 @@ impl<'a, C, A> PretargetingConfigMethods<'a, C, A> {
/// * `request` - No description provided.
/// * `accountId` - The account id to update the pretargeting config for.
/// * `configId` - The specific id of the configuration to update.
pub fn patch(&self, request: &PretargetingConfig, account_id: &str, config_id: &str) -> PretargetingConfigPatchCall<'a, C, A> {
pub fn patch(&self, request: PretargetingConfig, account_id: &str, config_id: &str) -> PretargetingConfigPatchCall<'a, C, A> {
PretargetingConfigPatchCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_account_id: account_id.to_string(),
_config_id: config_id.to_string(),
_delegate: Default::default(),
@@ -1615,10 +1617,10 @@ impl<'a, C, A> PretargetingConfigMethods<'a, C, A> {
///
/// * `request` - No description provided.
/// * `accountId` - The account id to insert the pretargeting config for.
pub fn insert(&self, request: &PretargetingConfig, account_id: &str) -> PretargetingConfigInsertCall<'a, C, A> {
pub fn insert(&self, request: PretargetingConfig, account_id: &str) -> PretargetingConfigInsertCall<'a, C, A> {
PretargetingConfigInsertCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_account_id: account_id.to_string(),
_delegate: Default::default(),
_scopes: Default::default(),
@@ -1652,10 +1654,10 @@ impl<'a, C, A> PretargetingConfigMethods<'a, C, A> {
/// * `request` - No description provided.
/// * `accountId` - The account id to update the pretargeting config for.
/// * `configId` - The specific id of the configuration to update.
pub fn update(&self, request: &PretargetingConfig, account_id: &str, config_id: &str) -> PretargetingConfigUpdateCall<'a, C, A> {
pub fn update(&self, request: PretargetingConfig, account_id: &str, config_id: &str) -> PretargetingConfigUpdateCall<'a, C, A> {
PretargetingConfigUpdateCall {
hub: self.hub,
_request: request.clone(),
_request: request,
_account_id: account_id.to_string(),
_config_id: config_id.to_string(),
_delegate: Default::default(),
@@ -1818,12 +1820,17 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -1832,7 +1839,7 @@ impl<'a, C, A> BillingInfoGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2026,12 +2033,17 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut<hyper::Client>,
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2040,7 +2052,7 @@ impl<'a, C, A> BillingInfoListCall<'a, C, A> where C: BorrowMut<hyper::Client>,
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2224,12 +2236,17 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2238,7 +2255,7 @@ impl<'a, C, A> DirectDealListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2448,12 +2465,17 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2462,7 +2484,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2569,7 +2591,7 @@ impl<'a, C, A> DirectDealGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.budget().patch(&req, "accountId", "billingId")
/// let result = hub.budget().patch(req, "accountId", "billingId")
/// .doit();
/// # }
/// ```
@@ -2699,12 +2721,17 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2713,7 +2740,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2731,8 +2758,8 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &Budget) -> BudgetPatchCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: Budget) -> BudgetPatchCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id associated with the budget being updated.
@@ -2839,7 +2866,7 @@ impl<'a, C, A> BudgetPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.budget().update(&req, "accountId", "billingId")
/// let result = hub.budget().update(req, "accountId", "billingId")
/// .doit();
/// # }
/// ```
@@ -2969,12 +2996,17 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2983,7 +3015,7 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3001,8 +3033,8 @@ impl<'a, C, A> BudgetUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &Budget) -> BudgetUpdateCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: Budget) -> BudgetUpdateCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id associated with the budget being updated.
@@ -3224,12 +3256,17 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3238,7 +3275,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3355,7 +3392,7 @@ impl<'a, C, A> BudgetGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.creatives().insert(&req)
/// let result = hub.creatives().insert(req)
/// .doit();
/// # }
/// ```
@@ -3457,12 +3494,17 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3471,7 +3513,7 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3489,8 +3531,8 @@ impl<'a, C, A> CreativeInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &Creative) -> CreativeInsertCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: Creative) -> CreativeInsertCall<'a, C, A> {
self._request = new_value;
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
@@ -3697,12 +3739,17 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3711,7 +3758,7 @@ impl<'a, C, A> CreativeListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3960,12 +4007,17 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3974,7 +4026,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4091,7 +4143,7 @@ impl<'a, C, A> CreativeGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.accounts().update(&req, -21)
/// let result = hub.accounts().update(req, -21)
/// .doit();
/// # }
/// ```
@@ -4219,12 +4271,17 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4233,7 +4290,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4251,8 +4308,8 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &Account) -> AccountUpdateCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: Account) -> AccountUpdateCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id
@@ -4349,7 +4406,7 @@ impl<'a, C, A> AccountUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.accounts().patch(&req, -21)
/// let result = hub.accounts().patch(req, -21)
/// .doit();
/// # }
/// ```
@@ -4477,12 +4534,17 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4491,7 +4553,7 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4509,8 +4571,8 @@ impl<'a, C, A> AccountPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &Account) -> AccountPatchCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: Account) -> AccountPatchCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id
@@ -4694,12 +4756,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4708,7 +4775,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4918,12 +4985,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4932,7 +5004,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -5142,12 +5214,17 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut<hyper::Cli
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -5156,7 +5233,7 @@ impl<'a, C, A> PerformanceReportListCall<'a, C, A> where C: BorrowMut<hyper::Cli
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -5411,12 +5488,17 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut<hyper::
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = res;
@@ -5532,7 +5614,7 @@ impl<'a, C, A> PretargetingConfigDeleteCall<'a, C, A> where C: BorrowMut<hyper::
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.pretargeting_config().patch(&req, "accountId", "configId")
/// let result = hub.pretargeting_config().patch(req, "accountId", "configId")
/// .doit();
/// # }
/// ```
@@ -5662,12 +5744,17 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut<hyper::C
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -5676,7 +5763,7 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut<hyper::C
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -5694,8 +5781,8 @@ impl<'a, C, A> PretargetingConfigPatchCall<'a, C, A> where C: BorrowMut<hyper::C
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &PretargetingConfig) -> PretargetingConfigPatchCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: PretargetingConfig) -> PretargetingConfigPatchCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id to update the pretargeting config for.
@@ -5917,12 +6004,17 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut<hyper::Cli
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -5931,7 +6023,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut<hyper::Cli
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -6048,7 +6140,7 @@ impl<'a, C, A> PretargetingConfigGetCall<'a, C, A> where C: BorrowMut<hyper::Cli
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.pretargeting_config().insert(&req, "accountId")
/// let result = hub.pretargeting_config().insert(req, "accountId")
/// .doit();
/// # }
/// ```
@@ -6176,12 +6268,17 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut<hyper::
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -6190,7 +6287,7 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut<hyper::
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -6208,8 +6305,8 @@ impl<'a, C, A> PretargetingConfigInsertCall<'a, C, A> where C: BorrowMut<hyper::
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &PretargetingConfig) -> PretargetingConfigInsertCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: PretargetingConfig) -> PretargetingConfigInsertCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id to insert the pretargeting config for.
@@ -6419,12 +6516,17 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut<hyper::Cl
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -6433,7 +6535,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut<hyper::Cl
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -6540,7 +6642,7 @@ impl<'a, C, A> PretargetingConfigListCall<'a, C, A> where C: BorrowMut<hyper::Cl
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.pretargeting_config().update(&req, "accountId", "configId")
/// let result = hub.pretargeting_config().update(req, "accountId", "configId")
/// .doit();
/// # }
/// ```
@@ -6670,12 +6772,17 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut<hyper::
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -6684,7 +6791,7 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut<hyper::
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -6702,8 +6809,8 @@ impl<'a, C, A> PretargetingConfigUpdateCall<'a, C, A> where C: BorrowMut<hyper::
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: &PretargetingConfig) -> PretargetingConfigUpdateCall<'a, C, A> {
self._request = new_value.clone();
pub fn request(mut self, new_value: PretargetingConfig) -> PretargetingConfigUpdateCall<'a, C, A> {
self._request = new_value;
self
}
/// The account id to update the pretargeting config for.

View File

@@ -4,7 +4,7 @@
[package]
name = "google-adexchangeseller2-cli"
version = "0.0.1+20150326"
version = "0.1.0+20150326"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2-cli"

View File

@@ -1,4 +1,115 @@
# HELLO ADEXCHANGESELLER:V2.0
<!---
DO NOT EDIT !
This file was generated automatically from 'src/mako/cli/README.md.mako'
DO NOT EDIT !
-->
The `adexchangeseller2` command-line interface *(CLI)* allows to use most features of the *Google Ad Exchange Seller* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
# Usage
This documentation was generated from the *Ad Exchange Seller* API at revision *20150326*. The CLI is at version *0.1.0*.
```bash
adexchangeseller2 [options] accounts adclients-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts alerts-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts customchannels-get <account-id> <ad-client-id> <custom-channel-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts customchannels-list <account-id> <ad-client-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts get <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts list [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts metadata-dimensions-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts metadata-metrics-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts preferreddeals-get <account-id> <deal-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts preferreddeals-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts reports-generate <account-id> <start-date> <end-date> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts reports-saved-generate <account-id> <saved-report-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts reports-saved-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts urlchannels-list <account-id> <ad-client-id> [-p <v>...] [-o <out>]
adexchangeseller2 --help
All documentation details can be found at
http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/index.html
Configuration:
--scope <url>
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 <folder>
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.
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `adexchangeseller2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/adexchangeseller2-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/adexchangeseller2-secret.json`, assuming that the required *adexchangeseller* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
Include information about application secret files, and how we automatically write a default one.
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag
will cause all communication related to authentication to standard error.
If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the
issue at hand.
You may consider redirecting standard error into a file for ease of use, e.g. `adexchangeseller2 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,4 +1,4 @@
site_name: Ad Exchange Seller v0.0.1+20150326
site_name: Ad Exchange Seller v0.1.0+20150326
site_url: http://byron.github.io/google-apis-rs/google-adexchangeseller2-cli
site_description: Write integrating applications with bcore

View File

@@ -105,7 +105,7 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
let key = &kv[..pos];
if kv.len() <= pos + 1 {
add_err();
return (key, None)
return (key, Some(""))
}
(key, Some(&kv[pos+1..]))
}

View File

@@ -19,39 +19,40 @@ use std::io::{self, Write};
docopt!(Options derive Debug, "
Usage:
adexchangeseller2 [options] accounts adclients-list <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts alerts-list <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts customchannels-get <account-id> <ad-client-id> <custom-channel-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts customchannels-list <account-id> <ad-client-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts get <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts list [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts metadata-dimensions-list <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts metadata-metrics-list <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts preferreddeals-get <account-id> <deal-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts preferreddeals-list <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts reports-generate <account-id> <start-date> <end-date> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts reports-saved-generate <account-id> <saved-report-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts reports-saved-list <account-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts urlchannels-list <account-id> <ad-client-id> [-p <v>]... [-o <out>]
adexchangeseller2 [options] accounts adclients-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts alerts-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts customchannels-get <account-id> <ad-client-id> <custom-channel-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts customchannels-list <account-id> <ad-client-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts get <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts list [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts metadata-dimensions-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts metadata-metrics-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts preferreddeals-get <account-id> <deal-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts preferreddeals-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts reports-generate <account-id> <start-date> <end-date> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts reports-saved-generate <account-id> <saved-report-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts reports-saved-list <account-id> [-p <v>...] [-o <out>]
adexchangeseller2 [options] accounts urlchannels-list <account-id> <ad-client-id> [-p <v>...] [-o <out>]
adexchangeseller2 --help
All documentation details can be found TODO: <URL to github.io docs here, see #51>
All documentation details can be found at
http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli/index.html
Configuration:
--scope <url>
Specify the authentication a method should be executed in. Each scope requires
the user to grant this application permission to use it.
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 <folder>
A directory into which we will store our persistent data. Defaults to a user-writable
directory that we will create during the first invocation.
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.
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.
Output all communication related to authentication to standard error. `tx`
and `rx` are placed into the same stream.
");
mod cmn;
@@ -106,6 +107,9 @@ impl Engine {
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(),
@@ -152,6 +156,9 @@ impl Engine {
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(),
@@ -195,6 +202,9 @@ impl Engine {
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(),
@@ -244,6 +254,9 @@ impl Engine {
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(),
@@ -287,6 +300,9 @@ impl Engine {
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(),
@@ -336,6 +352,9 @@ impl Engine {
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(),
@@ -379,6 +398,9 @@ impl Engine {
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(),
@@ -422,6 +444,9 @@ impl Engine {
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(),
@@ -465,6 +490,9 @@ impl Engine {
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(),
@@ -508,6 +536,9 @@ impl Engine {
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(),
@@ -576,6 +607,9 @@ impl Engine {
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(),
@@ -632,6 +666,9 @@ impl Engine {
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(),
@@ -681,6 +718,9 @@ impl Engine {
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(),
@@ -730,6 +770,9 @@ impl Engine {
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(),
@@ -849,6 +892,7 @@ impl Engine {
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();
@@ -856,8 +900,11 @@ fn main() {
},
Ok(engine) => {
if let Some(err) = engine.doit() {
writeln!(io::stderr(), "{:?}", err).ok();
writeln!(io::stderr(), "{}", err).ok();
if debug {
writeln!(io::stderr(), "{:?}", err).ok();
} else {
writeln!(io::stderr(), "{}", err).ok();
}
env::set_exit_status(1);
}
}

View File

@@ -4,7 +4,7 @@
[package]
name = "google-adexchangeseller2"
version = "0.1.5+20150326"
version = "0.1.6+20150326"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/adexchangeseller2"

View File

@@ -5,7 +5,7 @@ DO NOT EDIT !
-->
The `google-adexchangeseller2` library allows access to all features of the *Google Ad Exchange Seller* service.
This documentation was generated from *Ad Exchange Seller* crate version *0.1.5+20150326*, where *20150326* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.5*.
This documentation was generated from *Ad Exchange Seller* crate version *0.1.6+20150326*, where *20150326* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
Everything else about the *Ad Exchange Seller* *v2* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
@@ -123,14 +123,15 @@ match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
Error::HttpError(_)
|Error::MissingAPIKey
|Error::MissingToken
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_) => println!("{}", e),
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}

View File

@@ -60,7 +60,6 @@ pub trait ToParts {
fn to_parts(&self) -> String;
}
/// A utility type which can decode a server response that indicates error
#[derive(Deserialize)]
pub struct JsonServerError {
@@ -68,6 +67,30 @@ pub struct JsonServerError {
pub error_description: Option<String>
}
/// A utility to represent detailed errors we might see in case there are BadRequests.
/// The latter happen if the sent parameters or request structures are unsound
#[derive(Deserialize, Serialize, Debug)]
pub struct ErrorResponse {
error: ServerError,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct ServerError {
errors: Vec<ServerMessage>,
code: u16,
message: String,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct ServerMessage {
domain: String,
reason: String,
message: String,
#[serde(rename="locationType")]
location_type: Option<String>,
location: Option<String>
}
#[derive(Copy, Clone)]
pub struct DummyNetworkStream;
@@ -175,7 +198,7 @@ pub trait Delegate {
///
/// If you choose to retry after a duration, the duration should be chosen using the
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>) -> Retry {
fn http_failure(&mut self, _: &hyper::client::Response, Option<JsonServerError>, _: Option<ServerError>) -> Retry {
Retry::Abort
}
@@ -230,6 +253,10 @@ pub enum Error {
/// even though the maximum upload size is what is stored in field `.1`.
UploadSizeLimitExceeded(u64, u64),
/// Represents information about a request that was not understood by the server.
/// Details are included.
BadRequest(ErrorResponse),
/// We needed an API key for authentication, but didn't obtain one.
/// Neither through the authenticator, nor through the Delegate.
MissingAPIKey,
@@ -245,7 +272,7 @@ pub enum Error {
/// Shows that we failed to decode the server response.
/// This can happen if the protocol changes in conjunction with strict json decoding.
JsonDecodeError(serde::json::Error),
JsonDecodeError(String, serde::json::Error),
/// Indicates an HTTP repsonse with a non-success status code
Failure(hyper::client::Response),
@@ -263,13 +290,16 @@ impl Display for Error {
writeln!(f, "The application's API key was not found in the configuration").ok();
writeln!(f, "It is used as there are no Scopes defined for this method.")
},
Error::BadRequest(ref err)
=> writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message),
Error::MissingToken(ref err) =>
writeln!(f, "Token retrieval failed with error: {}", err),
Error::Cancelled =>
writeln!(f, "Operation cancelled by delegate"),
Error::FieldClash(field) =>
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
Error::JsonDecodeError(ref err) => err.fmt(f),
Error::JsonDecodeError(ref json_str, ref err)
=> writeln!(f, "{}: {}", err, json_str),
Error::Failure(ref response) =>
writeln!(f, "Http status indicates failure: {:?}", response),
}
@@ -280,7 +310,7 @@ impl error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::HttpError(ref err) => err.description(),
Error::JsonDecodeError(ref err) => err.description(),
Error::JsonDecodeError(_, ref err) => err.description(),
_ => "NO DESCRIPTION POSSIBLE - use `Display.fmt()` instead"
}
}
@@ -288,7 +318,7 @@ impl error::Error for Error {
fn cause(&self) -> Option<&error::Error> {
match *self {
Error::HttpError(ref err) => err.cause(),
Error::JsonDecodeError(ref err) => err.cause(),
Error::JsonDecodeError(_, ref err) => err.cause(),
_ => None
}
}
@@ -401,7 +431,7 @@ impl<'a> Read for MultiPartReader<'a> {
// before clearing the last part, we will add the boundary that
// will be written last
self.last_part_boundary = Some(Cursor::new(
format!("{}--{}", LINE_ENDING, BOUNDARY).into_bytes()))
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
}
// We are depleted - this can trigger the next part to come in
self.current_part = None;
@@ -489,7 +519,7 @@ impl Header for ContentRange {
impl HeaderFormat for ContentRange {
fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
try!(fmt.write_str("bytes="));
try!(fmt.write_str("bytes "));
match self.range {
Some(ref c) => try!(c.fmt(fmt)),
None => try!(fmt.write_str("*"))
@@ -510,7 +540,7 @@ impl Header for RangeResponseHeader {
fn parse_header(raw: &[Vec<u8>]) -> Option<RangeResponseHeader> {
if let [ref v] = raw {
if let Ok(s) = std::str::from_utf8(v) {
const PREFIX: &'static str = "bytes=";
const PREFIX: &'static str = "bytes ";
if s.starts_with(PREFIX) {
if let Ok(c) = <Chunk as FromStr>::from_str(&s[PREFIX.len()..]) {
return Some(RangeResponseHeader(c))
@@ -559,7 +589,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
let h: &RangeResponseHeader = match headers.get() {
Some(hh) if r.status == StatusCode::PermanentRedirect => hh,
None|Some(_) => {
if let Retry::After(d) = self.delegate.http_failure(&r, None) {
if let Retry::After(d) = self.delegate.http_failure(&r, None, None) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
@@ -626,7 +656,9 @@ impl<'a, A> ResumableUploadHelper<'a, A>
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let Retry::After(d) = self.delegate.http_failure(&res, serde::json::from_str(&json_err).ok()) {
if let Retry::After(d) = self.delegate.http_failure(&res,
serde::json::from_str(&json_err).ok(),
serde::json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}

View File

@@ -2,7 +2,7 @@
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Ad Exchange Seller* crate version *0.1.5+20150326*, where *20150326* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.5*.
//! This documentation was generated from *Ad Exchange Seller* crate version *0.1.6+20150326*, where *20150326* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
//!
//! Everything else about the *Ad Exchange Seller* *v2* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
@@ -124,14 +124,15 @@
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! Error::HttpError(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_) => println!("{}", e),
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
@@ -219,7 +220,7 @@ use std::io;
use std::fs;
use std::thread::sleep_ms;
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, JsonServerError};
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse};
// ##############
@@ -304,14 +305,15 @@ impl Default for Scope {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// Error::HttpError(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_) => println!("{}", e),
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
@@ -332,7 +334,7 @@ impl<'a, C, A> AdExchangeSeller<C, A>
AdExchangeSeller {
client: RefCell::new(client),
auth: RefCell::new(authenticator),
_user_agent: "google-api-rust-client/0.1.5".to_string(),
_user_agent: "google-api-rust-client/0.1.6".to_string(),
}
}
@@ -341,7 +343,7 @@ impl<'a, C, A> AdExchangeSeller<C, A>
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/0.1.5`.
/// It defaults to `google-api-rust-client/0.1.6`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
@@ -1310,12 +1312,17 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut<hyper
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -1324,7 +1331,7 @@ impl<'a, C, A> AccountReportSavedGenerateCall<'a, C, A> where C: BorrowMut<hyper
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -1575,12 +1582,17 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut<hyper:
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -1589,7 +1601,7 @@ impl<'a, C, A> AccountMetadataMetricListCall<'a, C, A> where C: BorrowMut<hyper:
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -1885,12 +1897,17 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut<hyper::Cli
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = if enable_resource_parsing {
let mut json_response = String::new();
@@ -1899,7 +1916,7 @@ impl<'a, C, A> AccountReportGenerateCall<'a, C, A> where C: BorrowMut<hyper::Cli
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
} else { (res, Default::default()) };
@@ -2204,12 +2221,17 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut<hyper::Cli
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2218,7 +2240,7 @@ impl<'a, C, A> AccountUrlchannelListCall<'a, C, A> where C: BorrowMut<hyper::Cli
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2472,12 +2494,17 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut<hyper::Cl
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2486,7 +2513,7 @@ impl<'a, C, A> AccountReportSavedListCall<'a, C, A> where C: BorrowMut<hyper::Cl
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2722,12 +2749,17 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut<hyper::C
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2736,7 +2768,7 @@ impl<'a, C, A> AccountPreferreddealGetCall<'a, C, A> where C: BorrowMut<hyper::C
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -2976,12 +3008,17 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut<hyper::Clien
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -2990,7 +3027,7 @@ impl<'a, C, A> AccountAdclientListCall<'a, C, A> where C: BorrowMut<hyper::Clien
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3224,12 +3261,17 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut<hyp
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3238,7 +3280,7 @@ impl<'a, C, A> AccountMetadataDimensionListCall<'a, C, A> where C: BorrowMut<hyp
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3462,12 +3504,17 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut<hyper::C
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3476,7 +3523,7 @@ impl<'a, C, A> AccountCustomchannelGetCall<'a, C, A> where C: BorrowMut<hyper::C
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3728,12 +3775,17 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut<hyper::
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3742,7 +3794,7 @@ impl<'a, C, A> AccountCustomchannelListCall<'a, C, A> where C: BorrowMut<hyper::
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -3970,12 +4022,17 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -3984,7 +4041,7 @@ impl<'a, C, A> AccountListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4213,12 +4270,17 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut<hyper::Client>,
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4227,7 +4289,7 @@ impl<'a, C, A> AccountAlertListCall<'a, C, A> where C: BorrowMut<hyper::Client>,
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4454,12 +4516,17 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut<hyper::
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4468,7 +4535,7 @@ impl<'a, C, A> AccountPreferreddealListCall<'a, C, A> where C: BorrowMut<hyper::
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};
@@ -4688,12 +4755,17 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
if !res.status.is_success() {
let mut json_err = String::new();
res.read_to_string(&mut json_err).unwrap();
if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok()) {
if let oauth2::Retry::After(d) = dlg.http_failure(&res,
json::from_str(&json_err).ok(),
json::from_str(&json_err).ok()) {
sleep_ms(d.num_milliseconds() as u32);
continue;
}
dlg.finished(false);
return Err(Error::Failure(res))
return match json::from_str::<ErrorResponse>(&json_err){
Err(_) => Err(Error::Failure(res)),
Ok(serr) => Err(Error::BadRequest(serr))
}
}
let result_value = {
let mut json_response = String::new();
@@ -4702,7 +4774,7 @@ impl<'a, C, A> AccountGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&json_response, &err);
return Err(Error::JsonDecodeError(err));
return Err(Error::JsonDecodeError(json_response, err));
}
}
};

View File

@@ -4,7 +4,7 @@
[package]
name = "google-admin1_directory-cli"
version = "0.0.1+20150314"
version = "0.1.0+20150314"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with directory (protocol directory_v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/admin1_directory-cli"

View File

@@ -1,4 +1,168 @@
# HELLO ADMIN:DIRECTORY_V1
<!---
DO NOT EDIT !
This file was generated automatically from 'src/mako/cli/README.md.mako'
DO NOT EDIT !
-->
The `admin1-directory` command-line interface *(CLI)* allows to use most features of the *Google directory* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
# Usage
This documentation was generated from the *directory* API at revision *20150314*. The CLI is at version *0.1.0*.
```bash
admin1-directory [options] asps delete <user-key> <code-id> [-p <v>...]
admin1-directory [options] asps get <user-key> <code-id> [-p <v>...] [-o <out>]
admin1-directory [options] asps list <user-key> [-p <v>...] [-o <out>]
admin1-directory [options] channels stop -r <kv>... [-p <v>...]
admin1-directory [options] chromeosdevices get <customer-id> <device-id> [-p <v>...] [-o <out>]
admin1-directory [options] chromeosdevices list <customer-id> [-p <v>...] [-o <out>]
admin1-directory [options] chromeosdevices patch <customer-id> <device-id> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] chromeosdevices update <customer-id> <device-id> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] groups aliases-delete <group-key> <alias> [-p <v>...]
admin1-directory [options] groups aliases-insert <group-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] groups aliases-list <group-key> [-p <v>...] [-o <out>]
admin1-directory [options] groups delete <group-key> [-p <v>...]
admin1-directory [options] groups get <group-key> [-p <v>...] [-o <out>]
admin1-directory [options] groups insert -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] groups list [-p <v>...] [-o <out>]
admin1-directory [options] groups patch <group-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] groups update <group-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] members delete <group-key> <member-key> [-p <v>...]
admin1-directory [options] members get <group-key> <member-key> [-p <v>...] [-o <out>]
admin1-directory [options] members insert <group-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] members list <group-key> [-p <v>...] [-o <out>]
admin1-directory [options] members patch <group-key> <member-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] members update <group-key> <member-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] mobiledevices action <customer-id> <resource-id> -r <kv>... [-p <v>...]
admin1-directory [options] mobiledevices delete <customer-id> <resource-id> [-p <v>...]
admin1-directory [options] mobiledevices get <customer-id> <resource-id> [-p <v>...] [-o <out>]
admin1-directory [options] mobiledevices list <customer-id> [-p <v>...] [-o <out>]
admin1-directory [options] notifications delete <customer> <notification-id> [-p <v>...]
admin1-directory [options] notifications get <customer> <notification-id> [-p <v>...] [-o <out>]
admin1-directory [options] notifications list <customer> [-p <v>...] [-o <out>]
admin1-directory [options] notifications patch <customer> <notification-id> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] notifications update <customer> <notification-id> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] orgunits delete <customer-id> <org-unit-path>... [-p <v>...]
admin1-directory [options] orgunits get <customer-id> <org-unit-path>... [-p <v>...] [-o <out>]
admin1-directory [options] orgunits insert <customer-id> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] orgunits list <customer-id> [-p <v>...] [-o <out>]
admin1-directory [options] orgunits patch <customer-id> <org-unit-path>... -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] orgunits update <customer-id> <org-unit-path>... -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] schemas delete <customer-id> <schema-key> [-p <v>...]
admin1-directory [options] schemas get <customer-id> <schema-key> [-p <v>...] [-o <out>]
admin1-directory [options] schemas insert <customer-id> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] schemas list <customer-id> [-p <v>...] [-o <out>]
admin1-directory [options] schemas patch <customer-id> <schema-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] schemas update <customer-id> <schema-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] tokens delete <user-key> <client-id> [-p <v>...]
admin1-directory [options] tokens get <user-key> <client-id> [-p <v>...] [-o <out>]
admin1-directory [options] tokens list <user-key> [-p <v>...] [-o <out>]
admin1-directory [options] users aliases-delete <user-key> <alias> [-p <v>...]
admin1-directory [options] users aliases-insert <user-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users aliases-list <user-key> [-p <v>...] [-o <out>]
admin1-directory [options] users aliases-watch <user-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users delete <user-key> [-p <v>...]
admin1-directory [options] users get <user-key> [-p <v>...] [-o <out>]
admin1-directory [options] users insert -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users list [-p <v>...] [-o <out>]
admin1-directory [options] users make-admin <user-key> -r <kv>... [-p <v>...]
admin1-directory [options] users patch <user-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users photos-delete <user-key> [-p <v>...]
admin1-directory [options] users photos-get <user-key> [-p <v>...] [-o <out>]
admin1-directory [options] users photos-patch <user-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users photos-update <user-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users undelete <user-key> -r <kv>... [-p <v>...]
admin1-directory [options] users update <user-key> -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] users watch -r <kv>... [-p <v>...] [-o <out>]
admin1-directory [options] verification-codes generate <user-key> [-p <v>...]
admin1-directory [options] verification-codes invalidate <user-key> [-p <v>...]
admin1-directory [options] verification-codes list <user-key> [-p <v>...] [-o <out>]
admin1-directory --help
All documentation details can be found at
http://byron.github.io/google-apis-rs/google_admin1_directory_cli/index.html
Configuration:
--scope <url>
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 <folder>
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.
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `admin1-directory-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/admin1-directory-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/admin1-directory-secret.json`, assuming that the required *admin* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
Include information about application secret files, and how we automatically write a default one.
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag
will cause all communication related to authentication to standard error.
If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the
issue at hand.
You may consider redirecting standard error into a file for ease of use, e.g. `admin1-directory --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -1,4 +1,4 @@
site_name: directory v0.0.1+20150314
site_name: directory v0.1.0+20150314
site_url: http://byron.github.io/google-apis-rs/google-admin1_directory-cli
site_description: Write integrating applications with bcore

View File

@@ -105,7 +105,7 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
let key = &kv[..pos];
if kv.len() <= pos + 1 {
add_err();
return (key, None)
return (key, Some(""))
}
(key, Some(&kv[pos+1..]))
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More