mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
chore(code): updated to latest state
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-freebase1-cli"
|
||||
version = "0.3.2+20150728"
|
||||
version = "0.3.3+20150728"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||
description = "A complete library to interact with freebase (protocol v1)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1-cli"
|
||||
@@ -21,10 +21,10 @@ hyper = "0.7"
|
||||
mime = "0.1.0"
|
||||
serde = ">= 0.6.0"
|
||||
serde_json = ">= 0.6.0"
|
||||
yup-oauth2 = "0.5"
|
||||
yup-oauth2 = ">= 0.5.4"
|
||||
strsim = "0.4"
|
||||
yup-hyper-mock = "1.0"
|
||||
clap = "1.5"
|
||||
clap = "2.0"
|
||||
|
||||
[build-dependencies]
|
||||
syntex = { version = ">= 0.23" }
|
||||
|
||||
@@ -6,7 +6,7 @@ DO NOT EDIT !
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright © `2015` `Sebastian Thiel`
|
||||
Copyright © `2015-2016` `Sebastian Thiel`
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
||||
@@ -17,14 +17,14 @@ Everything else about the *freebase* API can be found at the
|
||||
|
||||
You can download the pre-compiled 64bit binaries for the following platforms:
|
||||
|
||||
*  [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.2/ubuntu/freebase1.tar.gz)
|
||||
*  [osx](http://dl.byronimo.de/google.rs/cli/0.3.2/osx/freebase1.tar.gz)
|
||||
*  [ubuntu](http://dl.byronimo.de/google.rs/cli/0.3.3/ubuntu/freebase1.tar.gz)
|
||||
*  [osx](http://dl.byronimo.de/google.rs/cli/0.3.3/osx/freebase1.tar.gz)
|
||||
|
||||
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/freebase1-cli).
|
||||
|
||||
# Usage
|
||||
|
||||
This documentation was generated from the *freebase* API at revision *20150728*. The CLI is at version *0.3.2*.
|
||||
This documentation was generated from the *freebase* API at revision *20150728*. The CLI is at version *0.3.3*.
|
||||
|
||||
```bash
|
||||
freebase1 [options]
|
||||
@@ -35,14 +35,14 @@ freebase1 [options]
|
||||
|
||||
Configuration:
|
||||
--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
|
||||
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
|
||||
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`
|
||||
Output all communication related to authentication to standard error. `tx`
|
||||
and `rx` are placed into the same stream.
|
||||
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
site_name: freebase v0.3.2+20150728
|
||||
site_name: freebase v0.3.3+20150728
|
||||
site_url: http://byron.github.io/google-apis-rs/google-freebase1-cli
|
||||
site_description: Write integrating applications with bcore
|
||||
|
||||
@@ -14,5 +14,5 @@ pages:
|
||||
|
||||
theme: readthedocs
|
||||
|
||||
copyright: Copyright © 2015, `Sebastian Thiel`
|
||||
copyright: Copyright © 2015-2016, `Sebastian Thiel`
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use clap::{App, SubCommand, Arg};
|
||||
|
||||
mod cmn;
|
||||
|
||||
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
||||
use cmn::{InvalidOptionsError, CLIError, JsonTokenStorage, arg_from_str, writer_from_opts, parse_kv_arg,
|
||||
input_file_from_opts, input_mime_from_opts, FieldCursor, FieldError, CallType, UploadProtocol,
|
||||
calltype_from_str, remove_json_null_values, ComplexType, JsonType, JsonTypeInfo};
|
||||
|
||||
@@ -36,19 +36,19 @@ enum DoitError {
|
||||
ApiError(api::Error),
|
||||
}
|
||||
|
||||
struct Engine<'n, 'a> {
|
||||
opt: ArgMatches<'n, 'a>,
|
||||
struct Engine<'n> {
|
||||
opt: ArgMatches<'n>,
|
||||
hub: api::Freebase<hyper::Client, Authenticator<DefaultAuthenticatorDelegate, JsonTokenStorage, hyper::Client>>,
|
||||
gp: Vec<&'static str>,
|
||||
gpm: Vec<(&'static str, &'static str)>,
|
||||
}
|
||||
|
||||
|
||||
impl<'n, 'a> Engine<'n, 'a> {
|
||||
fn _methods_reconcile(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
impl<'n> Engine<'n> {
|
||||
fn _methods_reconcile(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut call = self.hub.methods().reconcile();
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"prop" => {
|
||||
@@ -79,7 +79,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["lang", "kind", "name", "confidence", "prop", "limit"].iter().map(|v|*v));
|
||||
@@ -113,11 +113,11 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn _methods_search(&self, opt: &ArgMatches<'n, 'a>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
fn _methods_search(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Result<(), DoitError> {
|
||||
let mut download_mode = false;
|
||||
let mut call = self.hub.methods().search();
|
||||
for parg in opt.values_of("v").unwrap_or(Vec::new()).iter() {
|
||||
for parg in opt.values_of("v").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"without" => {
|
||||
@@ -202,7 +202,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
err.issues.push(CLIError::UnknownParameter(key.to_string(),
|
||||
{let mut v = Vec::new();
|
||||
v.extend(self.gp.iter().map(|v|*v));
|
||||
v.extend(["domain", "help", "query", "stemmed", "cursor", "prefixed", "exact", "mid", "encode", "type", "as-of-time", "scoring", "format", "spell", "with", "lang", "indent", "filter", "callback", "without", "limit", "output", "mql-output"].iter().map(|v|*v));
|
||||
@@ -273,14 +273,14 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
}
|
||||
|
||||
// Please note that this call will fail if any part of the opt can't be handled
|
||||
fn new(opt: ArgMatches<'a, 'n>) -> Result<Engine<'a, 'n>, InvalidOptionsError> {
|
||||
fn new(opt: ArgMatches<'n>) -> Result<Engine<'n>, InvalidOptionsError> {
|
||||
let (config_dir, secret) = {
|
||||
let config_dir = match cmn::assure_config_dir_exists(opt.value_of("folder").unwrap_or("~/.google-service-cli")) {
|
||||
Err(e) => return Err(InvalidOptionsError::single(e, 3)),
|
||||
Ok(p) => p,
|
||||
};
|
||||
|
||||
match cmn::application_secret_from_directory(&config_dir, "freebase1-secret.json",
|
||||
match cmn::application_secret_from_directory(&config_dir, "freebase1-secret.json",
|
||||
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
|
||||
Ok(secret) => (config_dir, secret),
|
||||
Err(e) => return Err(InvalidOptionsError::single(e, 4))
|
||||
@@ -300,7 +300,7 @@ impl<'n, 'a> Engine<'n, 'a> {
|
||||
db_dir: config_dir.clone(),
|
||||
}, None);
|
||||
|
||||
let client =
|
||||
let client =
|
||||
if opt.is_present("debug") {
|
||||
hyper::Client::with_connector(mock::TeeConnector {
|
||||
connector: hyper::net::HttpsConnector::<hyper::net::Openssl>::default()
|
||||
@@ -339,7 +339,7 @@ fn main() {
|
||||
let mut exit_status = 0i32;
|
||||
let arg_data = [
|
||||
("methods", "methods: 'reconcile' and 'search'", vec![
|
||||
("reconcile",
|
||||
("reconcile",
|
||||
Some(r##"Reconcile entities to Freebase open data."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_freebase1_cli/methods_reconcile",
|
||||
vec![
|
||||
@@ -355,7 +355,7 @@ fn main() {
|
||||
Some(false),
|
||||
Some(false)),
|
||||
]),
|
||||
("search",
|
||||
("search",
|
||||
Some(r##"Search Freebase open data."##),
|
||||
"Details at http://byron.github.io/google-apis-rs/google_freebase1_cli/methods_search",
|
||||
vec![
|
||||
@@ -377,7 +377,7 @@ fn main() {
|
||||
|
||||
let mut app = App::new("freebase1")
|
||||
.author("Sebastian Thiel <byronimo@gmail.com>")
|
||||
.version("0.3.2+20150728")
|
||||
.version("0.3.3+20150728")
|
||||
.about("Find Freebase entities using textual queries and other constraints.")
|
||||
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_freebase1_cli")
|
||||
.arg(Arg::with_name("folder")
|
||||
@@ -396,7 +396,7 @@ fn main() {
|
||||
.multiple(false)
|
||||
.takes_value(false));
|
||||
|
||||
for &(main_command_name, ref about, ref subcommands) in arg_data.iter() {
|
||||
for &(main_command_name, about, ref subcommands) in arg_data.iter() {
|
||||
let mut mcmd = SubCommand::with_name(main_command_name).about(about);
|
||||
|
||||
for &(sub_command_name, ref desc, url_info, ref args) in subcommands {
|
||||
@@ -407,7 +407,7 @@ fn main() {
|
||||
scmd = scmd.after_help(url_info);
|
||||
|
||||
for &(ref arg_name, ref flag, ref desc, ref required, ref multi) in args {
|
||||
let arg_name_str =
|
||||
let arg_name_str =
|
||||
match (arg_name, flag) {
|
||||
(&Some(an), _ ) => an,
|
||||
(_ , &Some(f)) => f,
|
||||
|
||||
Reference in New Issue
Block a user