mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
fix(CLI): added latest reference CLI code
Just to have something to link to
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "google-drive2-cli"
|
name = "google-drive2-cli"
|
||||||
version = "0.1.0+20150326"
|
version = "0.2.0+20150326"
|
||||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||||
description = "A complete library to interact with drive (protocol v2)"
|
description = "A complete library to interact with drive (protocol v2)"
|
||||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2-cli"
|
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2-cli"
|
||||||
@@ -20,9 +20,7 @@ name = "drive2"
|
|||||||
hyper = "*"
|
hyper = "*"
|
||||||
mime = "*"
|
mime = "*"
|
||||||
yup-oauth2 = "*"
|
yup-oauth2 = "*"
|
||||||
docopt = "*"
|
clap = "*"
|
||||||
docopt_macros = "*"
|
|
||||||
rustc-serialize = "*"
|
|
||||||
yup-hyper-mock = "*"
|
yup-hyper-mock = "*"
|
||||||
serde = ">= 0.3.0"
|
serde = ">= 0.3.0"
|
||||||
serde_macros = "*"
|
serde_macros = "*"
|
||||||
|
|||||||
@@ -10,79 +10,96 @@ capabilities. Errors will be printed to standard error, and cause the program's
|
|||||||
|
|
||||||
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
|
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
|
||||||
|
|
||||||
|
Everything else about the *drive* API can be found at the
|
||||||
|
[official documentation site](https://developers.google.com/drive/).
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
This documentation was generated from the *drive* API at revision *20150326*. The CLI is at version *0.1.0*.
|
This documentation was generated from the *drive* API at revision *20150326*. The CLI is at version *0.2.0*.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
drive2 [options] about get [-p <v>...] [-o <out>]
|
drive2 [options]
|
||||||
drive2 [options] apps get <app-id> [-p <v>...] [-o <out>]
|
about
|
||||||
drive2 [options] apps list [-p <v>...] [-o <out>]
|
get [-p <v>]... [-o <out>]
|
||||||
drive2 [options] changes get <change-id> [-p <v>...] [-o <out>]
|
apps
|
||||||
drive2 [options] changes list [-p <v>...] [-o <out>]
|
get <app-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] changes watch -r <kv>... [-p <v>...] [-o <out>]
|
list [-p <v>]... [-o <out>]
|
||||||
drive2 [options] channels stop -r <kv>... [-p <v>...]
|
changes
|
||||||
drive2 [options] children delete <folder-id> <child-id> [-p <v>...]
|
get <change-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] children get <folder-id> <child-id> [-p <v>...] [-o <out>]
|
list [-p <v>]... [-o <out>]
|
||||||
drive2 [options] children insert <folder-id> -r <kv>... [-p <v>...] [-o <out>]
|
watch (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] children list <folder-id> [-p <v>...] [-o <out>]
|
channels
|
||||||
drive2 [options] comments delete <file-id> <comment-id> [-p <v>...]
|
stop (-r <kv>)... [-p <v>]...
|
||||||
drive2 [options] comments get <file-id> <comment-id> [-p <v>...] [-o <out>]
|
children
|
||||||
drive2 [options] comments insert <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
delete <folder-id> <child-id> [-p <v>]...
|
||||||
drive2 [options] comments list <file-id> [-p <v>...] [-o <out>]
|
get <folder-id> <child-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] comments patch <file-id> <comment-id> -r <kv>... [-p <v>...] [-o <out>]
|
insert <folder-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] comments update <file-id> <comment-id> -r <kv>... [-p <v>...] [-o <out>]
|
list <folder-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files copy <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
comments
|
||||||
drive2 [options] files delete <file-id> [-p <v>...]
|
delete <file-id> <comment-id> [-p <v>]...
|
||||||
drive2 [options] files empty-trash [-p <v>...]
|
get <file-id> <comment-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files get <file-id> [-p <v>...] [-o <out>]
|
insert <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files insert -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
list <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files list [-p <v>...] [-o <out>]
|
patch <file-id> <comment-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files patch <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
update <file-id> <comment-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files touch <file-id> [-p <v>...] [-o <out>]
|
files
|
||||||
drive2 [options] files trash <file-id> [-p <v>...] [-o <out>]
|
copy <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] files untrash <file-id> [-p <v>...] [-o <out>]
|
delete <file-id> [-p <v>]...
|
||||||
drive2 [options] files update <file-id> -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
empty-trash [-p <v>]...
|
||||||
drive2 [options] files watch <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
get <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] parents delete <file-id> <parent-id> [-p <v>...]
|
insert (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
drive2 [options] parents get <file-id> <parent-id> [-p <v>...] [-o <out>]
|
list [-p <v>]... [-o <out>]
|
||||||
drive2 [options] parents insert <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
patch <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] parents list <file-id> [-p <v>...] [-o <out>]
|
touch <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] permissions delete <file-id> <permission-id> [-p <v>...]
|
trash <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] permissions get <file-id> <permission-id> [-p <v>...] [-o <out>]
|
untrash <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] permissions get-id-for-email <email> [-p <v>...] [-o <out>]
|
update <file-id> (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
drive2 [options] permissions insert <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
watch <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] permissions list <file-id> [-p <v>...] [-o <out>]
|
parents
|
||||||
drive2 [options] permissions patch <file-id> <permission-id> -r <kv>... [-p <v>...] [-o <out>]
|
delete <file-id> <parent-id> [-p <v>]...
|
||||||
drive2 [options] permissions update <file-id> <permission-id> -r <kv>... [-p <v>...] [-o <out>]
|
get <file-id> <parent-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] properties delete <file-id> <property-key> [-p <v>...]
|
insert <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] properties get <file-id> <property-key> [-p <v>...] [-o <out>]
|
list <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] properties insert <file-id> -r <kv>... [-p <v>...] [-o <out>]
|
permissions
|
||||||
drive2 [options] properties list <file-id> [-p <v>...] [-o <out>]
|
delete <file-id> <permission-id> [-p <v>]...
|
||||||
drive2 [options] properties patch <file-id> <property-key> -r <kv>... [-p <v>...] [-o <out>]
|
get <file-id> <permission-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] properties update <file-id> <property-key> -r <kv>... [-p <v>...] [-o <out>]
|
get-id-for-email <email> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] realtime get <file-id> [-p <v>...] [-o <out>]
|
insert <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] realtime update <file-id> -u (simple|resumable) <file> <mime> [-p <v>...]
|
list <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] replies delete <file-id> <comment-id> <reply-id> [-p <v>...]
|
patch <file-id> <permission-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] replies get <file-id> <comment-id> <reply-id> [-p <v>...] [-o <out>]
|
update <file-id> <permission-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] replies insert <file-id> <comment-id> -r <kv>... [-p <v>...] [-o <out>]
|
properties
|
||||||
drive2 [options] replies list <file-id> <comment-id> [-p <v>...] [-o <out>]
|
delete <file-id> <property-key> [-p <v>]...
|
||||||
drive2 [options] replies patch <file-id> <comment-id> <reply-id> -r <kv>... [-p <v>...] [-o <out>]
|
get <file-id> <property-key> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] replies update <file-id> <comment-id> <reply-id> -r <kv>... [-p <v>...] [-o <out>]
|
insert <file-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] revisions delete <file-id> <revision-id> [-p <v>...]
|
list <file-id> [-p <v>]... [-o <out>]
|
||||||
drive2 [options] revisions get <file-id> <revision-id> [-p <v>...] [-o <out>]
|
patch <file-id> <property-key> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] revisions list <file-id> [-p <v>...] [-o <out>]
|
update <file-id> <property-key> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 [options] revisions patch <file-id> <revision-id> -r <kv>... [-p <v>...] [-o <out>]
|
realtime
|
||||||
drive2 [options] revisions update <file-id> <revision-id> -r <kv>... [-p <v>...] [-o <out>]
|
get <file-id> [-p <v>]... [-o <out>]
|
||||||
|
update <file-id> (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]...
|
||||||
|
replies
|
||||||
|
delete <file-id> <comment-id> <reply-id> [-p <v>]...
|
||||||
|
get <file-id> <comment-id> <reply-id> [-p <v>]... [-o <out>]
|
||||||
|
insert <file-id> <comment-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
|
list <file-id> <comment-id> [-p <v>]... [-o <out>]
|
||||||
|
patch <file-id> <comment-id> <reply-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
|
update <file-id> <comment-id> <reply-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
|
revisions
|
||||||
|
delete <file-id> <revision-id> [-p <v>]...
|
||||||
|
get <file-id> <revision-id> [-p <v>]... [-o <out>]
|
||||||
|
list <file-id> [-p <v>]... [-o <out>]
|
||||||
|
patch <file-id> <revision-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
|
update <file-id> <revision-id> (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
drive2 --help
|
drive2 --help
|
||||||
|
|
||||||
All documentation details can be found at
|
All documentation details can be found at
|
||||||
http://byron.github.io/google-apis-rs/google_drive2_cli/index.html
|
http://byron.github.io/google-apis-rs/google_drive2_cli
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
--scope <url>
|
[--scope <url>]...
|
||||||
Specify the authentication a method should be executed in. Each scope
|
Specify the authentication a method should be executed in. Each scope
|
||||||
requires the user to grant this application permission to use it.
|
requires the user to grant this application permission to use it.
|
||||||
If unset, it defaults to the shortest scope url for a particular method.
|
If unset, it defaults to the shortest scope url for a particular method.
|
||||||
--config-dir <folder>
|
--config-dir <folder>
|
||||||
A directory into which we will store our persistent data. Defaults to
|
A directory into which we will store our persistent data. Defaults to
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
site_name: drive v0.1.0+20150326
|
site_name: drive v0.2.0+20150326
|
||||||
site_url: http://byron.github.io/google-apis-rs/google-drive2-cli
|
site_url: http://byron.github.io/google-apis-rs/google-drive2-cli
|
||||||
site_description: Write integrating applications with bcore
|
site_description: Write integrating applications with bcore
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// COPY OF 'src/rust/cli/cmn.rs'
|
// COPY OF 'src/rust/cli/cmn.rs'
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
||||||
use rustc_serialize::json;
|
use serde::json;
|
||||||
use mime::Mime;
|
use mime::Mime;
|
||||||
|
use clap::{App, SubCommand};
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::env;
|
use std::env;
|
||||||
@@ -17,6 +18,46 @@ use std::default::Default;
|
|||||||
|
|
||||||
const FIELD_SEP: char = '.';
|
const FIELD_SEP: char = '.';
|
||||||
|
|
||||||
|
pub enum CallType {
|
||||||
|
Upload(UploadProtocol),
|
||||||
|
Standard,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum UploadProtocol {
|
||||||
|
Simple,
|
||||||
|
Resumable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<str> for UploadProtocol {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
UploadProtocol::Simple => "simple",
|
||||||
|
UploadProtocol::Resumable => "resumable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<str> for CallType {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
CallType::Upload(ref proto) => proto.as_ref(),
|
||||||
|
CallType::Standard => "standard-request"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for UploadProtocol {
|
||||||
|
type Err = String;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<UploadProtocol, String> {
|
||||||
|
match s {
|
||||||
|
"simple" => Ok(UploadProtocol::Simple),
|
||||||
|
"resumable" => Ok(UploadProtocol::Resumable),
|
||||||
|
_ => Err(format!("Protocol '{}' is unknown", s)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct FieldCursor(Vec<String>);
|
pub struct FieldCursor(Vec<String>);
|
||||||
|
|
||||||
@@ -112,6 +153,17 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn protocol_from_str(name: &str, valid_protocols: Vec<String>, err: &mut InvalidOptionsError) -> CallType {
|
||||||
|
CallType::Upload(
|
||||||
|
match UploadProtocol::from_str(name) {
|
||||||
|
Ok(up) => up,
|
||||||
|
Err(msg) => {
|
||||||
|
err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols));
|
||||||
|
UploadProtocol::Simple
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
||||||
match fs::File::open(file_path) {
|
match fs::File::open(file_path) {
|
||||||
Ok(f) => Some(f),
|
Ok(f) => Some(f),
|
||||||
@@ -132,13 +184,14 @@ pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// May panic if we can't open the file - this is anticipated, we can't currently communicate this
|
pub fn writer_from_opts(arg: Option<&str>) -> Result<Box<Write>, io::Error> {
|
||||||
// kind of error: TODO: fix this architecture :)
|
let f = arg.unwrap_or("-");
|
||||||
pub fn writer_from_opts(flag: bool, arg: &str) -> Box<Write> {
|
match f {
|
||||||
if !flag || arg == "-" {
|
"-" => Ok(Box::new(stdout())),
|
||||||
Box::new(stdout())
|
_ => match fs::OpenOptions::new().create(true).write(true).open(f) {
|
||||||
} else {
|
Ok(f) => Ok(Box::new(f)),
|
||||||
Box::new(fs::OpenOptions::new().create(true).write(true).open(arg).unwrap())
|
Err(io_err) => Err(io_err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +204,7 @@ pub fn arg_from_str<T>(arg: &str, err: &mut InvalidOptionsError,
|
|||||||
match FromStr::from_str(arg) {
|
match FromStr::from_str(arg) {
|
||||||
Err(perr) => {
|
Err(perr) => {
|
||||||
err.issues.push(
|
err.issues.push(
|
||||||
CLIError::ParseError((arg_name, arg_type, arg.to_string(), format!("{}", perr)))
|
CLIError::ParseError(arg_name, arg_type, arg.to_string(), format!("{}", perr))
|
||||||
);
|
);
|
||||||
Default::default()
|
Default::default()
|
||||||
},
|
},
|
||||||
@@ -171,49 +224,47 @@ impl JsonTokenStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TokenStorage for JsonTokenStorage {
|
impl TokenStorage for JsonTokenStorage {
|
||||||
type Error = io::Error;
|
type Error = json::Error;
|
||||||
|
|
||||||
// NOTE: logging might be interesting, currently we swallow all errors
|
// NOTE: logging might be interesting, currently we swallow all errors
|
||||||
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Option<io::Error> {
|
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Result<(), json::Error> {
|
||||||
match token {
|
match token {
|
||||||
None => {
|
None => {
|
||||||
match fs::remove_file(self.path(scope_hash)) {
|
match fs::remove_file(self.path(scope_hash)) {
|
||||||
Err(err) =>
|
Err(err) =>
|
||||||
match err.kind() {
|
match err.kind() {
|
||||||
io::ErrorKind::NotFound => None,
|
io::ErrorKind::NotFound => Ok(()),
|
||||||
_ => Some(err)
|
_ => Err(json::Error::IoError(err))
|
||||||
},
|
},
|
||||||
Ok(_) => None
|
Ok(_) => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(token) => {
|
Some(token) => {
|
||||||
let json_token = json::encode(&token).unwrap();
|
|
||||||
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
match f.write(json_token.as_bytes()) {
|
match json::to_writer_pretty(&mut f, &token) {
|
||||||
Ok(_) => None,
|
Ok(_) => Ok(()),
|
||||||
Err(io_err) => Some(io_err),
|
Err(io_err) => Err(json::Error::IoError(io_err)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(io_err) => Some(io_err)
|
Err(io_err) => Err(json::Error::IoError(io_err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, io::Error> {
|
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, json::Error> {
|
||||||
match fs::File::open(&self.path(scope_hash)) {
|
match fs::File::open(&self.path(scope_hash)) {
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
let mut json_string = String::new();
|
match json::de::from_reader(f) {
|
||||||
match f.read_to_string(&mut json_string) {
|
Ok(token) => Ok(Some(token)),
|
||||||
Ok(_) => Ok(Some(json::decode::<Token>(&json_string).unwrap())),
|
Err(err) => Err(err),
|
||||||
Err(io_err) => Err(io_err),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(io_err) => {
|
Err(io_err) => {
|
||||||
match io_err.kind() {
|
match io_err.kind() {
|
||||||
io::ErrorKind::NotFound => Ok(None),
|
io::ErrorKind::NotFound => Ok(None),
|
||||||
_ => Err(io_err)
|
_ => Err(json::Error::IoError(io_err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +274,7 @@ impl TokenStorage for JsonTokenStorage {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ApplicationSecretError {
|
pub enum ApplicationSecretError {
|
||||||
DecoderError((String, json::DecoderError)),
|
DecoderError((String, json::Error)),
|
||||||
FormatError(String),
|
FormatError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,11 +362,14 @@ impl fmt::Display for FieldError {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CLIError {
|
pub enum CLIError {
|
||||||
Configuration(ConfigurationError),
|
Configuration(ConfigurationError),
|
||||||
ParseError((&'static str, &'static str, String, String)),
|
ParseError(&'static str, &'static str, String, String),
|
||||||
UnknownParameter(String),
|
UnknownParameter(String),
|
||||||
|
InvalidUploadProtocol(String, Vec<String>),
|
||||||
InvalidKeyValueSyntax(String, bool),
|
InvalidKeyValueSyntax(String, bool),
|
||||||
Input(InputError),
|
Input(InputError),
|
||||||
Field(FieldError),
|
Field(FieldError),
|
||||||
|
MissingCommandError,
|
||||||
|
MissingMethodError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for CLIError {
|
impl fmt::Display for CLIError {
|
||||||
@@ -324,7 +378,9 @@ impl fmt::Display for CLIError {
|
|||||||
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
||||||
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
||||||
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
||||||
CLIError::ParseError((arg_name, type_name, ref value, ref err_desc))
|
CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names)
|
||||||
|
=> writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}", proto_name, valid_names.connect(", ")),
|
||||||
|
CLIError::ParseError(arg_name, type_name, ref value, ref err_desc)
|
||||||
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
||||||
arg_name, value, type_name, err_desc),
|
arg_name, value, type_name, err_desc),
|
||||||
CLIError::UnknownParameter(ref param_name)
|
CLIError::UnknownParameter(ref param_name)
|
||||||
@@ -333,6 +389,8 @@ impl fmt::Display for CLIError {
|
|||||||
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
||||||
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
||||||
},
|
},
|
||||||
|
CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command"),
|
||||||
|
CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command", cmd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,7 +457,7 @@ pub fn assure_config_dir_exists(dir: &str) -> Result<String, CLIError> {
|
|||||||
|
|
||||||
pub fn application_secret_from_directory(dir: &str,
|
pub fn application_secret_from_directory(dir: &str,
|
||||||
secret_basename: &str,
|
secret_basename: &str,
|
||||||
json_app_secret: &str)
|
json_console_secret: &str)
|
||||||
-> Result<ApplicationSecret, CLIError> {
|
-> Result<ApplicationSecret, CLIError> {
|
||||||
let secret_path = Path::new(dir).join(secret_basename);
|
let secret_path = Path::new(dir).join(secret_basename);
|
||||||
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
||||||
@@ -418,7 +476,10 @@ pub fn application_secret_from_directory(dir: &str,
|
|||||||
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
||||||
Err(cfe) => cfe,
|
Err(cfe) => cfe,
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
match f.write(json_app_secret.as_bytes()) {
|
// Assure we convert 'ugly' json string into pretty one
|
||||||
|
let console_secret: ConsoleApplicationSecret
|
||||||
|
= json::from_str(json_console_secret).unwrap();
|
||||||
|
match json::to_writer_pretty(&mut f, &console_secret) {
|
||||||
Err(io_err) => io_err,
|
Err(io_err) => io_err,
|
||||||
Ok(_) => continue,
|
Ok(_) => continue,
|
||||||
}
|
}
|
||||||
@@ -429,23 +490,24 @@ pub fn application_secret_from_directory(dir: &str,
|
|||||||
return secret_io_error(err)
|
return secret_io_error(err)
|
||||||
},
|
},
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
let mut json_encoded_secret = String::new();
|
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
|
||||||
if let Err(io_err) = f.read_to_string(&mut json_encoded_secret) {
|
Err(json::Error::IoError(err)) =>
|
||||||
return secret_io_error(io_err)
|
return secret_io_error(err),
|
||||||
}
|
Err(json_err) =>
|
||||||
match json::decode::<ConsoleApplicationSecret>(&json_encoded_secret) {
|
return Err(CLIError::Configuration(
|
||||||
Err(json_decode_error) => return Err(CLIError::Configuration(
|
ConfigurationError::Secret(
|
||||||
ConfigurationError::Secret(ApplicationSecretError::DecoderError(
|
ApplicationSecretError::DecoderError(
|
||||||
(secret_str(), json_decode_error)
|
(secret_str(), json_err)
|
||||||
)))),
|
)))),
|
||||||
Ok(console_secret) => match console_secret.installed {
|
Ok(console_secret) =>
|
||||||
Some(secret) => return Ok(secret),
|
match console_secret.installed {
|
||||||
None => return Err(
|
Some(secret) => return Ok(secret),
|
||||||
CLIError::Configuration(
|
None => return Err(
|
||||||
ConfigurationError::Secret(
|
CLIError::Configuration(
|
||||||
ApplicationSecretError::FormatError(secret_str())
|
ConfigurationError::Secret(
|
||||||
)))
|
ApplicationSecretError::FormatError(secret_str())
|
||||||
},
|
)))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "google-drive2"
|
name = "google-drive2"
|
||||||
version = "0.1.6+20150326"
|
version = "0.1.7+20150326"
|
||||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||||
description = "A complete library to interact with drive (protocol v2)"
|
description = "A complete library to interact with drive (protocol v2)"
|
||||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2"
|
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/drive2"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ DO NOT EDIT !
|
|||||||
-->
|
-->
|
||||||
The `google-drive2` library allows access to all features of the *Google drive* service.
|
The `google-drive2` library allows access to all features of the *Google drive* service.
|
||||||
|
|
||||||
This documentation was generated from *drive* crate version *0.1.6+20150326*, where *20150326* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
This documentation was generated from *drive* crate version *0.1.7+20150326*, where *20150326* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||||
|
|
||||||
Everything else about the *drive* *v2* API can be found at the
|
Everything else about the *drive* *v2* API can be found at the
|
||||||
[official documentation site](https://developers.google.com/drive/).
|
[official documentation site](https://developers.google.com/drive/).
|
||||||
@@ -230,7 +230,7 @@ These will always take a single argument, for which the following statements are
|
|||||||
|
|
||||||
* [PODs][wiki-pod] are handed by copy
|
* [PODs][wiki-pod] are handed by copy
|
||||||
* strings are passed as `&str`
|
* strings are passed as `&str`
|
||||||
* [request values](http://byron.github.io/google-apis-rs/google_drive2/trait.RequestValue.html) are borrowed
|
* [request values](http://byron.github.io/google-apis-rs/google_drive2/trait.RequestValue.html) are moved
|
||||||
|
|
||||||
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,10 @@ pub trait Delegate {
|
|||||||
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
||||||
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
||||||
/// see `upload_url()`.
|
/// see `upload_url()`.
|
||||||
fn store_upload_url(&mut self, url: &str) {
|
/// It will also be called with None after a successful upload, which allows the delegate
|
||||||
|
/// to forget the URL. That way, we will not attempt to resume an upload that has already
|
||||||
|
/// finished.
|
||||||
|
fn store_upload_url(&mut self, url: Option<&str>) {
|
||||||
let _ = url;
|
let _ = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,6 +462,16 @@ impl<'a> Read for MultiPartReader<'a> {
|
|||||||
header!{
|
header!{
|
||||||
#[doc="The `X-Upload-Content-Type` header."]
|
#[doc="The `X-Upload-Content-Type` header."]
|
||||||
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
||||||
|
|
||||||
|
xupload_content_type {
|
||||||
|
test_header!(
|
||||||
|
test1,
|
||||||
|
vec![b"text/plain"],
|
||||||
|
Some(HeaderField(
|
||||||
|
vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())]
|
||||||
|
)));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
||||||
// DO NOT EDIT !
|
// DO NOT EDIT !
|
||||||
|
|
||||||
//! This documentation was generated from *drive* crate version *0.1.6+20150326*, where *20150326* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
//! This documentation was generated from *drive* crate version *0.1.7+20150326*, where *20150326* is the exact revision of the *drive:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||||
//!
|
//!
|
||||||
//! Everything else about the *drive* *v2* API can be found at the
|
//! Everything else about the *drive* *v2* API can be found at the
|
||||||
//! [official documentation site](https://developers.google.com/drive/).
|
//! [official documentation site](https://developers.google.com/drive/).
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
//!
|
//!
|
||||||
//! * [PODs][wiki-pod] are handed by copy
|
//! * [PODs][wiki-pod] are handed by copy
|
||||||
//! * strings are passed as `&str`
|
//! * strings are passed as `&str`
|
||||||
//! * [request values](trait.RequestValue.html) are borrowed
|
//! * [request values](trait.RequestValue.html) are moved
|
||||||
//!
|
//!
|
||||||
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
||||||
//!
|
//!
|
||||||
@@ -240,7 +240,6 @@
|
|||||||
//! [google-go-api]: https://github.com/google/google-api-go-client
|
//! [google-go-api]: https://github.com/google/google-api-go-client
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
#![feature(std_misc)]
|
|
||||||
// Unused attributes happen thanks to defined, but unused structures
|
// Unused attributes happen thanks to defined, but unused structures
|
||||||
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
||||||
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
||||||
@@ -418,7 +417,7 @@ impl<'a, C, A> Drive<C, A>
|
|||||||
Drive {
|
Drive {
|
||||||
client: RefCell::new(client),
|
client: RefCell::new(client),
|
||||||
auth: RefCell::new(authenticator),
|
auth: RefCell::new(authenticator),
|
||||||
_user_agent: "google-api-rust-client/0.1.6".to_string(),
|
_user_agent: "google-api-rust-client/0.1.7".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +462,7 @@ impl<'a, C, A> Drive<C, A>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set the user-agent header field to use in all requests to the server.
|
/// Set the user-agent header field to use in all requests to the server.
|
||||||
/// It defaults to `google-api-rust-client/0.1.6`.
|
/// It defaults to `google-api-rust-client/0.1.7`.
|
||||||
///
|
///
|
||||||
/// Returns the previously set user-agent.
|
/// Returns the previously set user-agent.
|
||||||
pub fn user_agent(&mut self, agent_name: String) -> String {
|
pub fn user_agent(&mut self, agent_name: String) -> String {
|
||||||
@@ -3782,7 +3781,7 @@ impl<'a, C, A> FileWatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -4129,7 +4128,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
_ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())),
|
_ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())),
|
||||||
};
|
};
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(content_type)
|
.header(content_type)
|
||||||
@@ -4179,7 +4178,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -4207,6 +4206,7 @@ impl<'a, C, A> FileInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -4500,7 +4500,7 @@ impl<'a, C, A> FileUntrashCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -4786,7 +4786,7 @@ impl<'a, C, A> FileCopyCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oaut
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -5086,7 +5086,7 @@ impl<'a, C, A> FileTrashCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -5298,7 +5298,7 @@ impl<'a, C, A> FileEmptyTrashCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -5516,7 +5516,7 @@ impl<'a, C, A> FileListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oaut
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -5780,7 +5780,7 @@ impl<'a, C, A> FileTouchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -6133,7 +6133,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
_ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())),
|
_ => (&mut request_value_reader as &mut io::Read, ContentType(json_mime_type.clone())),
|
||||||
};
|
};
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(content_type)
|
.header(content_type)
|
||||||
@@ -6183,7 +6183,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -6211,6 +6211,7 @@ impl<'a, C, A> FileUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -6541,7 +6542,7 @@ impl<'a, C, A> FileDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -6842,7 +6843,7 @@ impl<'a, C, A> FilePatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -7218,7 +7219,7 @@ impl<'a, C, A> FileGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -7474,7 +7475,7 @@ impl<'a, C, A> AboutGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oaut
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -7754,7 +7755,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
response
|
response
|
||||||
} else {
|
} else {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
if protocol == "simple" {
|
if protocol == "simple" {
|
||||||
@@ -7812,7 +7813,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -7840,6 +7841,7 @@ impl<'a, C, A> RealtimeUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -8082,7 +8084,7 @@ impl<'a, C, A> RealtimeGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -8318,7 +8320,7 @@ impl<'a, C, A> AppGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth2
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -8546,7 +8548,7 @@ impl<'a, C, A> AppListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oauth
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -8797,7 +8799,7 @@ impl<'a, C, A> CommentDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -9043,7 +9045,7 @@ impl<'a, C, A> CommentGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -9311,7 +9313,7 @@ impl<'a, C, A> CommentInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -9576,7 +9578,7 @@ impl<'a, C, A> CommentPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -9851,7 +9853,7 @@ impl<'a, C, A> CommentUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -10132,7 +10134,7 @@ impl<'a, C, A> CommentListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -10414,7 +10416,7 @@ impl<'a, C, A> ChildrenListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -10676,7 +10678,7 @@ impl<'a, C, A> ChildrenGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -10926,7 +10928,7 @@ impl<'a, C, A> ChildrenDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -11177,7 +11179,7 @@ impl<'a, C, A> ChildrenInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -11413,7 +11415,7 @@ impl<'a, C, A> ChannelStopCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -11644,7 +11646,7 @@ impl<'a, C, A> ParentListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -11884,7 +11886,7 @@ impl<'a, C, A> ParentDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -12135,7 +12137,7 @@ impl<'a, C, A> ParentInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -12388,7 +12390,7 @@ impl<'a, C, A> ParentGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -12653,7 +12655,7 @@ impl<'a, C, A> ReplyPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -12941,7 +12943,7 @@ impl<'a, C, A> ReplyListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -13220,7 +13222,7 @@ impl<'a, C, A> ReplyGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oaut
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -13500,7 +13502,7 @@ impl<'a, C, A> ReplyInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -13764,7 +13766,7 @@ impl<'a, C, A> ReplyDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -14029,7 +14031,7 @@ impl<'a, C, A> ReplyUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -14301,7 +14303,7 @@ impl<'a, C, A> PermissionDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -14562,7 +14564,7 @@ impl<'a, C, A> PermissionInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -14846,7 +14848,7 @@ impl<'a, C, A> PermissionUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -15133,7 +15135,7 @@ impl<'a, C, A> PermissionPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>,
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -15401,7 +15403,7 @@ impl<'a, C, A> PermissionListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -15642,7 +15644,7 @@ impl<'a, C, A> PermissionGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -15891,7 +15893,7 @@ impl<'a, C, A> PermissionGetIdForEmailCall<'a, C, A> where C: BorrowMut<hyper::C
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -16141,7 +16143,7 @@ impl<'a, C, A> ChangeWatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -16416,7 +16418,7 @@ impl<'a, C, A> ChangeListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oa
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -16680,7 +16682,7 @@ impl<'a, C, A> ChangeGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: oau
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -16938,7 +16940,7 @@ impl<'a, C, A> PropertyPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -17212,7 +17214,7 @@ impl<'a, C, A> PropertyDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -17470,7 +17472,7 @@ impl<'a, C, A> PropertyInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -17721,7 +17723,7 @@ impl<'a, C, A> PropertyListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -17979,7 +17981,7 @@ impl<'a, C, A> PropertyUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -18254,7 +18256,7 @@ impl<'a, C, A> PropertyGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -18512,7 +18514,7 @@ impl<'a, C, A> RevisionGetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -18762,7 +18764,7 @@ impl<'a, C, A> RevisionDeleteCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -19015,7 +19017,7 @@ impl<'a, C, A> RevisionUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Put, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
@@ -19276,7 +19278,7 @@ impl<'a, C, A> RevisionListCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
access_token: token.access_token });
|
access_token: token.access_token });
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Get, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
|
|
||||||
@@ -19529,7 +19531,7 @@ impl<'a, C, A> RevisionPatchCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
||||||
let mut req_result = {
|
let mut req_result = {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Patch, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone())
|
.header(auth_header.clone())
|
||||||
.header(ContentType(json_mime_type.clone()))
|
.header(ContentType(json_mime_type.clone()))
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "google-groupsmigration1-cli"
|
name = "google-groupsmigration1-cli"
|
||||||
version = "0.1.0+20140416"
|
version = "0.2.0+20140416"
|
||||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||||
description = "A complete library to interact with Groups Migration (protocol v1)"
|
description = "A complete library to interact with Groups Migration (protocol v1)"
|
||||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1-cli"
|
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1-cli"
|
||||||
@@ -20,9 +20,7 @@ name = "groupsmigration1"
|
|||||||
hyper = "*"
|
hyper = "*"
|
||||||
mime = "*"
|
mime = "*"
|
||||||
yup-oauth2 = "*"
|
yup-oauth2 = "*"
|
||||||
docopt = "*"
|
clap = "*"
|
||||||
docopt_macros = "*"
|
|
||||||
rustc-serialize = "*"
|
|
||||||
yup-hyper-mock = "*"
|
yup-hyper-mock = "*"
|
||||||
serde = ">= 0.3.0"
|
serde = ">= 0.3.0"
|
||||||
serde_macros = "*"
|
serde_macros = "*"
|
||||||
|
|||||||
@@ -10,21 +10,26 @@ capabilities. Errors will be printed to standard error, and cause the program's
|
|||||||
|
|
||||||
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
|
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
|
||||||
|
|
||||||
|
Everything else about the *Groups Migration* API can be found at the
|
||||||
|
[official documentation site](https://developers.google.com/google-apps/groups-migration/).
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
This documentation was generated from the *Groups Migration* API at revision *20140416*. The CLI is at version *0.1.0*.
|
This documentation was generated from the *Groups Migration* API at revision *20140416*. The CLI is at version *0.2.0*.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
groupsmigration1 [options] archive insert <group-id> -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
groupsmigration1 [options]
|
||||||
|
archive
|
||||||
|
insert <group-id> (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
groupsmigration1 --help
|
groupsmigration1 --help
|
||||||
|
|
||||||
All documentation details can be found at
|
All documentation details can be found at
|
||||||
http://byron.github.io/google-apis-rs/google_groupsmigration1_cli/index.html
|
http://byron.github.io/google-apis-rs/google_groupsmigration1_cli
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
--scope <url>
|
[--scope <url>]...
|
||||||
Specify the authentication a method should be executed in. Each scope
|
Specify the authentication a method should be executed in. Each scope
|
||||||
requires the user to grant this application permission to use it.
|
requires the user to grant this application permission to use it.
|
||||||
If unset, it defaults to the shortest scope url for a particular method.
|
If unset, it defaults to the shortest scope url for a particular method.
|
||||||
--config-dir <folder>
|
--config-dir <folder>
|
||||||
A directory into which we will store our persistent data. Defaults to
|
A directory into which we will store our persistent data. Defaults to
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
site_name: Groups Migration v0.1.0+20140416
|
site_name: Groups Migration v0.2.0+20140416
|
||||||
site_url: http://byron.github.io/google-apis-rs/google-groupsmigration1-cli
|
site_url: http://byron.github.io/google-apis-rs/google-groupsmigration1-cli
|
||||||
site_description: Write integrating applications with bcore
|
site_description: Write integrating applications with bcore
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// COPY OF 'src/rust/cli/cmn.rs'
|
// COPY OF 'src/rust/cli/cmn.rs'
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
||||||
use rustc_serialize::json;
|
use serde::json;
|
||||||
use mime::Mime;
|
use mime::Mime;
|
||||||
|
use clap::{App, SubCommand};
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::env;
|
use std::env;
|
||||||
@@ -17,6 +18,46 @@ use std::default::Default;
|
|||||||
|
|
||||||
const FIELD_SEP: char = '.';
|
const FIELD_SEP: char = '.';
|
||||||
|
|
||||||
|
pub enum CallType {
|
||||||
|
Upload(UploadProtocol),
|
||||||
|
Standard,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum UploadProtocol {
|
||||||
|
Simple,
|
||||||
|
Resumable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<str> for UploadProtocol {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
UploadProtocol::Simple => "simple",
|
||||||
|
UploadProtocol::Resumable => "resumable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<str> for CallType {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
CallType::Upload(ref proto) => proto.as_ref(),
|
||||||
|
CallType::Standard => "standard-request"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for UploadProtocol {
|
||||||
|
type Err = String;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<UploadProtocol, String> {
|
||||||
|
match s {
|
||||||
|
"simple" => Ok(UploadProtocol::Simple),
|
||||||
|
"resumable" => Ok(UploadProtocol::Resumable),
|
||||||
|
_ => Err(format!("Protocol '{}' is unknown", s)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct FieldCursor(Vec<String>);
|
pub struct FieldCursor(Vec<String>);
|
||||||
|
|
||||||
@@ -112,6 +153,17 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn protocol_from_str(name: &str, valid_protocols: Vec<String>, err: &mut InvalidOptionsError) -> CallType {
|
||||||
|
CallType::Upload(
|
||||||
|
match UploadProtocol::from_str(name) {
|
||||||
|
Ok(up) => up,
|
||||||
|
Err(msg) => {
|
||||||
|
err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols));
|
||||||
|
UploadProtocol::Simple
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
||||||
match fs::File::open(file_path) {
|
match fs::File::open(file_path) {
|
||||||
Ok(f) => Some(f),
|
Ok(f) => Some(f),
|
||||||
@@ -132,13 +184,14 @@ pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// May panic if we can't open the file - this is anticipated, we can't currently communicate this
|
pub fn writer_from_opts(arg: Option<&str>) -> Result<Box<Write>, io::Error> {
|
||||||
// kind of error: TODO: fix this architecture :)
|
let f = arg.unwrap_or("-");
|
||||||
pub fn writer_from_opts(flag: bool, arg: &str) -> Box<Write> {
|
match f {
|
||||||
if !flag || arg == "-" {
|
"-" => Ok(Box::new(stdout())),
|
||||||
Box::new(stdout())
|
_ => match fs::OpenOptions::new().create(true).write(true).open(f) {
|
||||||
} else {
|
Ok(f) => Ok(Box::new(f)),
|
||||||
Box::new(fs::OpenOptions::new().create(true).write(true).open(arg).unwrap())
|
Err(io_err) => Err(io_err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +204,7 @@ pub fn arg_from_str<T>(arg: &str, err: &mut InvalidOptionsError,
|
|||||||
match FromStr::from_str(arg) {
|
match FromStr::from_str(arg) {
|
||||||
Err(perr) => {
|
Err(perr) => {
|
||||||
err.issues.push(
|
err.issues.push(
|
||||||
CLIError::ParseError((arg_name, arg_type, arg.to_string(), format!("{}", perr)))
|
CLIError::ParseError(arg_name, arg_type, arg.to_string(), format!("{}", perr))
|
||||||
);
|
);
|
||||||
Default::default()
|
Default::default()
|
||||||
},
|
},
|
||||||
@@ -171,49 +224,47 @@ impl JsonTokenStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TokenStorage for JsonTokenStorage {
|
impl TokenStorage for JsonTokenStorage {
|
||||||
type Error = io::Error;
|
type Error = json::Error;
|
||||||
|
|
||||||
// NOTE: logging might be interesting, currently we swallow all errors
|
// NOTE: logging might be interesting, currently we swallow all errors
|
||||||
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Option<io::Error> {
|
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Result<(), json::Error> {
|
||||||
match token {
|
match token {
|
||||||
None => {
|
None => {
|
||||||
match fs::remove_file(self.path(scope_hash)) {
|
match fs::remove_file(self.path(scope_hash)) {
|
||||||
Err(err) =>
|
Err(err) =>
|
||||||
match err.kind() {
|
match err.kind() {
|
||||||
io::ErrorKind::NotFound => None,
|
io::ErrorKind::NotFound => Ok(()),
|
||||||
_ => Some(err)
|
_ => Err(json::Error::IoError(err))
|
||||||
},
|
},
|
||||||
Ok(_) => None
|
Ok(_) => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(token) => {
|
Some(token) => {
|
||||||
let json_token = json::encode(&token).unwrap();
|
|
||||||
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
match f.write(json_token.as_bytes()) {
|
match json::to_writer_pretty(&mut f, &token) {
|
||||||
Ok(_) => None,
|
Ok(_) => Ok(()),
|
||||||
Err(io_err) => Some(io_err),
|
Err(io_err) => Err(json::Error::IoError(io_err)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(io_err) => Some(io_err)
|
Err(io_err) => Err(json::Error::IoError(io_err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, io::Error> {
|
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, json::Error> {
|
||||||
match fs::File::open(&self.path(scope_hash)) {
|
match fs::File::open(&self.path(scope_hash)) {
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
let mut json_string = String::new();
|
match json::de::from_reader(f) {
|
||||||
match f.read_to_string(&mut json_string) {
|
Ok(token) => Ok(Some(token)),
|
||||||
Ok(_) => Ok(Some(json::decode::<Token>(&json_string).unwrap())),
|
Err(err) => Err(err),
|
||||||
Err(io_err) => Err(io_err),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(io_err) => {
|
Err(io_err) => {
|
||||||
match io_err.kind() {
|
match io_err.kind() {
|
||||||
io::ErrorKind::NotFound => Ok(None),
|
io::ErrorKind::NotFound => Ok(None),
|
||||||
_ => Err(io_err)
|
_ => Err(json::Error::IoError(io_err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +274,7 @@ impl TokenStorage for JsonTokenStorage {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ApplicationSecretError {
|
pub enum ApplicationSecretError {
|
||||||
DecoderError((String, json::DecoderError)),
|
DecoderError((String, json::Error)),
|
||||||
FormatError(String),
|
FormatError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,11 +362,14 @@ impl fmt::Display for FieldError {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CLIError {
|
pub enum CLIError {
|
||||||
Configuration(ConfigurationError),
|
Configuration(ConfigurationError),
|
||||||
ParseError((&'static str, &'static str, String, String)),
|
ParseError(&'static str, &'static str, String, String),
|
||||||
UnknownParameter(String),
|
UnknownParameter(String),
|
||||||
|
InvalidUploadProtocol(String, Vec<String>),
|
||||||
InvalidKeyValueSyntax(String, bool),
|
InvalidKeyValueSyntax(String, bool),
|
||||||
Input(InputError),
|
Input(InputError),
|
||||||
Field(FieldError),
|
Field(FieldError),
|
||||||
|
MissingCommandError,
|
||||||
|
MissingMethodError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for CLIError {
|
impl fmt::Display for CLIError {
|
||||||
@@ -324,7 +378,9 @@ impl fmt::Display for CLIError {
|
|||||||
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
||||||
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
||||||
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
||||||
CLIError::ParseError((arg_name, type_name, ref value, ref err_desc))
|
CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names)
|
||||||
|
=> writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}", proto_name, valid_names.connect(", ")),
|
||||||
|
CLIError::ParseError(arg_name, type_name, ref value, ref err_desc)
|
||||||
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
||||||
arg_name, value, type_name, err_desc),
|
arg_name, value, type_name, err_desc),
|
||||||
CLIError::UnknownParameter(ref param_name)
|
CLIError::UnknownParameter(ref param_name)
|
||||||
@@ -333,6 +389,8 @@ impl fmt::Display for CLIError {
|
|||||||
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
||||||
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
||||||
},
|
},
|
||||||
|
CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command"),
|
||||||
|
CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command", cmd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,7 +457,7 @@ pub fn assure_config_dir_exists(dir: &str) -> Result<String, CLIError> {
|
|||||||
|
|
||||||
pub fn application_secret_from_directory(dir: &str,
|
pub fn application_secret_from_directory(dir: &str,
|
||||||
secret_basename: &str,
|
secret_basename: &str,
|
||||||
json_app_secret: &str)
|
json_console_secret: &str)
|
||||||
-> Result<ApplicationSecret, CLIError> {
|
-> Result<ApplicationSecret, CLIError> {
|
||||||
let secret_path = Path::new(dir).join(secret_basename);
|
let secret_path = Path::new(dir).join(secret_basename);
|
||||||
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
||||||
@@ -418,7 +476,10 @@ pub fn application_secret_from_directory(dir: &str,
|
|||||||
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
||||||
Err(cfe) => cfe,
|
Err(cfe) => cfe,
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
match f.write(json_app_secret.as_bytes()) {
|
// Assure we convert 'ugly' json string into pretty one
|
||||||
|
let console_secret: ConsoleApplicationSecret
|
||||||
|
= json::from_str(json_console_secret).unwrap();
|
||||||
|
match json::to_writer_pretty(&mut f, &console_secret) {
|
||||||
Err(io_err) => io_err,
|
Err(io_err) => io_err,
|
||||||
Ok(_) => continue,
|
Ok(_) => continue,
|
||||||
}
|
}
|
||||||
@@ -429,23 +490,24 @@ pub fn application_secret_from_directory(dir: &str,
|
|||||||
return secret_io_error(err)
|
return secret_io_error(err)
|
||||||
},
|
},
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
let mut json_encoded_secret = String::new();
|
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
|
||||||
if let Err(io_err) = f.read_to_string(&mut json_encoded_secret) {
|
Err(json::Error::IoError(err)) =>
|
||||||
return secret_io_error(io_err)
|
return secret_io_error(err),
|
||||||
}
|
Err(json_err) =>
|
||||||
match json::decode::<ConsoleApplicationSecret>(&json_encoded_secret) {
|
return Err(CLIError::Configuration(
|
||||||
Err(json_decode_error) => return Err(CLIError::Configuration(
|
ConfigurationError::Secret(
|
||||||
ConfigurationError::Secret(ApplicationSecretError::DecoderError(
|
ApplicationSecretError::DecoderError(
|
||||||
(secret_str(), json_decode_error)
|
(secret_str(), json_err)
|
||||||
)))),
|
)))),
|
||||||
Ok(console_secret) => match console_secret.installed {
|
Ok(console_secret) =>
|
||||||
Some(secret) => return Ok(secret),
|
match console_secret.installed {
|
||||||
None => return Err(
|
Some(secret) => return Ok(secret),
|
||||||
CLIError::Configuration(
|
None => return Err(
|
||||||
ConfigurationError::Secret(
|
CLIError::Configuration(
|
||||||
ApplicationSecretError::FormatError(secret_str())
|
ConfigurationError::Secret(
|
||||||
)))
|
ApplicationSecretError::FormatError(secret_str())
|
||||||
},
|
)))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
// This file was generated automatically from 'src/mako/cli/main.rs.mako'
|
// This file was generated automatically from 'src/mako/cli/main.rs.mako'
|
||||||
// DO NOT EDIT !
|
// DO NOT EDIT !
|
||||||
#![feature(plugin, exit_status)]
|
#![feature(plugin, exit_status)]
|
||||||
#![plugin(docopt_macros)]
|
|
||||||
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
|
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
|
||||||
|
|
||||||
extern crate docopt;
|
extern crate clap;
|
||||||
extern crate yup_oauth2 as oauth2;
|
extern crate yup_oauth2 as oauth2;
|
||||||
extern crate yup_hyper_mock as mock;
|
extern crate yup_hyper_mock as mock;
|
||||||
extern crate rustc_serialize;
|
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
extern crate hyper;
|
extern crate hyper;
|
||||||
extern crate mime;
|
extern crate mime;
|
||||||
@@ -16,53 +14,37 @@ extern crate google_groupsmigration1 as api;
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
use clap::{App, SubCommand, Arg};
|
||||||
docopt!(Options derive Debug, "
|
|
||||||
Usage:
|
|
||||||
groupsmigration1 [options] archive insert <group-id> -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
|
||||||
groupsmigration1 --help
|
|
||||||
|
|
||||||
All documentation details can be found at
|
|
||||||
http://byron.github.io/google-apis-rs/google_groupsmigration1_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.
|
|
||||||
");
|
|
||||||
|
|
||||||
mod cmn;
|
mod cmn;
|
||||||
|
|
||||||
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
||||||
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError};
|
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol,
|
||||||
|
protocol_from_str};
|
||||||
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use oauth2::{Authenticator, DefaultAuthenticatorDelegate};
|
use oauth2::{Authenticator, DefaultAuthenticatorDelegate};
|
||||||
use rustc_serialize::json;
|
use serde::json;
|
||||||
|
use clap::ArgMatches;
|
||||||
|
|
||||||
struct Engine {
|
enum DoitError {
|
||||||
opt: Options,
|
IoError(String, io::Error),
|
||||||
|
ApiError(api::Error),
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Engine<'n, 'a> {
|
||||||
|
opt: ArgMatches<'n, 'a>,
|
||||||
hub: api::GroupsMigration<hyper::Client, Authenticator<DefaultAuthenticatorDelegate, JsonTokenStorage, hyper::Client>>,
|
hub: api::GroupsMigration<hyper::Client, Authenticator<DefaultAuthenticatorDelegate, JsonTokenStorage, hyper::Client>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Engine {
|
impl<'n, 'a> Engine<'n, 'a> {
|
||||||
fn _archive_insert(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
fn _archive_insert(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||||
-> Option<api::Error> {
|
-> Result<(), DoitError> {
|
||||||
let mut call = self.hub.archive().insert(&self.opt.arg_group_id);
|
let mut call = self.hub.archive().insert(opt.value_of("group-id").unwrap_or(""));
|
||||||
for parg in self.opt.arg_v.iter() {
|
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||||
match key {
|
match key {
|
||||||
"alt"
|
"alt"
|
||||||
@@ -83,65 +65,71 @@ impl Engine {
|
|||||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let protocol =
|
let vals = opt.values_of("mode").unwrap();
|
||||||
if self.opt.cmd_simple {
|
let protocol = protocol_from_str(vals[0], ["simple", "resumable"].iter().map(|&v| v.to_string()).collect(), err);
|
||||||
"simple"
|
let mut input_file = input_file_from_opts(vals[1], err);
|
||||||
} else if self.opt.cmd_resumable {
|
let mime_type = input_mime_from_opts(opt.value_of("mime").unwrap_or("application/octet-stream"), err);
|
||||||
"resumable"
|
|
||||||
} else {
|
|
||||||
unreachable!()
|
|
||||||
};
|
|
||||||
let mut input_file = input_file_from_opts(&self.opt.arg_file, err);
|
|
||||||
let mime_type = input_mime_from_opts(&self.opt.arg_mime, err);
|
|
||||||
if dry_run {
|
if dry_run {
|
||||||
None
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
assert!(err.issues.len() == 0);
|
assert!(err.issues.len() == 0);
|
||||||
if self.opt.flag_scope.len() > 0 {
|
for scope in self.opt.values_of("url").unwrap_or(Vec::new()).iter() {
|
||||||
call = call.add_scope(&self.opt.flag_scope);
|
call = call.add_scope(scope);
|
||||||
}
|
}
|
||||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
let mut ostream = match writer_from_opts(opt.value_of("out")) {
|
||||||
|
Ok(mut f) => f,
|
||||||
|
Err(io_err) => return Err(DoitError::IoError(opt.value_of("out").unwrap_or("-").to_string(), io_err)),
|
||||||
|
};
|
||||||
match match protocol {
|
match match protocol {
|
||||||
"simple" => call.upload(input_file.unwrap(), mime_type.unwrap()),
|
CallType::Upload(UploadProtocol::Simple) => call.upload(input_file.unwrap(), mime_type.unwrap()),
|
||||||
"resumable" => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()),
|
CallType::Upload(UploadProtocol::Resumable) => call.upload_resumable(input_file.unwrap(), mime_type.unwrap()),
|
||||||
_ => unreachable!(),
|
CallType::Standard => unreachable!()
|
||||||
} {
|
} {
|
||||||
Err(api_err) => Some(api_err),
|
Err(api_err) => Err(DoitError::ApiError(api_err)),
|
||||||
Ok((mut response, output_schema)) => {
|
Ok((mut response, output_schema)) => {
|
||||||
serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap();
|
serde::json::to_writer_pretty(&mut ostream, &output_schema).unwrap();
|
||||||
None
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _doit(&self, dry_run: bool) -> (Option<api::Error>, Option<InvalidOptionsError>) {
|
fn _doit(&self, dry_run: bool) -> Result<Result<(), DoitError>, Option<InvalidOptionsError>> {
|
||||||
let mut err = InvalidOptionsError::new();
|
let mut err = InvalidOptionsError::new();
|
||||||
let mut call_result: Option<api::Error>;
|
let mut call_result: Result<(), DoitError> = Ok(());
|
||||||
let mut err_opt: Option<InvalidOptionsError> = None;
|
let mut err_opt: Option<InvalidOptionsError> = None;
|
||||||
|
match self.opt.subcommand() {
|
||||||
if self.opt.cmd_archive {
|
("archive", Some(opt)) => {
|
||||||
if self.opt.cmd_insert {
|
match opt.subcommand() {
|
||||||
call_result = self._archive_insert(dry_run, &mut err);
|
("insert", Some(opt)) => {
|
||||||
} else {
|
call_result = self._archive_insert(opt, dry_run, &mut err);
|
||||||
unreachable!();
|
},
|
||||||
|
_ => {
|
||||||
|
err.issues.push(CLIError::MissingMethodError("archive".to_string()));
|
||||||
|
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
err.issues.push(CLIError::MissingCommandError);
|
||||||
|
writeln!(io::stderr(), "{}\n", self.opt.usage()).ok();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
unreachable!();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if dry_run {
|
if dry_run {
|
||||||
if err.issues.len() > 0 {
|
if err.issues.len() > 0 {
|
||||||
err_opt = Some(err);
|
err_opt = Some(err);
|
||||||
}
|
}
|
||||||
|
Err(err_opt)
|
||||||
|
} else {
|
||||||
|
Ok(call_result)
|
||||||
}
|
}
|
||||||
(call_result, err_opt)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please note that this call will fail if any part of the opt can't be handled
|
// Please note that this call will fail if any part of the opt can't be handled
|
||||||
fn new(opt: Options) -> Result<Engine, InvalidOptionsError> {
|
fn new(opt: ArgMatches<'a, 'n>) -> Result<Engine<'a, 'n>, InvalidOptionsError> {
|
||||||
let (config_dir, secret) = {
|
let (config_dir, secret) = {
|
||||||
let config_dir = match cmn::assure_config_dir_exists(&opt.flag_config_dir) {
|
let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) {
|
||||||
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
|
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
|
||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
};
|
};
|
||||||
@@ -154,7 +142,7 @@ impl Engine {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate,
|
let auth = Authenticator::new( &secret, DefaultAuthenticatorDelegate,
|
||||||
if opt.flag_debug_auth {
|
if opt.is_present("debug-auth") {
|
||||||
hyper::Client::with_connector(mock::TeeConnector {
|
hyper::Client::with_connector(mock::TeeConnector {
|
||||||
connector: hyper::net::HttpConnector(None)
|
connector: hyper::net::HttpConnector(None)
|
||||||
})
|
})
|
||||||
@@ -167,7 +155,7 @@ impl Engine {
|
|||||||
}, None);
|
}, None);
|
||||||
|
|
||||||
let client =
|
let client =
|
||||||
if opt.flag_debug {
|
if opt.is_present("debug") {
|
||||||
hyper::Client::with_connector(mock::TeeConnector {
|
hyper::Client::with_connector(mock::TeeConnector {
|
||||||
connector: hyper::net::HttpConnector(None)
|
connector: hyper::net::HttpConnector(None)
|
||||||
})
|
})
|
||||||
@@ -180,34 +168,153 @@ impl Engine {
|
|||||||
};
|
};
|
||||||
|
|
||||||
match engine._doit(true) {
|
match engine._doit(true) {
|
||||||
(_, Some(err)) => Err(err),
|
Err(Some(err)) => Err(err),
|
||||||
_ => Ok(engine),
|
Err(None) => Ok(engine),
|
||||||
|
Ok(_) => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute the call with all the bells and whistles, informing the caller only if there was an error.
|
fn doit(&self) -> Result<(), DoitError> {
|
||||||
// The absense of one indicates success.
|
match self._doit(false) {
|
||||||
fn doit(&self) -> Option<api::Error> {
|
Ok(res) => res,
|
||||||
self._doit(false).0
|
Err(_) => unreachable!(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit());
|
let upload_value_names = ["mode", "file"];
|
||||||
let debug = opts.flag_debug;
|
let arg_data = [
|
||||||
match Engine::new(opts) {
|
("archive", "methods: 'insert'", vec![
|
||||||
|
("insert", Some("Inserts a new mail into the archive of the Google group."),
|
||||||
|
vec![
|
||||||
|
(Some("group-id"),
|
||||||
|
None,
|
||||||
|
Some("The group ID"),
|
||||||
|
Some(true),
|
||||||
|
Some(false)),
|
||||||
|
|
||||||
|
(Some("mode"),
|
||||||
|
Some("u"),
|
||||||
|
Some("Specify the upload protocol (simple|resumable) and the file to upload"),
|
||||||
|
Some(true),
|
||||||
|
Some(true)),
|
||||||
|
|
||||||
|
(Some("v"),
|
||||||
|
Some("p"),
|
||||||
|
Some("Set various fields of the request structure"),
|
||||||
|
Some(false),
|
||||||
|
Some(true)),
|
||||||
|
|
||||||
|
(Some("out"),
|
||||||
|
Some("o"),
|
||||||
|
Some("Specify the file into which to write the programs output"),
|
||||||
|
Some(false),
|
||||||
|
Some(false)),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
let mut app = App::new("groupsmigration1")
|
||||||
|
.author("Sebastian Thiel <byronimo@gmail.com>")
|
||||||
|
.version("0.2.0+20140416")
|
||||||
|
.about("Groups Migration Api.")
|
||||||
|
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_groupsmigration1_cli")
|
||||||
|
.arg(Arg::with_name("url")
|
||||||
|
.long("scope")
|
||||||
|
.help("Specify the authentication a method should be executed in. Each scope requires the user to grant this application permission to use it.If unset, it defaults to the shortest scope url for a particular method.")
|
||||||
|
.multiple(true)
|
||||||
|
.takes_value(true))
|
||||||
|
.arg(Arg::with_name("folder")
|
||||||
|
.long("config-dir")
|
||||||
|
.help("A directory into which we will store our persistent data. Defaults to a user-writable directory that we will create during the first invocation.[default: ~/.google-service-cli")
|
||||||
|
.multiple(false)
|
||||||
|
.takes_value(true))
|
||||||
|
.arg(Arg::with_name("debug")
|
||||||
|
.long("debug")
|
||||||
|
.help("Output all server communication to standard error. `tx` and `rx` are placed into the same stream.")
|
||||||
|
.multiple(false)
|
||||||
|
.takes_value(false))
|
||||||
|
.arg(Arg::with_name("debug-auth")
|
||||||
|
.long("debug-auth")
|
||||||
|
.help("Output all communication related to authentication to standard error. `tx` and `rx` are placed into the same stream.")
|
||||||
|
.multiple(false)
|
||||||
|
.takes_value(false));
|
||||||
|
|
||||||
|
for &(main_command_name, ref about, ref subcommands) in arg_data.iter() {
|
||||||
|
let mut mcmd = SubCommand::new(main_command_name).about(about);
|
||||||
|
|
||||||
|
for &(sub_command_name, ref desc, ref args) in subcommands {
|
||||||
|
let mut scmd = SubCommand::new(sub_command_name);
|
||||||
|
if let &Some(desc) = desc {
|
||||||
|
scmd = scmd.about(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args {
|
||||||
|
let arg_name_str =
|
||||||
|
match (arg_name, flag) {
|
||||||
|
(&Some(an), _ ) => an,
|
||||||
|
(_ , &Some(f)) => f,
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
let mut arg = Arg::with_name(arg_name_str);
|
||||||
|
if let &Some(short_flag) = flag {
|
||||||
|
arg = arg.short(short_flag);
|
||||||
|
}
|
||||||
|
if let &Some(desc) = desc {
|
||||||
|
arg = arg.help(desc);
|
||||||
|
}
|
||||||
|
if arg_name.is_some() && flag.is_some() {
|
||||||
|
arg = arg.takes_value(true);
|
||||||
|
}
|
||||||
|
if let &Some(required) = required {
|
||||||
|
arg = arg.required(required);
|
||||||
|
}
|
||||||
|
if let &Some(multi) = multi {
|
||||||
|
arg = arg.multiple(multi);
|
||||||
|
}
|
||||||
|
if arg_name_str == "mode" {
|
||||||
|
arg = arg.number_of_values(2);
|
||||||
|
arg = arg.value_names(&upload_value_names);
|
||||||
|
|
||||||
|
scmd = scmd.arg(Arg::with_name("mime")
|
||||||
|
.short("m")
|
||||||
|
.requires("mode")
|
||||||
|
.required(false)
|
||||||
|
.help("The file's mime time, like 'application/octet-stream'")
|
||||||
|
.takes_value(true));
|
||||||
|
}
|
||||||
|
scmd = scmd.arg(arg);
|
||||||
|
}
|
||||||
|
mcmd = mcmd.subcommand(scmd);
|
||||||
|
}
|
||||||
|
app = app.subcommand(mcmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
let matches = app.get_matches();
|
||||||
|
|
||||||
|
let debug = matches.is_present("debug");
|
||||||
|
match Engine::new(matches) {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
writeln!(io::stderr(), "{}", err).ok();
|
|
||||||
env::set_exit_status(err.exit_code);
|
env::set_exit_status(err.exit_code);
|
||||||
|
writeln!(io::stderr(), "{}", err).ok();
|
||||||
},
|
},
|
||||||
Ok(engine) => {
|
Ok(engine) => {
|
||||||
if let Some(err) = engine.doit() {
|
if let Err(doit_err) = engine.doit() {
|
||||||
if debug {
|
|
||||||
writeln!(io::stderr(), "{:?}", err).ok();
|
|
||||||
} else {
|
|
||||||
writeln!(io::stderr(), "{}", err).ok();
|
|
||||||
}
|
|
||||||
env::set_exit_status(1);
|
env::set_exit_status(1);
|
||||||
|
match doit_err {
|
||||||
|
DoitError::IoError(path, err) => {
|
||||||
|
writeln!(io::stderr(), "Failed to open output file '{}': {}", path, err).ok();
|
||||||
|
},
|
||||||
|
DoitError::ApiError(err) => {
|
||||||
|
if debug {
|
||||||
|
writeln!(io::stderr(), "{:?}", err).ok();
|
||||||
|
} else {
|
||||||
|
writeln!(io::stderr(), "{}", err).ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "google-groupsmigration1"
|
name = "google-groupsmigration1"
|
||||||
version = "0.1.6+20140416"
|
version = "0.1.7+20140416"
|
||||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||||
description = "A complete library to interact with Groups Migration (protocol v1)"
|
description = "A complete library to interact with Groups Migration (protocol v1)"
|
||||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1"
|
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ DO NOT EDIT !
|
|||||||
-->
|
-->
|
||||||
The `google-groupsmigration1` library allows access to all features of the *Google Groups Migration* service.
|
The `google-groupsmigration1` library allows access to all features of the *Google Groups Migration* service.
|
||||||
|
|
||||||
This documentation was generated from *Groups Migration* crate version *0.1.6+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
This documentation was generated from *Groups Migration* crate version *0.1.7+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||||
|
|
||||||
Everything else about the *Groups Migration* *v1* API can be found at the
|
Everything else about the *Groups Migration* *v1* API can be found at the
|
||||||
[official documentation site](https://developers.google.com/google-apps/groups-migration/).
|
[official documentation site](https://developers.google.com/google-apps/groups-migration/).
|
||||||
@@ -162,7 +162,7 @@ These will always take a single argument, for which the following statements are
|
|||||||
|
|
||||||
* [PODs][wiki-pod] are handed by copy
|
* [PODs][wiki-pod] are handed by copy
|
||||||
* strings are passed as `&str`
|
* strings are passed as `&str`
|
||||||
* [request values](http://byron.github.io/google-apis-rs/google_groupsmigration1/trait.RequestValue.html) are borrowed
|
* [request values](http://byron.github.io/google-apis-rs/google_groupsmigration1/trait.RequestValue.html) are moved
|
||||||
|
|
||||||
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ pub trait RequestValue {}
|
|||||||
/// This might be a bug within the google API schema.
|
/// This might be a bug within the google API schema.
|
||||||
pub trait UnusedType {}
|
pub trait UnusedType {}
|
||||||
|
|
||||||
/// Identifies types which are only used as part of other types, which
|
/// Identifies types which are only used as part of other types, which
|
||||||
/// usually are carrying the `Resource` trait.
|
/// usually are carrying the `Resource` trait.
|
||||||
pub trait Part {}
|
pub trait Part {}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ pub struct ErrorResponse {
|
|||||||
pub struct ServerError {
|
pub struct ServerError {
|
||||||
errors: Vec<ServerMessage>,
|
errors: Vec<ServerMessage>,
|
||||||
code: u16,
|
code: u16,
|
||||||
message: String,
|
message: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
@@ -120,7 +120,7 @@ impl hyper::net::NetworkStream for DummyNetworkStream {
|
|||||||
/// A trait specifying functionality to help controlling any request performed by the API.
|
/// A trait specifying functionality to help controlling any request performed by the API.
|
||||||
/// The trait has a conservative default implementation.
|
/// The trait has a conservative default implementation.
|
||||||
///
|
///
|
||||||
/// It contains methods to deal with all common issues, as well with the ones related to
|
/// It contains methods to deal with all common issues, as well with the ones related to
|
||||||
/// uploading media
|
/// uploading media
|
||||||
pub trait Delegate {
|
pub trait Delegate {
|
||||||
|
|
||||||
@@ -128,12 +128,12 @@ pub trait Delegate {
|
|||||||
/// information if he is interesting in knowing more context when further calls to it
|
/// information if he is interesting in knowing more context when further calls to it
|
||||||
/// are made.
|
/// are made.
|
||||||
/// The matching `finished()` call will always be made, no matter whether or not the API
|
/// The matching `finished()` call will always be made, no matter whether or not the API
|
||||||
/// request was successful. That way, the delegate may easily maintain a clean state
|
/// request was successful. That way, the delegate may easily maintain a clean state
|
||||||
/// between various API calls.
|
/// between various API calls.
|
||||||
fn begin(&mut self, MethodInfo) {}
|
fn begin(&mut self, MethodInfo) {}
|
||||||
|
|
||||||
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
/// Called whenever there is an [HttpError](http://hyperium.github.io/hyper/hyper/error/enum.HttpError.html), usually if there are network problems.
|
||||||
///
|
///
|
||||||
/// If you choose to retry after a duration, the duration should be chosen using the
|
/// 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).
|
/// [exponential backoff algorithm](http://en.wikipedia.org/wiki/Exponential_backoff).
|
||||||
///
|
///
|
||||||
@@ -142,7 +142,7 @@ pub trait Delegate {
|
|||||||
Retry::Abort
|
Retry::Abort
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called whenever there is the need for your applications API key after
|
/// Called whenever there is the need for your applications API key after
|
||||||
/// the official authenticator implementation didn't provide one, for some reason.
|
/// the official authenticator implementation didn't provide one, for some reason.
|
||||||
/// If this method returns None as well, the underlying operation will fail
|
/// If this method returns None as well, the underlying operation will fail
|
||||||
fn api_key(&mut self) -> Option<String> {
|
fn api_key(&mut self) -> Option<String> {
|
||||||
@@ -171,16 +171,19 @@ pub trait Delegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
||||||
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
||||||
/// see `upload_url()`.
|
/// see `upload_url()`.
|
||||||
fn store_upload_url(&mut self, url: &str) {
|
/// It will also be called with None after a successful upload, which allows the delegate
|
||||||
|
/// to forget the URL. That way, we will not attempt to resume an upload that has already
|
||||||
|
/// finished.
|
||||||
|
fn store_upload_url(&mut self, url: Option<&str>) {
|
||||||
let _ = url;
|
let _ = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called whenever a server response could not be decoded from json.
|
/// Called whenever a server response could not be decoded from json.
|
||||||
/// It's for informational purposes only, the caller will return with an error
|
/// It's for informational purposes only, the caller will return with an error
|
||||||
/// accordingly.
|
/// accordingly.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
/// * `json_encoded_value` - The json-encoded value which failed to decode.
|
||||||
@@ -191,7 +194,7 @@ pub trait Delegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Called whenever the http request returns with a non-success status code.
|
/// Called whenever the http request returns with a non-success status code.
|
||||||
/// This can involve authentication issues, or anything else that very much
|
/// This can involve authentication issues, or anything else that very much
|
||||||
/// depends on the used API method.
|
/// depends on the used API method.
|
||||||
/// The delegate should check the status, header and decoded json error to decide
|
/// The delegate should check the status, header and decoded json error to decide
|
||||||
/// whether to retry or not. In the latter case, the underlying call will fail.
|
/// whether to retry or not. In the latter case, the underlying call will fail.
|
||||||
@@ -202,7 +205,7 @@ pub trait Delegate {
|
|||||||
Retry::Abort
|
Retry::Abort
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called prior to sending the main request of the given method. It can be used to time
|
/// Called prior to sending the main request of the given method. It can be used to time
|
||||||
/// the call or to print progress information.
|
/// the call or to print progress information.
|
||||||
/// It's also useful as you can be sure that a request will definitely be made.
|
/// It's also useful as you can be sure that a request will definitely be made.
|
||||||
fn pre_request(&mut self) { }
|
fn pre_request(&mut self) { }
|
||||||
@@ -221,14 +224,14 @@ pub trait Delegate {
|
|||||||
fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool {
|
fn cancel_chunk_upload(&mut self, chunk: &ContentRange) -> bool {
|
||||||
let _ = chunk;
|
let _ = chunk;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called before the API request method returns, in every case. It can be used to clean up
|
/// Called before the API request method returns, in every case. It can be used to clean up
|
||||||
/// internal state between calls to the API.
|
/// internal state between calls to the API.
|
||||||
/// This call always has a matching call to `begin(...)`.
|
/// This call always has a matching call to `begin(...)`.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
/// * `is_success` - a true value indicates the operation was successful. If false, you should
|
||||||
/// discard all values stored during `store_upload_url`.
|
/// discard all values stored during `store_upload_url`.
|
||||||
fn finished(&mut self, is_success: bool) {
|
fn finished(&mut self, is_success: bool) {
|
||||||
@@ -290,17 +293,17 @@ impl Display for Error {
|
|||||||
writeln!(f, "The application's API key was not found in the configuration").ok();
|
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.")
|
writeln!(f, "It is used as there are no Scopes defined for this method.")
|
||||||
},
|
},
|
||||||
Error::BadRequest(ref err)
|
Error::BadRequest(ref err)
|
||||||
=> writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message),
|
=> writeln!(f, "Bad Requst ({}): {}", err.error.code, err.error.message),
|
||||||
Error::MissingToken(ref err) =>
|
Error::MissingToken(ref err) =>
|
||||||
writeln!(f, "Token retrieval failed with error: {}", err),
|
writeln!(f, "Token retrieval failed with error: {}", err),
|
||||||
Error::Cancelled =>
|
Error::Cancelled =>
|
||||||
writeln!(f, "Operation cancelled by delegate"),
|
writeln!(f, "Operation cancelled by delegate"),
|
||||||
Error::FieldClash(field) =>
|
Error::FieldClash(field) =>
|
||||||
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
|
writeln!(f, "The custom parameter '{}' is already provided natively by the CallBuilder.", field),
|
||||||
Error::JsonDecodeError(ref json_str, ref err)
|
Error::JsonDecodeError(ref json_str, ref err)
|
||||||
=> writeln!(f, "{}: {}", err, json_str),
|
=> writeln!(f, "{}: {}", err, json_str),
|
||||||
Error::Failure(ref response) =>
|
Error::Failure(ref response) =>
|
||||||
writeln!(f, "Http status indicates failure: {:?}", response),
|
writeln!(f, "Http status indicates failure: {:?}", response),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,8 +398,8 @@ impl<'a> MultiPartReader<'a> {
|
|||||||
|
|
||||||
impl<'a> Read for MultiPartReader<'a> {
|
impl<'a> Read for MultiPartReader<'a> {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||||
match (self.raw_parts.len(),
|
match (self.raw_parts.len(),
|
||||||
self.current_part.is_none(),
|
self.current_part.is_none(),
|
||||||
self.last_part_boundary.is_none()) {
|
self.last_part_boundary.is_none()) {
|
||||||
(_, _, false) => {
|
(_, _, false) => {
|
||||||
let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0);
|
let br = self.last_part_boundary.as_mut().unwrap().read(buf).unwrap_or(0);
|
||||||
@@ -409,7 +412,7 @@ impl<'a> Read for MultiPartReader<'a> {
|
|||||||
(n, true, _) if n > 0 => {
|
(n, true, _) if n > 0 => {
|
||||||
let (headers, reader) = self.raw_parts.remove(0);
|
let (headers, reader) = self.raw_parts.remove(0);
|
||||||
let mut c = Cursor::new(Vec::<u8>::new());
|
let mut c = Cursor::new(Vec::<u8>::new());
|
||||||
write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING,
|
write!(&mut c, "{}--{}{}{}{}", LINE_ENDING, BOUNDARY, LINE_ENDING,
|
||||||
headers, LINE_ENDING).unwrap();
|
headers, LINE_ENDING).unwrap();
|
||||||
c.seek(SeekFrom::Start(0)).unwrap();
|
c.seek(SeekFrom::Start(0)).unwrap();
|
||||||
self.current_part = Some((c, reader));
|
self.current_part = Some((c, reader));
|
||||||
@@ -423,12 +426,12 @@ impl<'a> Read for MultiPartReader<'a> {
|
|||||||
let b = c.read(buf).unwrap_or(0);
|
let b = c.read(buf).unwrap_or(0);
|
||||||
(b, reader.read(&mut buf[b..]))
|
(b, reader.read(&mut buf[b..]))
|
||||||
};
|
};
|
||||||
|
|
||||||
match rr {
|
match rr {
|
||||||
Ok(bytes_read) => {
|
Ok(bytes_read) => {
|
||||||
if hb < buf.len() && bytes_read == 0 {
|
if hb < buf.len() && bytes_read == 0 {
|
||||||
if self.is_last_part() {
|
if self.is_last_part() {
|
||||||
// before clearing the last part, we will add the boundary that
|
// before clearing the last part, we will add the boundary that
|
||||||
// will be written last
|
// will be written last
|
||||||
self.last_part_boundary = Some(Cursor::new(
|
self.last_part_boundary = Some(Cursor::new(
|
||||||
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
|
format!("{}--{}--", LINE_ENDING, BOUNDARY).into_bytes()))
|
||||||
@@ -459,6 +462,16 @@ impl<'a> Read for MultiPartReader<'a> {
|
|||||||
header!{
|
header!{
|
||||||
#[doc="The `X-Upload-Content-Type` header."]
|
#[doc="The `X-Upload-Content-Type` header."]
|
||||||
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
||||||
|
|
||||||
|
xupload_content_type {
|
||||||
|
test_header!(
|
||||||
|
test1,
|
||||||
|
vec![b"text/plain"],
|
||||||
|
Some(HeaderField(
|
||||||
|
vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())]
|
||||||
|
)));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
@@ -656,7 +669,7 @@ impl<'a, A> ResumableUploadHelper<'a, A>
|
|||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
let mut json_err = String::new();
|
let mut json_err = String::new();
|
||||||
res.read_to_string(&mut json_err).unwrap();
|
res.read_to_string(&mut json_err).unwrap();
|
||||||
if let Retry::After(d) = self.delegate.http_failure(&res,
|
if let Retry::After(d) = self.delegate.http_failure(&res,
|
||||||
serde::json::from_str(&json_err).ok(),
|
serde::json::from_str(&json_err).ok(),
|
||||||
serde::json::from_str(&json_err).ok()) {
|
serde::json::from_str(&json_err).ok()) {
|
||||||
sleep_ms(d.num_milliseconds() as u32);
|
sleep_ms(d.num_milliseconds() as u32);
|
||||||
@@ -675,4 +688,4 @@ impl<'a, A> ResumableUploadHelper<'a, A>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,31 +2,31 @@
|
|||||||
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
||||||
// DO NOT EDIT !
|
// DO NOT EDIT !
|
||||||
|
|
||||||
//! This documentation was generated from *Groups Migration* crate version *0.1.6+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
//! This documentation was generated from *Groups Migration* crate version *0.1.7+20140416*, where *20140416* is the exact revision of the *groupsmigration:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||||
//!
|
//!
|
||||||
//! Everything else about the *Groups Migration* *v1* API can be found at the
|
//! Everything else about the *Groups Migration* *v1* API can be found at the
|
||||||
//! [official documentation site](https://developers.google.com/google-apps/groups-migration/).
|
//! [official documentation site](https://developers.google.com/google-apps/groups-migration/).
|
||||||
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1).
|
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/groupsmigration1).
|
||||||
//! # Features
|
//! # Features
|
||||||
//!
|
//!
|
||||||
//! Handle the following *Resources* with ease from the central [hub](struct.GroupsMigration.html) ...
|
//! Handle the following *Resources* with ease from the central [hub](struct.GroupsMigration.html) ...
|
||||||
//!
|
//!
|
||||||
//! * archive
|
//! * archive
|
||||||
//! * [*insert*](struct.ArchiveInsertCall.html)
|
//! * [*insert*](struct.ArchiveInsertCall.html)
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! Upload supported by ...
|
//! Upload supported by ...
|
||||||
//!
|
//!
|
||||||
//! * [*insert archive*](struct.ArchiveInsertCall.html)
|
//! * [*insert archive*](struct.ArchiveInsertCall.html)
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html).
|
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](../index.html).
|
||||||
//!
|
//!
|
||||||
//! # Structure of this Library
|
//! # Structure of this Library
|
||||||
//!
|
//!
|
||||||
//! The API is structured into the following primary items:
|
//! The API is structured into the following primary items:
|
||||||
//!
|
//!
|
||||||
//! * **[Hub](struct.GroupsMigration.html)**
|
//! * **[Hub](struct.GroupsMigration.html)**
|
||||||
//! * a central object to maintain state and allow accessing all *Activities*
|
//! * a central object to maintain state and allow accessing all *Activities*
|
||||||
//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn
|
//! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn
|
||||||
@@ -39,39 +39,39 @@
|
|||||||
//! * never directly used in *Activities*
|
//! * never directly used in *Activities*
|
||||||
//! * **[Activities](trait.CallBuilder.html)**
|
//! * **[Activities](trait.CallBuilder.html)**
|
||||||
//! * operations to apply to *Resources*
|
//! * operations to apply to *Resources*
|
||||||
//!
|
//!
|
||||||
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
|
||||||
//!
|
//!
|
||||||
//! Generally speaking, you can invoke *Activities* like this:
|
//! Generally speaking, you can invoke *Activities* like this:
|
||||||
//!
|
//!
|
||||||
//! ```Rust,ignore
|
//! ```Rust,ignore
|
||||||
//! let r = hub.resource().activity(...).doit()
|
//! let r = hub.resource().activity(...).doit()
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Or specifically ...
|
//! Or specifically ...
|
||||||
//!
|
//!
|
||||||
//! ```ignore
|
//! ```ignore
|
||||||
//! let r = hub.archive().insert(...).doit()
|
//! let r = hub.archive().insert(...).doit()
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
|
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
|
||||||
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
|
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
|
||||||
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
|
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
|
||||||
//! The `doit()` method performs the actual communication with the server and returns the respective result.
|
//! The `doit()` method performs the actual communication with the server and returns the respective result.
|
||||||
//!
|
//!
|
||||||
//! # Usage
|
//! # Usage
|
||||||
//!
|
//!
|
||||||
//! ## Setting up your Project
|
//! ## Setting up your Project
|
||||||
//!
|
//!
|
||||||
//! To use this library, you would put the following lines into your `Cargo.toml` file:
|
//! To use this library, you would put the following lines into your `Cargo.toml` file:
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [dependencies]
|
//! [dependencies]
|
||||||
//! google-groupsmigration1 = "*"
|
//! google-groupsmigration1 = "*"
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## A complete example
|
//! ## A complete example
|
||||||
//!
|
//!
|
||||||
//! ```test_harness,no_run
|
//! ```test_harness,no_run
|
||||||
//! extern crate hyper;
|
//! extern crate hyper;
|
||||||
//! extern crate yup_oauth2 as oauth2;
|
//! extern crate yup_oauth2 as oauth2;
|
||||||
@@ -82,13 +82,13 @@
|
|||||||
//! use std::default::Default;
|
//! use std::default::Default;
|
||||||
//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
//! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
||||||
//! use groupsmigration1::GroupsMigration;
|
//! use groupsmigration1::GroupsMigration;
|
||||||
//!
|
//!
|
||||||
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
||||||
//! // `client_secret`, among other things.
|
//! // `client_secret`, among other things.
|
||||||
//! let secret: ApplicationSecret = Default::default();
|
//! let secret: ApplicationSecret = Default::default();
|
||||||
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
|
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
|
||||||
//! // unless you replace `None` with the desired Flow.
|
//! // unless you replace `None` with the desired Flow.
|
||||||
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
|
//! // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
|
||||||
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
|
//! // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
|
||||||
//! // retrieve them from storage.
|
//! // retrieve them from storage.
|
||||||
//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
//! let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
//! // Values shown here are possibly random and not representative !
|
//! // Values shown here are possibly random and not representative !
|
||||||
//! let result = hub.archive().insert("groupId")
|
//! let result = hub.archive().insert("groupId")
|
||||||
//! .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap());
|
//! .upload(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap());
|
||||||
//!
|
//!
|
||||||
//! match result {
|
//! match result {
|
||||||
//! Err(e) => match e {
|
//! Err(e) => match e {
|
||||||
//! // The Error enum provides details about what exactly happened.
|
//! // The Error enum provides details about what exactly happened.
|
||||||
@@ -120,62 +120,61 @@
|
|||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
//! ## Handling Errors
|
//! ## Handling Errors
|
||||||
//!
|
//!
|
||||||
//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of
|
//! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of
|
||||||
//! the doit() methods, or handed as possibly intermediate results to either the
|
//! the doit() methods, or handed as possibly intermediate results to either the
|
||||||
//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html).
|
//! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](../yup-oauth2/trait.AuthenticatorDelegate.html).
|
||||||
//!
|
//!
|
||||||
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
|
||||||
//! makes the system potentially resilient to all kinds of errors.
|
//! makes the system potentially resilient to all kinds of errors.
|
||||||
//!
|
//!
|
||||||
//! ## Uploads and Downloads
|
//! ## Uploads and Downloads
|
||||||
//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be
|
//! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be
|
||||||
//! read by you to obtain the media.
|
//! read by you to obtain the media.
|
||||||
//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default.
|
//! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default.
|
||||||
//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
|
//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
|
||||||
//! this call: `.param("alt", "media")`.
|
//! this call: `.param("alt", "media")`.
|
||||||
//!
|
//!
|
||||||
//! Methods supporting uploads can do so using up to 2 different protocols:
|
//! Methods supporting uploads can do so using up to 2 different protocols:
|
||||||
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
|
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
|
||||||
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
|
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
|
||||||
//!
|
//!
|
||||||
//! ## Customization and Callbacks
|
//! ## Customization and Callbacks
|
||||||
//!
|
//!
|
||||||
//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the
|
//! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the
|
||||||
//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call.
|
//! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call.
|
||||||
//! Respective methods will be called to provide progress information, as well as determine whether the system should
|
//! Respective methods will be called to provide progress information, as well as determine whether the system should
|
||||||
//! retry on failure.
|
//! retry on failure.
|
||||||
//!
|
//!
|
||||||
//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort.
|
//! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort.
|
||||||
//!
|
//!
|
||||||
//! ## Optional Parts in Server-Requests
|
//! ## Optional Parts in Server-Requests
|
||||||
//!
|
//!
|
||||||
//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and
|
//! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and
|
||||||
//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
//! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses
|
||||||
//! are valid.
|
//! are valid.
|
||||||
//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to
|
//! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to
|
||||||
//! the server to indicate either the set parts of the request or the desired parts in the response.
|
//! the server to indicate either the set parts of the request or the desired parts in the response.
|
||||||
//!
|
//!
|
||||||
//! ## Builder Arguments
|
//! ## Builder Arguments
|
||||||
//!
|
//!
|
||||||
//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods.
|
//! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods.
|
||||||
//! These will always take a single argument, for which the following statements are true.
|
//! These will always take a single argument, for which the following statements are true.
|
||||||
//!
|
//!
|
||||||
//! * [PODs][wiki-pod] are handed by copy
|
//! * [PODs][wiki-pod] are handed by copy
|
||||||
//! * strings are passed as `&str`
|
//! * strings are passed as `&str`
|
||||||
//! * [request values](trait.RequestValue.html) are borrowed
|
//! * [request values](trait.RequestValue.html) are moved
|
||||||
//!
|
//!
|
||||||
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
//! Arguments will always be copied or cloned into the builder, to make them independent of their original life times.
|
||||||
//!
|
//!
|
||||||
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
|
//! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure
|
||||||
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
|
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
|
||||||
//! [google-go-api]: https://github.com/google/google-api-go-client
|
//! [google-go-api]: https://github.com/google/google-api-go-client
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
#![feature(std_misc)]
|
|
||||||
// Unused attributes happen thanks to defined, but unused structures
|
// Unused attributes happen thanks to defined, but unused structures
|
||||||
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
||||||
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
||||||
// unused imports in fully featured APIs. Same with unused_mut ... .
|
// unused imports in fully featured APIs. Same with unused_mut ... .
|
||||||
#![allow(unused_imports, unused_mut, dead_code)]
|
#![allow(unused_imports, unused_mut, dead_code)]
|
||||||
// Required for serde annotations
|
// Required for serde annotations
|
||||||
@@ -201,7 +200,10 @@ use std::io;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::thread::sleep_ms;
|
use std::thread::sleep_ms;
|
||||||
|
|
||||||
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse};
|
pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error,
|
||||||
|
CallBuilder, Hub, ReadSeek, Part, ResponseResult,
|
||||||
|
RequestValue, NestedType, Delegate, DefaultDelegate,
|
||||||
|
MethodsBuilder, Resource, ErrorResponse};
|
||||||
|
|
||||||
|
|
||||||
// ##############
|
// ##############
|
||||||
@@ -305,7 +307,7 @@ impl<'a, C, A> GroupsMigration<C, A>
|
|||||||
GroupsMigration {
|
GroupsMigration {
|
||||||
client: RefCell::new(client),
|
client: RefCell::new(client),
|
||||||
auth: RefCell::new(authenticator),
|
auth: RefCell::new(authenticator),
|
||||||
_user_agent: "google-api-rust-client/0.1.6".to_string(),
|
_user_agent: "google-api-rust-client/0.1.7".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +316,7 @@ impl<'a, C, A> GroupsMigration<C, A>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set the user-agent header field to use in all requests to the server.
|
/// Set the user-agent header field to use in all requests to the server.
|
||||||
/// It defaults to `google-api-rust-client/0.1.6`.
|
/// It defaults to `google-api-rust-client/0.1.7`.
|
||||||
///
|
///
|
||||||
/// Returns the previously set user-agent.
|
/// Returns the previously set user-agent.
|
||||||
pub fn user_agent(&mut self, agent_name: String) -> String {
|
pub fn user_agent(&mut self, agent_name: String) -> String {
|
||||||
@@ -391,7 +393,7 @@ pub struct ArchiveMethods<'a, C, A>
|
|||||||
impl<'a, C, A> MethodsBuilder for ArchiveMethods<'a, C, A> {}
|
impl<'a, C, A> MethodsBuilder for ArchiveMethods<'a, C, A> {}
|
||||||
|
|
||||||
impl<'a, C, A> ArchiveMethods<'a, C, A> {
|
impl<'a, C, A> ArchiveMethods<'a, C, A> {
|
||||||
|
|
||||||
/// Create a builder to help you perform the following task:
|
/// Create a builder to help you perform the following task:
|
||||||
///
|
///
|
||||||
/// Inserts a new mail into the archive of the Google group.
|
/// Inserts a new mail into the archive of the Google group.
|
||||||
@@ -465,10 +467,16 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
|
|
||||||
|
|
||||||
/// Perform the operation you have build so far.
|
/// Perform the operation you have build so far.
|
||||||
fn doit<RS>(mut self, mut reader: RS, reader_mime_type: mime::Mime, protocol: &'static str) -> Result<(hyper::client::Response, Groups)>
|
fn doit<RS>(mut self,
|
||||||
where RS: ReadSeek {
|
mut reader: RS,
|
||||||
|
reader_mime_type: mime::Mime,
|
||||||
|
protocol: &'static str)
|
||||||
|
-> Result<(hyper::client::Response, Groups)>
|
||||||
|
where RS: ReadSeek
|
||||||
|
{
|
||||||
use std::io::{Read, Seek};
|
use std::io::{Read, Seek};
|
||||||
use hyper::header::{ContentType, ContentLength, Authorization, UserAgent, Location};
|
use hyper::header::{ContentType, ContentLength, Authorization,
|
||||||
|
UserAgent, Location};
|
||||||
let mut dd = DefaultDelegate;
|
let mut dd = DefaultDelegate;
|
||||||
let mut dlg: &mut Delegate = match self._delegate {
|
let mut dlg: &mut Delegate = match self._delegate {
|
||||||
Some(d) => d,
|
Some(d) => d,
|
||||||
@@ -490,7 +498,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
|
|
||||||
params.push(("alt", "json".to_string()));
|
params.push(("alt", "json".to_string()));
|
||||||
|
|
||||||
let (mut url, upload_type) =
|
let (mut url, upload_type) =
|
||||||
if protocol == "simple" {
|
if protocol == "simple" {
|
||||||
("https://www.googleapis.com/upload/groups/v1/groups/{groupId}/archive".to_string(), "multipart")
|
("https://www.googleapis.com/upload/groups/v1/groups/{groupId}/archive".to_string(), "multipart")
|
||||||
} else if protocol == "resumable" {
|
} else if protocol == "resumable" {
|
||||||
@@ -527,7 +535,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
params.remove(index);
|
params.remove(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.len() > 0 {
|
if params.len() > 0 {
|
||||||
url.push('?');
|
url.push('?');
|
||||||
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_ref()))));
|
url.push_str(&url::form_urlencoded::serialize(params.iter().map(|t| (t.0, t.1.as_ref()))));
|
||||||
@@ -568,7 +576,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
response
|
response
|
||||||
} else {
|
} else {
|
||||||
let mut client = &mut *self.hub.client.borrow_mut();
|
let mut client = &mut *self.hub.client.borrow_mut();
|
||||||
let mut req = client.borrow_mut().request(hyper::method::Method::Post, url.as_ref())
|
let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url)
|
||||||
.header(UserAgent(self.hub._user_agent.clone()))
|
.header(UserAgent(self.hub._user_agent.clone()))
|
||||||
.header(auth_header.clone());
|
.header(auth_header.clone());
|
||||||
if protocol == "simple" {
|
if protocol == "simple" {
|
||||||
@@ -626,7 +634,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -654,6 +662,7 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -685,8 +694,12 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
/// * *max size*: 16MB
|
/// * *max size*: 16MB
|
||||||
/// * *multipart*: yes
|
/// * *multipart*: yes
|
||||||
/// * *valid mime types*: 'message/rfc822'
|
/// * *valid mime types*: 'message/rfc822'
|
||||||
pub fn upload<RS>(self, stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Groups)>
|
pub fn upload<RS>(self,
|
||||||
where RS: ReadSeek {
|
stream: RS,
|
||||||
|
mime_type: mime::Mime)
|
||||||
|
-> Result<(hyper::client::Response, Groups)>
|
||||||
|
where RS: ReadSeek
|
||||||
|
{
|
||||||
self.doit(stream, mime_type, "simple")
|
self.doit(stream, mime_type, "simple")
|
||||||
}
|
}
|
||||||
/// Upload media in a resumable fashion.
|
/// Upload media in a resumable fashion.
|
||||||
@@ -701,8 +714,12 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
/// * *max size*: 16MB
|
/// * *max size*: 16MB
|
||||||
/// * *multipart*: yes
|
/// * *multipart*: yes
|
||||||
/// * *valid mime types*: 'message/rfc822'
|
/// * *valid mime types*: 'message/rfc822'
|
||||||
pub fn upload_resumable<RS>(self, resumeable_stream: RS, mime_type: mime::Mime) -> Result<(hyper::client::Response, Groups)>
|
pub fn upload_resumable<RS>(self,
|
||||||
where RS: ReadSeek {
|
resumeable_stream: RS,
|
||||||
|
mime_type: mime::Mime)
|
||||||
|
-> Result<(hyper::client::Response, Groups)>
|
||||||
|
where RS: ReadSeek
|
||||||
|
{
|
||||||
self.doit(resumeable_stream, mime_type, "resumable")
|
self.doit(resumeable_stream, mime_type, "resumable")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,7 +761,8 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
|
||||||
/// * *alt* (query-string) - Data format for the response.
|
/// * *alt* (query-string) - Data format for the response.
|
||||||
pub fn param<T>(mut self, name: T, value: T) -> ArchiveInsertCall<'a, C, A>
|
pub fn param<T>(mut self, name: T, value: T) -> ArchiveInsertCall<'a, C, A>
|
||||||
where T: AsRef<str> {
|
where T: AsRef<str>
|
||||||
|
{
|
||||||
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@@ -760,11 +778,10 @@ impl<'a, C, A> ArchiveInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
/// Usually there is more than one suitable scope to authorize an operation, some of which may
|
||||||
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
|
||||||
/// sufficient, a read-write scope will do as well.
|
/// sufficient, a read-write scope will do as well.
|
||||||
pub fn add_scope<T>(mut self, scope: T) -> ArchiveInsertCall<'a, C, A>
|
pub fn add_scope<T>(mut self, scope: T) -> ArchiveInsertCall<'a, C, A>
|
||||||
where T: AsRef<str> {
|
where T: AsRef<str>
|
||||||
|
{
|
||||||
self._scopes.insert(scope.as_ref().to_string(), ());
|
self._scopes.insert(scope.as_ref().to_string(), ());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ hyper = "*"
|
|||||||
mime = "*"
|
mime = "*"
|
||||||
yup-oauth2 = "*"
|
yup-oauth2 = "*"
|
||||||
clap = "*"
|
clap = "*"
|
||||||
rustc-serialize = "*"
|
|
||||||
yup-hyper-mock = "*"
|
yup-hyper-mock = "*"
|
||||||
serde = ">= 0.3.0"
|
serde = ">= 0.3.0"
|
||||||
serde_macros = "*"
|
serde_macros = "*"
|
||||||
|
|||||||
@@ -18,76 +18,98 @@ Everything else about the *YouTube* API can be found at the
|
|||||||
This documentation was generated from the *YouTube* API at revision *20150414*. The CLI is at version *0.2.0*.
|
This documentation was generated from the *YouTube* API at revision *20150414*. The CLI is at version *0.2.0*.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
youtube3 [options] activities insert -r <kv>... [-p <v>...] [-o <out>]
|
youtube3 [options]
|
||||||
youtube3 [options] activities list <part> [-p <v>...] [-o <out>]
|
activities
|
||||||
youtube3 [options] captions delete <id> [-p <v>...]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] captions download <id> [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] captions insert -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
captions
|
||||||
youtube3 [options] captions list <part> <video-id> [-p <v>...] [-o <out>]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] captions update -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
download <id> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] channel-banners insert -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
insert (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] channel-sections delete <id> [-p <v>...]
|
list <part> <video-id> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] channel-sections insert -r <kv>... [-p <v>...] [-o <out>]
|
update (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] channel-sections list <part> [-p <v>...] [-o <out>]
|
channel-banners
|
||||||
youtube3 [options] channel-sections update -r <kv>... [-p <v>...] [-o <out>]
|
insert (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] channels list <part> [-p <v>...] [-o <out>]
|
channel-sections
|
||||||
youtube3 [options] channels update -r <kv>... [-p <v>...] [-o <out>]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] comment-threads insert -r <kv>... [-p <v>...] [-o <out>]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] comment-threads list <part> [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] comment-threads update -r <kv>... [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] comments delete <id> [-p <v>...]
|
channels
|
||||||
youtube3 [options] comments insert -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] comments list <part> [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] comments mark-as-spam <id> [-p <v>...]
|
comment-threads
|
||||||
youtube3 [options] comments set-moderation-status <id> <moderation-status> [-p <v>...]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] comments update -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] guide-categories list <part> [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] i18n-languages list <part> [-p <v>...] [-o <out>]
|
comments
|
||||||
youtube3 [options] i18n-regions list <part> [-p <v>...] [-o <out>]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] live-broadcasts bind <id> <part> [-p <v>...] [-o <out>]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] live-broadcasts control <id> <part> [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] live-broadcasts delete <id> [-p <v>...]
|
mark-as-spam <id> [-p <v>]...
|
||||||
youtube3 [options] live-broadcasts insert -r <kv>... [-p <v>...] [-o <out>]
|
set-moderation-status <id> <moderation-status> [-p <v>]...
|
||||||
youtube3 [options] live-broadcasts list <part> [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] live-broadcasts transition <broadcast-status> <id> <part> [-p <v>...] [-o <out>]
|
guide-categories
|
||||||
youtube3 [options] live-broadcasts update -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] live-streams delete <id> [-p <v>...]
|
i18n-languages
|
||||||
youtube3 [options] live-streams insert -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] live-streams list <part> [-p <v>...] [-o <out>]
|
i18n-regions
|
||||||
youtube3 [options] live-streams update -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] playlist-items delete <id> [-p <v>...]
|
live-broadcasts
|
||||||
youtube3 [options] playlist-items insert -r <kv>... [-p <v>...] [-o <out>]
|
bind <id> <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] playlist-items list <part> [-p <v>...] [-o <out>]
|
control <id> <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] playlist-items update -r <kv>... [-p <v>...] [-o <out>]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] playlists delete <id> [-p <v>...]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] playlists insert -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] playlists list <part> [-p <v>...] [-o <out>]
|
transition <broadcast-status> <id> <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] playlists update -r <kv>... [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] search list <part> [-p <v>...] [-o <out>]
|
live-streams
|
||||||
youtube3 [options] subscriptions delete <id> [-p <v>...]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] subscriptions insert -r <kv>... [-p <v>...] [-o <out>]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] subscriptions list <part> [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] thumbnails set <video-id> -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] video-abuse-report-reasons list <part> [-p <v>...] [-o <out>]
|
playlist-items
|
||||||
youtube3 [options] video-categories list <part> [-p <v>...] [-o <out>]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] videos delete <id> [-p <v>...]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] videos get-rating <id> [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] videos insert -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...] [-o <out>]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] videos list <part> [-p <v>...] [-o <out>]
|
playlists
|
||||||
youtube3 [options] videos rate <id> <rating> [-p <v>...]
|
delete <id> [-p <v>]...
|
||||||
youtube3 [options] videos report-abuse -r <kv>... [-p <v>...]
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] videos update -r <kv>... [-p <v>...] [-o <out>]
|
list <part> [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] watermarks set <channel-id> -r <kv>... -u (simple|resumable) <file> <mime> [-p <v>...]
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
youtube3 [options] watermarks unset <channel-id> [-p <v>...]
|
search
|
||||||
|
list <part> [-p <v>]... [-o <out>]
|
||||||
|
subscriptions
|
||||||
|
delete <id> [-p <v>]...
|
||||||
|
insert (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
|
list <part> [-p <v>]... [-o <out>]
|
||||||
|
thumbnails
|
||||||
|
set <video-id> (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
|
video-abuse-report-reasons
|
||||||
|
list <part> [-p <v>]... [-o <out>]
|
||||||
|
video-categories
|
||||||
|
list <part> [-p <v>]... [-o <out>]
|
||||||
|
videos
|
||||||
|
delete <id> [-p <v>]...
|
||||||
|
get-rating <id> [-p <v>]... [-o <out>]
|
||||||
|
insert (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]... [-o <out>]
|
||||||
|
list <part> [-p <v>]... [-o <out>]
|
||||||
|
rate <id> <rating> [-p <v>]...
|
||||||
|
report-abuse (-r <kv>)... [-p <v>]...
|
||||||
|
update (-r <kv>)... [-p <v>]... [-o <out>]
|
||||||
|
watermarks
|
||||||
|
set <channel-id> (-r <kv>)... (-u (simple|resumable) -f <file> [-m <mime>]) [-p <v>]...
|
||||||
|
unset <channel-id> [-p <v>]...
|
||||||
youtube3 --help
|
youtube3 --help
|
||||||
|
|
||||||
All documentation details can be found at
|
All documentation details can be found at
|
||||||
http://byron.github.io/google-apis-rs/google_youtube3_cli/index.html
|
http://byron.github.io/google-apis-rs/google_youtube3_cli
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
--scope <url>
|
[--scope <url>]...
|
||||||
Specify the authentication a method should be executed in. Each scope
|
Specify the authentication a method should be executed in. Each scope
|
||||||
requires the user to grant this application permission to use it.
|
requires the user to grant this application permission to use it.
|
||||||
If unset, it defaults to the shortest scope url for a particular method.
|
If unset, it defaults to the shortest scope url for a particular method.
|
||||||
--config-dir <folder>
|
--config-dir <folder>
|
||||||
A directory into which we will store our persistent data. Defaults to
|
A directory into which we will store our persistent data. Defaults to
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// COPY OF 'src/rust/cli/cmn.rs'
|
// COPY OF 'src/rust/cli/cmn.rs'
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
use oauth2::{ApplicationSecret, ConsoleApplicationSecret, TokenStorage, Token};
|
||||||
use rustc_serialize::json;
|
use serde::json;
|
||||||
use mime::Mime;
|
use mime::Mime;
|
||||||
|
use clap::{App, SubCommand};
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::env;
|
use std::env;
|
||||||
@@ -17,6 +18,46 @@ use std::default::Default;
|
|||||||
|
|
||||||
const FIELD_SEP: char = '.';
|
const FIELD_SEP: char = '.';
|
||||||
|
|
||||||
|
pub enum CallType {
|
||||||
|
Upload(UploadProtocol),
|
||||||
|
Standard,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum UploadProtocol {
|
||||||
|
Simple,
|
||||||
|
Resumable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<str> for UploadProtocol {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
UploadProtocol::Simple => "simple",
|
||||||
|
UploadProtocol::Resumable => "resumable"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<str> for CallType {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
match *self {
|
||||||
|
CallType::Upload(ref proto) => proto.as_ref(),
|
||||||
|
CallType::Standard => "standard-request"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FromStr for UploadProtocol {
|
||||||
|
type Err = String;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<UploadProtocol, String> {
|
||||||
|
match s {
|
||||||
|
"simple" => Ok(UploadProtocol::Simple),
|
||||||
|
"resumable" => Ok(UploadProtocol::Resumable),
|
||||||
|
_ => Err(format!("Protocol '{}' is unknown", s)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct FieldCursor(Vec<String>);
|
pub struct FieldCursor(Vec<String>);
|
||||||
|
|
||||||
@@ -112,6 +153,17 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn protocol_from_str(name: &str, valid_protocols: Vec<String>, err: &mut InvalidOptionsError) -> CallType {
|
||||||
|
CallType::Upload(
|
||||||
|
match UploadProtocol::from_str(name) {
|
||||||
|
Ok(up) => up,
|
||||||
|
Err(msg) => {
|
||||||
|
err.issues.push(CLIError::InvalidUploadProtocol(name.to_string(), valid_protocols));
|
||||||
|
UploadProtocol::Simple
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
pub fn input_file_from_opts(file_path: &str, err: &mut InvalidOptionsError) -> Option<fs::File> {
|
||||||
match fs::File::open(file_path) {
|
match fs::File::open(file_path) {
|
||||||
Ok(f) => Some(f),
|
Ok(f) => Some(f),
|
||||||
@@ -132,13 +184,14 @@ pub fn input_mime_from_opts(mime: &str, err: &mut InvalidOptionsError) -> Option
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// May panic if we can't open the file - this is anticipated, we can't currently communicate this
|
pub fn writer_from_opts(arg: Option<&str>) -> Result<Box<Write>, io::Error> {
|
||||||
// kind of error: TODO: fix this architecture :)
|
let f = arg.unwrap_or("-");
|
||||||
pub fn writer_from_opts(flag: bool, arg: &str) -> Box<Write> {
|
match f {
|
||||||
if !flag || arg == "-" {
|
"-" => Ok(Box::new(stdout())),
|
||||||
Box::new(stdout())
|
_ => match fs::OpenOptions::new().create(true).write(true).open(f) {
|
||||||
} else {
|
Ok(f) => Ok(Box::new(f)),
|
||||||
Box::new(fs::OpenOptions::new().create(true).write(true).open(arg).unwrap())
|
Err(io_err) => Err(io_err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +204,7 @@ pub fn arg_from_str<T>(arg: &str, err: &mut InvalidOptionsError,
|
|||||||
match FromStr::from_str(arg) {
|
match FromStr::from_str(arg) {
|
||||||
Err(perr) => {
|
Err(perr) => {
|
||||||
err.issues.push(
|
err.issues.push(
|
||||||
CLIError::ParseError((arg_name, arg_type, arg.to_string(), format!("{}", perr)))
|
CLIError::ParseError(arg_name, arg_type, arg.to_string(), format!("{}", perr))
|
||||||
);
|
);
|
||||||
Default::default()
|
Default::default()
|
||||||
},
|
},
|
||||||
@@ -171,49 +224,47 @@ impl JsonTokenStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TokenStorage for JsonTokenStorage {
|
impl TokenStorage for JsonTokenStorage {
|
||||||
type Error = io::Error;
|
type Error = json::Error;
|
||||||
|
|
||||||
// NOTE: logging might be interesting, currently we swallow all errors
|
// NOTE: logging might be interesting, currently we swallow all errors
|
||||||
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Option<io::Error> {
|
fn set(&mut self, scope_hash: u64, _: &Vec<&str>, token: Option<Token>) -> Result<(), json::Error> {
|
||||||
match token {
|
match token {
|
||||||
None => {
|
None => {
|
||||||
match fs::remove_file(self.path(scope_hash)) {
|
match fs::remove_file(self.path(scope_hash)) {
|
||||||
Err(err) =>
|
Err(err) =>
|
||||||
match err.kind() {
|
match err.kind() {
|
||||||
io::ErrorKind::NotFound => None,
|
io::ErrorKind::NotFound => Ok(()),
|
||||||
_ => Some(err)
|
_ => Err(json::Error::IoError(err))
|
||||||
},
|
},
|
||||||
Ok(_) => None
|
Ok(_) => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(token) => {
|
Some(token) => {
|
||||||
let json_token = json::encode(&token).unwrap();
|
|
||||||
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
match fs::OpenOptions::new().create(true).write(true).open(&self.path(scope_hash)) {
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
match f.write(json_token.as_bytes()) {
|
match json::to_writer_pretty(&mut f, &token) {
|
||||||
Ok(_) => None,
|
Ok(_) => Ok(()),
|
||||||
Err(io_err) => Some(io_err),
|
Err(io_err) => Err(json::Error::IoError(io_err)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(io_err) => Some(io_err)
|
Err(io_err) => Err(json::Error::IoError(io_err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, io::Error> {
|
fn get(&self, scope_hash: u64, _: &Vec<&str>) -> Result<Option<Token>, json::Error> {
|
||||||
match fs::File::open(&self.path(scope_hash)) {
|
match fs::File::open(&self.path(scope_hash)) {
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
let mut json_string = String::new();
|
match json::de::from_reader(f) {
|
||||||
match f.read_to_string(&mut json_string) {
|
Ok(token) => Ok(Some(token)),
|
||||||
Ok(_) => Ok(Some(json::decode::<Token>(&json_string).unwrap())),
|
Err(err) => Err(err),
|
||||||
Err(io_err) => Err(io_err),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(io_err) => {
|
Err(io_err) => {
|
||||||
match io_err.kind() {
|
match io_err.kind() {
|
||||||
io::ErrorKind::NotFound => Ok(None),
|
io::ErrorKind::NotFound => Ok(None),
|
||||||
_ => Err(io_err)
|
_ => Err(json::Error::IoError(io_err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +274,7 @@ impl TokenStorage for JsonTokenStorage {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ApplicationSecretError {
|
pub enum ApplicationSecretError {
|
||||||
DecoderError((String, json::DecoderError)),
|
DecoderError((String, json::Error)),
|
||||||
FormatError(String),
|
FormatError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,11 +362,14 @@ impl fmt::Display for FieldError {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CLIError {
|
pub enum CLIError {
|
||||||
Configuration(ConfigurationError),
|
Configuration(ConfigurationError),
|
||||||
ParseError((&'static str, &'static str, String, String)),
|
ParseError(&'static str, &'static str, String, String),
|
||||||
UnknownParameter(String),
|
UnknownParameter(String),
|
||||||
|
InvalidUploadProtocol(String, Vec<String>),
|
||||||
InvalidKeyValueSyntax(String, bool),
|
InvalidKeyValueSyntax(String, bool),
|
||||||
Input(InputError),
|
Input(InputError),
|
||||||
Field(FieldError),
|
Field(FieldError),
|
||||||
|
MissingCommandError,
|
||||||
|
MissingMethodError(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for CLIError {
|
impl fmt::Display for CLIError {
|
||||||
@@ -324,7 +378,9 @@ impl fmt::Display for CLIError {
|
|||||||
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
CLIError::Configuration(ref err) => write!(f, "Configuration -> {}", err),
|
||||||
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
CLIError::Input(ref err) => write!(f, "Input -> {}", err),
|
||||||
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
CLIError::Field(ref err) => write!(f, "Field -> {}", err),
|
||||||
CLIError::ParseError((arg_name, type_name, ref value, ref err_desc))
|
CLIError::InvalidUploadProtocol(ref proto_name, ref valid_names)
|
||||||
|
=> writeln!(f, "'{}' is not a valid upload protocol. Choose from one of {}", proto_name, valid_names.connect(", ")),
|
||||||
|
CLIError::ParseError(arg_name, type_name, ref value, ref err_desc)
|
||||||
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
=> writeln!(f, "Failed to parse argument '{}' with value '{}' as {} with error: {}",
|
||||||
arg_name, value, type_name, err_desc),
|
arg_name, value, type_name, err_desc),
|
||||||
CLIError::UnknownParameter(ref param_name)
|
CLIError::UnknownParameter(ref param_name)
|
||||||
@@ -333,6 +389,8 @@ impl fmt::Display for CLIError {
|
|||||||
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
let hashmap_info = if is_hashmap { "hashmap " } else { "" };
|
||||||
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
writeln!(f, "'{}' does not match {}pattern <key>=<value>", kv, hashmap_info)
|
||||||
},
|
},
|
||||||
|
CLIError::MissingCommandError => writeln!(f, "Please specify the main sub-command"),
|
||||||
|
CLIError::MissingMethodError(ref cmd) => writeln!(f, "Please specify the method to call on the '{}' command", cmd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,7 +457,7 @@ pub fn assure_config_dir_exists(dir: &str) -> Result<String, CLIError> {
|
|||||||
|
|
||||||
pub fn application_secret_from_directory(dir: &str,
|
pub fn application_secret_from_directory(dir: &str,
|
||||||
secret_basename: &str,
|
secret_basename: &str,
|
||||||
json_app_secret: &str)
|
json_console_secret: &str)
|
||||||
-> Result<ApplicationSecret, CLIError> {
|
-> Result<ApplicationSecret, CLIError> {
|
||||||
let secret_path = Path::new(dir).join(secret_basename);
|
let secret_path = Path::new(dir).join(secret_basename);
|
||||||
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
let secret_str = || secret_path.as_path().to_str().unwrap().to_string();
|
||||||
@@ -418,7 +476,10 @@ pub fn application_secret_from_directory(dir: &str,
|
|||||||
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
err = match fs::OpenOptions::new().create(true).write(true).open(&secret_path) {
|
||||||
Err(cfe) => cfe,
|
Err(cfe) => cfe,
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
match f.write(json_app_secret.as_bytes()) {
|
// Assure we convert 'ugly' json string into pretty one
|
||||||
|
let console_secret: ConsoleApplicationSecret
|
||||||
|
= json::from_str(json_console_secret).unwrap();
|
||||||
|
match json::to_writer_pretty(&mut f, &console_secret) {
|
||||||
Err(io_err) => io_err,
|
Err(io_err) => io_err,
|
||||||
Ok(_) => continue,
|
Ok(_) => continue,
|
||||||
}
|
}
|
||||||
@@ -429,23 +490,24 @@ pub fn application_secret_from_directory(dir: &str,
|
|||||||
return secret_io_error(err)
|
return secret_io_error(err)
|
||||||
},
|
},
|
||||||
Ok(mut f) => {
|
Ok(mut f) => {
|
||||||
let mut json_encoded_secret = String::new();
|
match json::de::from_reader::<_, ConsoleApplicationSecret>(f) {
|
||||||
if let Err(io_err) = f.read_to_string(&mut json_encoded_secret) {
|
Err(json::Error::IoError(err)) =>
|
||||||
return secret_io_error(io_err)
|
return secret_io_error(err),
|
||||||
}
|
Err(json_err) =>
|
||||||
match json::decode::<ConsoleApplicationSecret>(&json_encoded_secret) {
|
return Err(CLIError::Configuration(
|
||||||
Err(json_decode_error) => return Err(CLIError::Configuration(
|
ConfigurationError::Secret(
|
||||||
ConfigurationError::Secret(ApplicationSecretError::DecoderError(
|
ApplicationSecretError::DecoderError(
|
||||||
(secret_str(), json_decode_error)
|
(secret_str(), json_err)
|
||||||
)))),
|
)))),
|
||||||
Ok(console_secret) => match console_secret.installed {
|
Ok(console_secret) =>
|
||||||
Some(secret) => return Ok(secret),
|
match console_secret.installed {
|
||||||
None => return Err(
|
Some(secret) => return Ok(secret),
|
||||||
CLIError::Configuration(
|
None => return Err(
|
||||||
ConfigurationError::Secret(
|
CLIError::Configuration(
|
||||||
ApplicationSecretError::FormatError(secret_str())
|
ConfigurationError::Secret(
|
||||||
)))
|
ApplicationSecretError::FormatError(secret_str())
|
||||||
},
|
)))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ DO NOT EDIT !
|
|||||||
-->
|
-->
|
||||||
The `google-youtube3` library allows access to all features of the *Google YouTube* service.
|
The `google-youtube3` library allows access to all features of the *Google YouTube* service.
|
||||||
|
|
||||||
This documentation was generated from *YouTube* crate version *0.1.6+20150414*, where *20150414* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
This documentation was generated from *YouTube* crate version *0.1.7+20150414*, where *20150414* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||||
|
|
||||||
Everything else about the *YouTube* *v3* API can be found at the
|
Everything else about the *YouTube* *v3* API can be found at the
|
||||||
[official documentation site](https://developers.google.com/youtube/v3).
|
[official documentation site](https://developers.google.com/youtube/v3).
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "google-youtube3"
|
name = "google-youtube3"
|
||||||
version = "0.1.6+20150414"
|
version = "0.1.7+20150414"
|
||||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||||
description = "A complete library to interact with YouTube (protocol v3)"
|
description = "A complete library to interact with YouTube (protocol v3)"
|
||||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3"
|
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/youtube3"
|
||||||
|
|||||||
@@ -173,7 +173,10 @@ pub trait Delegate {
|
|||||||
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
/// Called after we have retrieved a new upload URL for a resumable upload to store it
|
||||||
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
/// in case we fail or cancel. That way, we can attempt to resume the upload later,
|
||||||
/// see `upload_url()`.
|
/// see `upload_url()`.
|
||||||
fn store_upload_url(&mut self, url: &str) {
|
/// It will also be called with None after a successful upload, which allows the delegate
|
||||||
|
/// to forget the URL. That way, we will not attempt to resume an upload that has already
|
||||||
|
/// finished.
|
||||||
|
fn store_upload_url(&mut self, url: Option<&str>) {
|
||||||
let _ = url;
|
let _ = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,6 +462,16 @@ impl<'a> Read for MultiPartReader<'a> {
|
|||||||
header!{
|
header!{
|
||||||
#[doc="The `X-Upload-Content-Type` header."]
|
#[doc="The `X-Upload-Content-Type` header."]
|
||||||
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
(XUploadContentType, "X-Upload-Content-Type") => [Mime]
|
||||||
|
|
||||||
|
xupload_content_type {
|
||||||
|
test_header!(
|
||||||
|
test1,
|
||||||
|
vec![b"text/plain"],
|
||||||
|
Some(HeaderField(
|
||||||
|
vec![Mime(TopLevel::Text, SubLevel::Plain, Vec::new())]
|
||||||
|
)));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
// This file was generated automatically from 'src/mako/api/lib.rs.mako'
|
||||||
// DO NOT EDIT !
|
// DO NOT EDIT !
|
||||||
|
|
||||||
//! This documentation was generated from *YouTube* crate version *0.1.6+20150414*, where *20150414* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.6*.
|
//! This documentation was generated from *YouTube* crate version *0.1.7+20150414*, where *20150414* is the exact revision of the *youtube:v3* schema built by the [mako](http://www.makotemplates.org/) code generator *v0.1.7*.
|
||||||
//!
|
//!
|
||||||
//! Everything else about the *YouTube* *v3* API can be found at the
|
//! Everything else about the *YouTube* *v3* API can be found at the
|
||||||
//! [official documentation site](https://developers.google.com/youtube/v3).
|
//! [official documentation site](https://developers.google.com/youtube/v3).
|
||||||
@@ -240,7 +240,6 @@
|
|||||||
//! [google-go-api]: https://github.com/google/google-api-go-client
|
//! [google-go-api]: https://github.com/google/google-api-go-client
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
#![feature(std_misc)]
|
|
||||||
// Unused attributes happen thanks to defined, but unused structures
|
// Unused attributes happen thanks to defined, but unused structures
|
||||||
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
// We don't warn about this, as depending on the API, some data structures or facilities are never used.
|
||||||
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
// Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any
|
||||||
@@ -402,7 +401,7 @@ impl<'a, C, A> YouTube<C, A>
|
|||||||
YouTube {
|
YouTube {
|
||||||
client: RefCell::new(client),
|
client: RefCell::new(client),
|
||||||
auth: RefCell::new(authenticator),
|
auth: RefCell::new(authenticator),
|
||||||
_user_agent: "google-api-rust-client/0.1.6".to_string(),
|
_user_agent: "google-api-rust-client/0.1.7".to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +470,7 @@ impl<'a, C, A> YouTube<C, A>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Set the user-agent header field to use in all requests to the server.
|
/// Set the user-agent header field to use in all requests to the server.
|
||||||
/// It defaults to `google-api-rust-client/0.1.6`.
|
/// It defaults to `google-api-rust-client/0.1.7`.
|
||||||
///
|
///
|
||||||
/// Returns the previously set user-agent.
|
/// Returns the previously set user-agent.
|
||||||
pub fn user_agent(&mut self, agent_name: String) -> String {
|
pub fn user_agent(&mut self, agent_name: String) -> String {
|
||||||
@@ -7577,7 +7576,7 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut<hyper::Clien
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -7605,6 +7604,7 @@ impl<'a, C, A> ChannelBannerInsertCall<'a, C, A> where C: BorrowMut<hyper::Clien
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -10458,7 +10458,7 @@ impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -10486,6 +10486,7 @@ impl<'a, C, A> ThumbnailSetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -12502,7 +12503,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -12530,6 +12531,7 @@ impl<'a, C, A> VideoInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A: o
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -20182,7 +20184,7 @@ impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -20210,6 +20212,7 @@ impl<'a, C, A> WatermarkSetCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -23087,7 +23090,7 @@ impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -23115,6 +23118,7 @@ impl<'a, C, A> CaptionInsertCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
@@ -24044,7 +24048,7 @@ impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
let upload_result = {
|
let upload_result = {
|
||||||
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
let url_str = &res.headers.get::<Location>().expect("Location header is part of protocol").0;
|
||||||
if upload_url_from_server {
|
if upload_url_from_server {
|
||||||
dlg.store_upload_url(url_str);
|
dlg.store_upload_url(Some(url_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmn::ResumableUploadHelper {
|
cmn::ResumableUploadHelper {
|
||||||
@@ -24072,6 +24076,7 @@ impl<'a, C, A> CaptionUpdateCall<'a, C, A> where C: BorrowMut<hyper::Client>, A:
|
|||||||
Some(Ok(upload_result)) => {
|
Some(Ok(upload_result)) => {
|
||||||
res = upload_result;
|
res = upload_result;
|
||||||
if !res.status.is_success() {
|
if !res.status.is_success() {
|
||||||
|
dlg.store_upload_url(None);
|
||||||
dlg.finished(false);
|
dlg.finished(false);
|
||||||
return Err(Error::Failure(res))
|
return Err(Error::Failure(res))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user