remove changes to gen

This commit is contained in:
OMGeeky
2024-05-13 19:25:02 +02:00
parent 3092fef613
commit d1d2e9937c
3222 changed files with 5562822 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-abusiveexperiencereport1-cli"
version = "5.0.4+20240207"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Abusive Experience Report (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1-cli"
homepage = "https://developers.google.com/abusive-experience-report/"
documentation = "http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli"
license = "MIT"
keywords = ["abusiveexperiencerep", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "abusiveexperiencereport1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-abusiveexperiencereport1]
path = "../abusiveexperiencereport1"
version = "5.0.4+20240207"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,103 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `abusiveexperiencereport1` command-line interface *(CLI)* allows to use most features of the *Google Abusive Experience Report* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Abusive Experience Report* API can be found at the
[official documentation site](https://developers.google.com/abusive-experience-report/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-abusiveexperiencereport1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1-cli).
# Usage
This documentation was generated from the *Abusive Experience Report* API at revision *20240207*. The CLI is at version *5.0.4*.
```bash
abusiveexperiencereport1 [options]
sites
get <name> [-p <v>]... [-o <out>]
violating-sites
list [-p <v>]... [-o <out>]
abusiveexperiencereport1 --help
Configuration:
--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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `abusiveexperiencereport1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/abusiveexperiencereport1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/abusiveexperiencereport1-secret.json`, assuming that the required *abusiveexperiencereport* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `abusiveexperiencereport1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,20 @@
site_name: Abusive Experience Report v5.0.4+20240207
site_url: http://byron.github.io/google-apis-rs/google-abusiveexperiencereport1-cli
site_description: A complete library to interact with Abusive Experience Report (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Sites':
- 'Get': 'sites_get.md'
- 'Violating Sites':
- 'List': 'violating-sites_list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

View File

@@ -0,0 +1,387 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/cli/main.rs.mako'
// DO NOT EDIT !
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
#[macro_use]
extern crate clap;
use std::env;
use std::io::{self, Write};
use clap::{App, SubCommand, Arg};
use google_abusiveexperiencereport1::{api, Error, oauth2, client::chrono, FieldMask};
use google_clis_common as client;
use client::{InvalidOptionsError, CLIError, 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};
use std::default::Default;
use std::error::Error as StdError;
use std::str::FromStr;
use serde_json as json;
use clap::ArgMatches;
use http::Uri;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service;
enum DoitError {
IoError(String, io::Error),
ApiError(Error),
}
struct Engine<'n, S> {
opt: ArgMatches<'n>,
hub: api::AbusiveExperienceReport<S>,
gp: Vec<&'static str>,
gpm: Vec<(&'static str, &'static str)>,
}
impl<'n, S> Engine<'n, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
async fn _sites_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut call = self.hub.sites().get(opt.value_of("name").unwrap_or(""));
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 {
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
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 {
CallType::Standard => call.doit().await,
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
async fn _violating_sites_list(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut call = self.hub.violating_sites().list();
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 {
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
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 {
CallType::Standard => call.doit().await,
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
async fn _doit(&self, dry_run: bool) -> Result<Result<(), DoitError>, Option<InvalidOptionsError>> {
let mut err = InvalidOptionsError::new();
let mut call_result: Result<(), DoitError> = Ok(());
let mut err_opt: Option<InvalidOptionsError> = None;
match self.opt.subcommand() {
("sites", Some(opt)) => {
match opt.subcommand() {
("get", Some(opt)) => {
call_result = self._sites_get(opt, dry_run, &mut err).await;
},
_ => {
err.issues.push(CLIError::MissingMethodError("sites".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
}
}
},
("violating-sites", Some(opt)) => {
match opt.subcommand() {
("list", Some(opt)) => {
call_result = self._violating_sites_list(opt, dry_run, &mut err).await;
},
_ => {
err.issues.push(CLIError::MissingMethodError("violating-sites".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
}
}
},
_ => {
err.issues.push(CLIError::MissingCommandError);
writeln!(io::stderr(), "{}\n", self.opt.usage()).ok();
}
}
if dry_run {
if err.issues.len() > 0 {
err_opt = Some(err);
}
Err(err_opt)
} else {
Ok(call_result)
}
}
// Please note that this call will fail if any part of the opt can't be handled
async fn new(opt: ArgMatches<'n>, connector: S) -> Result<Engine<'n, S>, InvalidOptionsError> {
let (config_dir, secret) = {
let config_dir = match client::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 client::application_secret_from_directory(&config_dir, "abusiveexperiencereport1-secret.json",
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
Ok(secret) => (config_dir, secret),
Err(e) => return Err(InvalidOptionsError::single(e, 4))
}
};
let client = hyper::Client::builder().build(connector);
let auth = oauth2::InstalledFlowAuthenticator::with_client(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
client.clone(),
).persist_tokens_to_disk(format!("{}/abusiveexperiencereport1", config_dir)).build().await.unwrap();
let engine = Engine {
opt: opt,
hub: api::AbusiveExperienceReport::new(client, auth),
gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"],
gpm: vec![
("$-xgafv", "$.xgafv"),
("access-token", "access_token"),
("oauth-token", "oauth_token"),
("pretty-print", "prettyPrint"),
("quota-user", "quotaUser"),
("upload-type", "uploadType"),
("upload-protocol", "upload_protocol"),
]
};
match engine._doit(true).await {
Err(Some(err)) => Err(err),
Err(None) => Ok(engine),
Ok(_) => unreachable!(),
}
}
async fn doit(&self) -> Result<(), DoitError> {
match self._doit(false).await {
Ok(res) => res,
Err(_) => unreachable!(),
}
}
}
#[tokio::main]
async fn main() {
let mut exit_status = 0i32;
let arg_data = [
("sites", "methods: 'get'", vec![
("get",
Some(r##"Gets a site's Abusive Experience Report summary."##),
"Details at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli/sites_get",
vec![
(Some(r##"name"##),
None,
Some(r##"Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`"##),
Some(true),
Some(false)),
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
]),
("violating-sites", "methods: 'list'", vec![
("list",
Some(r##"Lists sites that are failing in the Abusive Experience Report."##),
"Details at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli/violating-sites_list",
vec![
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
]),
];
let mut app = App::new("abusiveexperiencereport1")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("5.0.4+20240207")
.about("Views Abusive Experience Report data, and gets a list of sites that have a significant number of abusive experiences.")
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_abusiveexperiencereport1_cli")
.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("Debug print all errors")
.multiple(false)
.takes_value(false));
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 {
let mut scmd = SubCommand::with_name(sub_command_name);
if let &Some(desc) = desc {
scmd = scmd.about(desc);
}
scmd = scmd.after_help(url_info);
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)
.empty_values(false);
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);
}
scmd = scmd.arg(arg);
}
mcmd = mcmd.subcommand(scmd);
}
app = app.subcommand(mcmd);
}
let matches = app.get_matches();
let debug = matches.is_present("adebug");
let connector = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots()
.https_or_http()
.enable_http1()
.build();
match Engine::new(matches, connector).await {
Err(err) => {
exit_status = err.exit_code;
writeln!(io::stderr(), "{}", err).ok();
},
Ok(engine) => {
if let Err(doit_err) = engine.doit().await {
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();
}
}
}
}
}
}
std::process::exit(exit_status);
}

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-abusiveexperiencereport1"
version = "5.0.4+20240207"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Abusive Experience Report (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1"
homepage = "https://developers.google.com/abusive-experience-report/"
documentation = "https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207"
license = "MIT"
keywords = ["abusiveexperiencerep", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,179 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-abusiveexperiencereport1` library allows access to all features of the *Google Abusive Experience Report* service.
This documentation was generated from *Abusive Experience Report* crate version *5.0.4+20240207*, where *20240207* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Abusive Experience Report* *v1* API can be found at the
[official documentation site](https://developers.google.com/abusive-experience-report/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/AbusiveExperienceReport) ...
* sites
* [*get*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/api::SiteGetCall)
* violating sites
* [*list*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/api::ViolatingSiteListCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/AbusiveExperienceReport)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder)
* **[Resources](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.sites().get(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-abusiveexperiencereport1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
use abusiveexperiencereport1::{Result, Error};
use std::default::Default;
use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.sites().get("name")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Delegate) to the
[Method Builder](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::RequestValue) and
[decodable](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-abusiveexperiencereport1/5.0.4+20240207/google_abusiveexperiencereport1/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **abusiveexperiencereport1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

View File

@@ -0,0 +1,740 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
// ########
// HUB ###
// ######
/// Central instance to access all AbusiveExperienceReport related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// use abusiveexperiencereport1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // 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
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.sites().get("name")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AbusiveExperienceReport<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for AbusiveExperienceReport<S> {}
impl<'a, S> AbusiveExperienceReport<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AbusiveExperienceReport<S> {
AbusiveExperienceReport {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.4".to_string(),
_base_url: "https://abusiveexperiencereport.googleapis.com/".to_string(),
_root_url: "https://abusiveexperiencereport.googleapis.com/".to_string(),
}
}
pub fn sites(&'a self) -> SiteMethods<'a, S> {
SiteMethods { hub: &self }
}
pub fn violating_sites(&'a self) -> ViolatingSiteMethods<'a, S> {
ViolatingSiteMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.4`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://abusiveexperiencereport.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://abusiveexperiencereport.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// Response message for GetSiteSummary.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [get sites](SiteGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SiteSummaryResponse {
/// The site's Abusive Experience Report status.
#[serde(rename="abusiveStatus")]
pub abusive_status: Option<String>,
/// The time at which [enforcement](https://support.google.com/webtools/answer/7538608) against the site began or will begin. Not set when the filter_status is OFF.
#[serde(rename="enforcementTime")]
pub enforcement_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The site's [enforcement status](https://support.google.com/webtools/answer/7538608).
#[serde(rename="filterStatus")]
pub filter_status: Option<String>,
/// The time at which the site's status last changed.
#[serde(rename="lastChangeTime")]
pub last_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// A link to the full Abusive Experience Report for the site. Not set in ViolatingSitesResponse. Note that you must complete the [Search Console verification process](https://support.google.com/webmasters/answer/9008080) for the site before you can access the full report.
#[serde(rename="reportUrl")]
pub report_url: Option<String>,
/// The name of the reviewed site, e.g. `google.com`.
#[serde(rename="reviewedSite")]
pub reviewed_site: Option<String>,
/// Whether the site is currently under review.
#[serde(rename="underReview")]
pub under_review: Option<bool>,
}
impl client::ResponseResult for SiteSummaryResponse {}
/// Response message for ListViolatingSites.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [list violating sites](ViolatingSiteListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ViolatingSitesResponse {
/// The list of violating sites.
#[serde(rename="violatingSites")]
pub violating_sites: Option<Vec<SiteSummaryResponse>>,
}
impl client::ResponseResult for ViolatingSitesResponse {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *site* resources.
/// It is not used directly, but through the [`AbusiveExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `get(...)`
/// // to build up your call.
/// let rb = hub.sites();
/// # }
/// ```
pub struct SiteMethods<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
}
impl<'a, S> client::MethodsBuilder for SiteMethods<'a, S> {}
impl<'a, S> SiteMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets a site's Abusive Experience Report summary.
///
/// # Arguments
///
/// * `name` - Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`
pub fn get(&self, name: &str) -> SiteGetCall<'a, S> {
SiteGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *violatingSite* resources.
/// It is not used directly, but through the [`AbusiveExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `list(...)`
/// // to build up your call.
/// let rb = hub.violating_sites();
/// # }
/// ```
pub struct ViolatingSiteMethods<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
}
impl<'a, S> client::MethodsBuilder for ViolatingSiteMethods<'a, S> {}
impl<'a, S> ViolatingSiteMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Lists sites that are failing in the Abusive Experience Report.
pub fn list(&self) -> ViolatingSiteListCall<'a, S> {
ViolatingSiteListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
/// Gets a site's Abusive Experience Report summary.
///
/// A builder for the *get* method supported by a *site* resource.
/// It is not used directly, but through a [`SiteMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// # async fn dox() {
/// # use std::default::Default;
/// # use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.sites().get("name")
/// .doit().await;
/// # }
/// ```
pub struct SiteGetCall<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for SiteGetCall<'a, S> {}
impl<'a, S> SiteGetCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, SiteSummaryResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "abusiveexperiencereport.sites.get",
http_method: hyper::Method::GET });
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
/// Required. The name of the site whose summary to get, e.g. `sites/http%3A%2F%2Fwww.google.com%2F`. Format: `sites/{site}`
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> SiteGetCall<'a, S> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> SiteGetCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> SiteGetCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}
/// Lists sites that are failing in the Abusive Experience Report.
///
/// A builder for the *list* method supported by a *violatingSite* resource.
/// It is not used directly, but through a [`ViolatingSiteMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
/// # async fn dox() {
/// # use std::default::Default;
/// # use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.violating_sites().list()
/// .doit().await;
/// # }
/// ```
pub struct ViolatingSiteListCall<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for ViolatingSiteListCall<'a, S> {}
impl<'a, S> ViolatingSiteListCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ViolatingSitesResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "abusiveexperiencereport.violatingSites.list",
http_method: hyper::Method::GET });
for &field in ["alt"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(2 + self._additional_params.len());
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/violatingSites";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
let url = params.parse_with_url(&url);
loop {
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.body(hyper::body::Body::empty());
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ViolatingSiteListCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ViolatingSiteListCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}

View File

@@ -0,0 +1,199 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Abusive Experience Report* crate version *5.0.4+20240207*, where *20240207* is the exact revision of the *abusiveexperiencereport:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Abusive Experience Report* *v1* API can be found at the
//! [official documentation site](https://developers.google.com/abusive-experience-report/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/abusiveexperiencereport1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AbusiveExperienceReport) ...
//!
//! * sites
//! * [*get*](api::SiteGetCall)
//! * violating sites
//! * [*list*](api::ViolatingSiteListCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AbusiveExperienceReport)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.sites().get(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-abusiveexperiencereport1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_abusiveexperiencereport1 as abusiveexperiencereport1;
//! use abusiveexperiencereport1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use abusiveexperiencereport1::{AbusiveExperienceReport, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AbusiveExperienceReport::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.sites().get("name")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AbusiveExperienceReport;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-acceleratedmobilepageurl1-cli"
version = "5.0.4+20240303"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Acceleratedmobilepageurl (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1-cli"
homepage = "https://developers.google.com/amp/cache/"
documentation = "http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli"
license = "MIT"
keywords = ["acceleratedmobilepag", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "acceleratedmobilepageurl1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-acceleratedmobilepageurl1]
path = "../acceleratedmobilepageurl1"
version = "5.0.4+20240303"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,101 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `acceleratedmobilepageurl1` command-line interface *(CLI)* allows to use most features of the *Google Acceleratedmobilepageurl* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Acceleratedmobilepageurl* API can be found at the
[official documentation site](https://developers.google.com/amp/cache/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-acceleratedmobilepageurl1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1-cli).
# Usage
This documentation was generated from the *Acceleratedmobilepageurl* API at revision *20240303*. The CLI is at version *5.0.4*.
```bash
acceleratedmobilepageurl1 [options]
amp-urls
batch-get (-r <kv>)... [-p <v>]... [-o <out>]
acceleratedmobilepageurl1 --help
Configuration:
--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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `acceleratedmobilepageurl1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/acceleratedmobilepageurl1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/acceleratedmobilepageurl1-secret.json`, assuming that the required *acceleratedmobilepageurl* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `acceleratedmobilepageurl1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,18 @@
site_name: Acceleratedmobilepageurl v5.0.4+20240303
site_url: http://byron.github.io/google-apis-rs/google-acceleratedmobilepageurl1-cli
site_description: A complete library to interact with Acceleratedmobilepageurl (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Amp Urls':
- 'Batch Get': 'amp-urls_batch-get.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

View File

@@ -0,0 +1,342 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/cli/main.rs.mako'
// DO NOT EDIT !
#![allow(unused_variables, unused_imports, dead_code, unused_mut)]
#[macro_use]
extern crate clap;
use std::env;
use std::io::{self, Write};
use clap::{App, SubCommand, Arg};
use google_acceleratedmobilepageurl1::{api, Error, oauth2, client::chrono, FieldMask};
use google_clis_common as client;
use client::{InvalidOptionsError, CLIError, 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};
use std::default::Default;
use std::error::Error as StdError;
use std::str::FromStr;
use serde_json as json;
use clap::ArgMatches;
use http::Uri;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service;
enum DoitError {
IoError(String, io::Error),
ApiError(Error),
}
struct Engine<'n, S> {
opt: ArgMatches<'n>,
hub: api::Acceleratedmobilepageurl<S>,
gp: Vec<&'static str>,
gpm: Vec<(&'static str, &'static str)>,
}
impl<'n, S> Engine<'n, S>
where
S: tower_service::Service<Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
async fn _amp_urls_batch_get(&self, opt: &ArgMatches<'n>, dry_run: bool, err: &mut InvalidOptionsError)
-> Result<(), DoitError> {
let mut field_cursor = FieldCursor::default();
let mut object = json::value::Value::Object(Default::default());
for kvarg in opt.values_of("kv").map(|i|i.collect()).unwrap_or(Vec::new()).iter() {
let last_errc = err.issues.len();
let (key, value) = parse_kv_arg(&*kvarg, err, false);
let mut temp_cursor = field_cursor.clone();
if let Err(field_err) = temp_cursor.set(&*key) {
err.issues.push(field_err);
}
if value.is_none() {
field_cursor = temp_cursor.clone();
if err.issues.len() > last_errc {
err.issues.remove(last_errc);
}
continue;
}
let type_info: Option<(&'static str, JsonTypeInfo)> =
match &temp_cursor.to_string()[..] {
"lookup-strategy" => Some(("lookupStrategy", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Pod })),
"urls" => Some(("urls", JsonTypeInfo { jtype: JsonType::String, ctype: ComplexType::Vec })),
_ => {
let suggestion = FieldCursor::did_you_mean(key, &vec!["lookup-strategy", "urls"]);
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string(), suggestion, value.map(|v| v.to_string()))));
None
}
};
if let Some((field_cursor_str, type_info)) = type_info {
FieldCursor::from(field_cursor_str).set_json_value(&mut object, value.unwrap(), type_info, err, &temp_cursor);
}
}
let mut request: api::BatchGetAmpUrlsRequest = json::value::from_value(object).unwrap();
let mut call = self.hub.amp_urls().batch_get(request);
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 {
_ => {
let mut found = false;
for param in &self.gp {
if key == *param {
found = true;
call = call.param(self.gpm.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"));
break;
}
}
if !found {
err.issues.push(CLIError::UnknownParameter(key.to_string(),
{let mut v = Vec::new();
v.extend(self.gp.iter().map(|v|*v));
v } ));
}
}
}
}
let protocol = CallType::Standard;
if dry_run {
Ok(())
} else {
assert!(err.issues.len() == 0);
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 {
CallType::Standard => call.doit().await,
_ => unreachable!()
} {
Err(api_err) => Err(DoitError::ApiError(api_err)),
Ok((mut response, output_schema)) => {
let mut value = json::value::to_value(&output_schema).expect("serde to work");
remove_json_null_values(&mut value);
json::to_writer_pretty(&mut ostream, &value).unwrap();
ostream.flush().unwrap();
Ok(())
}
}
}
}
async fn _doit(&self, dry_run: bool) -> Result<Result<(), DoitError>, Option<InvalidOptionsError>> {
let mut err = InvalidOptionsError::new();
let mut call_result: Result<(), DoitError> = Ok(());
let mut err_opt: Option<InvalidOptionsError> = None;
match self.opt.subcommand() {
("amp-urls", Some(opt)) => {
match opt.subcommand() {
("batch-get", Some(opt)) => {
call_result = self._amp_urls_batch_get(opt, dry_run, &mut err).await;
},
_ => {
err.issues.push(CLIError::MissingMethodError("amp-urls".to_string()));
writeln!(io::stderr(), "{}\n", opt.usage()).ok();
}
}
},
_ => {
err.issues.push(CLIError::MissingCommandError);
writeln!(io::stderr(), "{}\n", self.opt.usage()).ok();
}
}
if dry_run {
if err.issues.len() > 0 {
err_opt = Some(err);
}
Err(err_opt)
} else {
Ok(call_result)
}
}
// Please note that this call will fail if any part of the opt can't be handled
async fn new(opt: ArgMatches<'n>, connector: S) -> Result<Engine<'n, S>, InvalidOptionsError> {
let (config_dir, secret) = {
let config_dir = match client::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 client::application_secret_from_directory(&config_dir, "acceleratedmobilepageurl1-secret.json",
"{\"installed\":{\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"client_secret\":\"hCsslbCUyfehWMmbkG8vTYxG\",\"token_uri\":\"https://accounts.google.com/o/oauth2/token\",\"client_email\":\"\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"oob\"],\"client_x509_cert_url\":\"\",\"client_id\":\"620010449518-9ngf7o4dhs0dka470npqvor6dc5lqb9b.apps.googleusercontent.com\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\"}}") {
Ok(secret) => (config_dir, secret),
Err(e) => return Err(InvalidOptionsError::single(e, 4))
}
};
let client = hyper::Client::builder().build(connector);
let auth = oauth2::InstalledFlowAuthenticator::with_client(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
client.clone(),
).persist_tokens_to_disk(format!("{}/acceleratedmobilepageurl1", config_dir)).build().await.unwrap();
let engine = Engine {
opt: opt,
hub: api::Acceleratedmobilepageurl::new(client, auth),
gp: vec!["$-xgafv", "access-token", "alt", "callback", "fields", "key", "oauth-token", "pretty-print", "quota-user", "upload-type", "upload-protocol"],
gpm: vec![
("$-xgafv", "$.xgafv"),
("access-token", "access_token"),
("oauth-token", "oauth_token"),
("pretty-print", "prettyPrint"),
("quota-user", "quotaUser"),
("upload-type", "uploadType"),
("upload-protocol", "upload_protocol"),
]
};
match engine._doit(true).await {
Err(Some(err)) => Err(err),
Err(None) => Ok(engine),
Ok(_) => unreachable!(),
}
}
async fn doit(&self) -> Result<(), DoitError> {
match self._doit(false).await {
Ok(res) => res,
Err(_) => unreachable!(),
}
}
}
#[tokio::main]
async fn main() {
let mut exit_status = 0i32;
let arg_data = [
("amp-urls", "methods: 'batch-get'", vec![
("batch-get",
Some(r##"Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format)."##),
"Details at http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli/amp-urls_batch-get",
vec![
(Some(r##"kv"##),
Some(r##"r"##),
Some(r##"Set various fields of the request structure, matching the key=value form"##),
Some(true),
Some(true)),
(Some(r##"v"##),
Some(r##"p"##),
Some(r##"Set various optional parameters, matching the key=value form"##),
Some(false),
Some(true)),
(Some(r##"out"##),
Some(r##"o"##),
Some(r##"Specify the file into which to write the program's output"##),
Some(false),
Some(false)),
]),
]),
];
let mut app = App::new("acceleratedmobilepageurl1")
.author("Sebastian Thiel <byronimo@gmail.com>")
.version("5.0.4+20240303")
.about("Retrieves the list of AMP URLs (and equivalent AMP Cache URLs) for a given list of public URL(s). ")
.after_help("All documentation details can be found at http://byron.github.io/google-apis-rs/google_acceleratedmobilepageurl1_cli")
.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("Debug print all errors")
.multiple(false)
.takes_value(false));
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 {
let mut scmd = SubCommand::with_name(sub_command_name);
if let &Some(desc) = desc {
scmd = scmd.about(desc);
}
scmd = scmd.after_help(url_info);
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)
.empty_values(false);
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);
}
scmd = scmd.arg(arg);
}
mcmd = mcmd.subcommand(scmd);
}
app = app.subcommand(mcmd);
}
let matches = app.get_matches();
let debug = matches.is_present("adebug");
let connector = hyper_rustls::HttpsConnectorBuilder::new().with_native_roots()
.https_or_http()
.enable_http1()
.build();
match Engine::new(matches, connector).await {
Err(err) => {
exit_status = err.exit_code;
writeln!(io::stderr(), "{}", err).ok();
},
Ok(engine) => {
if let Err(doit_err) = engine.doit().await {
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();
}
}
}
}
}
}
std::process::exit(exit_status);
}

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-acceleratedmobilepageurl1"
version = "5.0.4+20240303"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Acceleratedmobilepageurl (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1"
homepage = "https://developers.google.com/amp/cache/"
documentation = "https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303"
license = "MIT"
keywords = ["acceleratedmobilepag", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,183 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-acceleratedmobilepageurl1` library allows access to all features of the *Google Acceleratedmobilepageurl* service.
This documentation was generated from *Acceleratedmobilepageurl* crate version *5.0.4+20240303*, where *20240303* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Acceleratedmobilepageurl* *v1* API can be found at the
[official documentation site](https://developers.google.com/amp/cache/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/Acceleratedmobilepageurl) ...
* [amp urls](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/api::AmpUrl)
* [*batch get*](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/api::AmpUrlBatchGetCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/Acceleratedmobilepageurl)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder)
* **[Resources](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.amp_urls().batch_get(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-acceleratedmobilepageurl1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
use acceleratedmobilepageurl1::{Result, Error};
use std::default::Default;
use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = BatchGetAmpUrlsRequest::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.amp_urls().batch_get(req)
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Delegate) to the
[Method Builder](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::RequestValue) and
[decodable](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-acceleratedmobilepageurl1/5.0.4+20240303/google_acceleratedmobilepageurl1/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **acceleratedmobilepageurl1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

View File

@@ -0,0 +1,539 @@
use std::collections::HashMap;
use std::cell::RefCell;
use std::default::Default;
use std::collections::BTreeSet;
use std::error::Error as StdError;
use serde_json as json;
use std::io;
use std::fs;
use std::mem;
use hyper::client::connect;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::time::sleep;
use tower_service;
use serde::{Serialize, Deserialize};
use crate::{client, client::GetToken, client::serde_with};
// ##############
// UTILITIES ###
// ############
// ########
// HUB ###
// ######
/// Central instance to access all Acceleratedmobilepageurl related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
/// use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
/// use acceleratedmobilepageurl1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // 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
/// // retrieve them from storage.
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = BatchGetAmpUrlsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.amp_urls().batch_get(req)
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct Acceleratedmobilepageurl<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<'a, S> client::Hub for Acceleratedmobilepageurl<S> {}
impl<'a, S> Acceleratedmobilepageurl<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Acceleratedmobilepageurl<S> {
Acceleratedmobilepageurl {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.4".to_string(),
_base_url: "https://acceleratedmobilepageurl.googleapis.com/".to_string(),
_root_url: "https://acceleratedmobilepageurl.googleapis.com/".to_string(),
}
}
pub fn amp_urls(&'a self) -> AmpUrlMethods<'a, S> {
AmpUrlMethods { hub: &self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/5.0.4`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://acceleratedmobilepageurl.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://acceleratedmobilepageurl.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// AMP URL response for a requested URL.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AmpUrl {
/// The AMP URL pointing to the publisher's web server.
#[serde(rename="ampUrl")]
pub amp_url: Option<String>,
/// The [AMP Cache URL](https://developers.google.com/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache.
#[serde(rename="cdnAmpUrl")]
pub cdn_amp_url: Option<String>,
/// The original non-AMP URL.
#[serde(rename="originalUrl")]
pub original_url: Option<String>,
}
impl client::Resource for AmpUrl {}
/// AMP URL Error resource for a requested URL that couldn't be found.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AmpUrlError {
/// The error code of an API call.
#[serde(rename="errorCode")]
pub error_code: Option<String>,
/// An optional descriptive error message.
#[serde(rename="errorMessage")]
pub error_message: Option<String>,
/// The original non-AMP URL.
#[serde(rename="originalUrl")]
pub original_url: Option<String>,
}
impl client::Part for AmpUrlError {}
/// AMP URL request for a batch of URLs.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchGetAmpUrlsRequest {
/// The lookup_strategy being requested.
#[serde(rename="lookupStrategy")]
pub lookup_strategy: Option<String>,
/// List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](https://developers.google.com/amp/cache/reference/limits)).
pub urls: Option<Vec<String>>,
}
impl client::RequestValue for BatchGetAmpUrlsRequest {}
/// Batch AMP URL response.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [batch get amp urls](AmpUrlBatchGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchGetAmpUrlsResponse {
/// For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only once.
#[serde(rename="ampUrls")]
pub amp_urls: Option<Vec<AmpUrl>>,
/// The errors for requested URLs that have no AMP URL.
#[serde(rename="urlErrors")]
pub url_errors: Option<Vec<AmpUrlError>>,
}
impl client::ResponseResult for BatchGetAmpUrlsResponse {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *ampUrl* resources.
/// It is not used directly, but through the [`Acceleratedmobilepageurl`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// let secret: oauth2::ApplicationSecret = Default::default();
/// let auth = oauth2::InstalledFlowAuthenticator::builder(
/// secret,
/// oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// ).build().await.unwrap();
/// let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `batch_get(...)`
/// // to build up your call.
/// let rb = hub.amp_urls();
/// # }
/// ```
pub struct AmpUrlMethods<'a, S>
where S: 'a {
hub: &'a Acceleratedmobilepageurl<S>,
}
impl<'a, S> client::MethodsBuilder for AmpUrlMethods<'a, S> {}
impl<'a, S> AmpUrlMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn batch_get(&self, request: BatchGetAmpUrlsRequest) -> AmpUrlBatchGetCall<'a, S> {
AmpUrlBatchGetCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
/// Returns AMP URL(s) and equivalent [AMP Cache URL(s)](https://developers.google.com/amp/cache/overview#amp-cache-url-format).
///
/// A builder for the *batchGet* method supported by a *ampUrl* resource.
/// It is not used directly, but through a [`AmpUrlMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
/// use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
/// # async fn dox() {
/// # use std::default::Default;
/// # use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
///
/// # let secret: oauth2::ApplicationSecret = Default::default();
/// # let auth = oauth2::InstalledFlowAuthenticator::builder(
/// # secret,
/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # ).build().await.unwrap();
/// # let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = BatchGetAmpUrlsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.amp_urls().batch_get(req)
/// .doit().await;
/// # }
/// ```
pub struct AmpUrlBatchGetCall<'a, S>
where S: 'a {
hub: &'a Acceleratedmobilepageurl<S>,
_request: BatchGetAmpUrlsRequest,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for AmpUrlBatchGetCall<'a, S> {}
impl<'a, S> AmpUrlBatchGetCall<'a, S>
where
S: tower_service::Service<http::Uri> + Clone + Send + Sync + 'static,
S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, BatchGetAmpUrlsResponse)> {
use std::io::{Read, Seek};
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
use client::{ToParts, url::Params};
use std::borrow::Cow;
let mut dd = client::DefaultDelegate;
let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(client::MethodInfo { id: "acceleratedmobilepageurl.ampUrls.batchGet",
http_method: hyper::Method::POST });
for &field in ["alt"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(client::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/ampUrls:batchGet";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(client::Error::MissingAPIKey)
}
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader =
{
let mut value = json::value::to_value(&self._request).expect("serde to work");
client::remove_json_null_values(&mut value);
let mut dst = io::Cursor::new(Vec::with_capacity(128));
json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
loop {
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let client::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(client::Error::HttpError(err))
}
Ok(mut res) => {
if !res.status().is_success() {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
let (parts, _) = res.into_parts();
let body = hyper::Body::from(res_body_string.clone());
let restored_response = hyper::Response::from_parts(parts, body);
let server_response = json::from_str::<serde_json::Value>(&res_body_string).ok();
if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) {
sleep(d).await;
continue;
}
dlg.finished(false);
return match server_response {
Some(error_value) => Err(client::Error::BadRequest(error_value)),
None => Err(client::Error::Failure(restored_response)),
}
}
let result_value = {
let res_body_string = client::get_body_as_string(res.body_mut()).await;
match json::from_str(&res_body_string) {
Ok(decoded) => (res, decoded),
Err(err) => {
dlg.response_json_decode_error(&res_body_string, &err);
return Err(client::Error::JsonDecodeError(res_body_string, err));
}
}
};
dlg.finished(true);
return Ok(result_value)
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(mut self, new_value: BatchGetAmpUrlsRequest) -> AmpUrlBatchGetCall<'a, S> {
self._request = new_value;
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> AmpUrlBatchGetCall<'a, S> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> AmpUrlBatchGetCall<'a, S>
where T: AsRef<str> {
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}

View File

@@ -0,0 +1,203 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Acceleratedmobilepageurl* crate version *5.0.4+20240303*, where *20240303* is the exact revision of the *acceleratedmobilepageurl:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Acceleratedmobilepageurl* *v1* API can be found at the
//! [official documentation site](https://developers.google.com/amp/cache/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/acceleratedmobilepageurl1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](Acceleratedmobilepageurl) ...
//!
//! * [amp urls](api::AmpUrl)
//! * [*batch get*](api::AmpUrlBatchGetCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](Acceleratedmobilepageurl)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.amp_urls().batch_get(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-acceleratedmobilepageurl1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_acceleratedmobilepageurl1 as acceleratedmobilepageurl1;
//! use acceleratedmobilepageurl1::api::BatchGetAmpUrlsRequest;
//! use acceleratedmobilepageurl1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use acceleratedmobilepageurl1::{Acceleratedmobilepageurl, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = Acceleratedmobilepageurl::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = BatchGetAmpUrlsRequest::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.amp_urls().batch_get(req)
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::Acceleratedmobilepageurl;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1-cli"
version = "5.0.4+20240223"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1-cli"
homepage = "https://cloud.google.com/assured-workloads/access-approval/docs"
documentation = "http://byron.github.io/google-apis-rs/google_accessapproval1_cli"
license = "MIT"
keywords = ["accessapproval", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accessapproval1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accessapproval1]
path = "../accessapproval1"
version = "5.0.4+20240223"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,133 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accessapproval1` command-line interface *(CLI)* allows to use most features of the *Google Access Approval* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Approval* API can be found at the
[official documentation site](https://cloud.google.com/assured-workloads/access-approval/docs).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accessapproval1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1-cli).
# Usage
This documentation was generated from the *Access Approval* API at revision *20240223*. The CLI is at version *5.0.4*.
```bash
accessapproval1 [options]
folders
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-invalidate <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
get-service-account <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
organizations
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-invalidate <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
get-service-account <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
projects
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-invalidate <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
get-service-account <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
accessapproval1 --help
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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accessapproval1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accessapproval1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accessapproval1-secret.json`, assuming that the required *accessapproval* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accessapproval1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,46 @@
site_name: Access Approval v5.0.4+20240223
site_url: http://byron.github.io/google-apis-rs/google-accessapproval1-cli
site_description: A complete library to interact with Access Approval (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Folders':
- 'Approval Requests Approve': 'folders_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'folders_approval-requests-dismiss.md'
- 'Approval Requests Get': 'folders_approval-requests-get.md'
- 'Approval Requests Invalidate': 'folders_approval-requests-invalidate.md'
- 'Approval Requests List': 'folders_approval-requests-list.md'
- 'Delete Access Approval Settings': 'folders_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'folders_get-access-approval-settings.md'
- 'Get Service Account': 'folders_get-service-account.md'
- 'Update Access Approval Settings': 'folders_update-access-approval-settings.md'
- 'Organizations':
- 'Approval Requests Approve': 'organizations_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'organizations_approval-requests-dismiss.md'
- 'Approval Requests Get': 'organizations_approval-requests-get.md'
- 'Approval Requests Invalidate': 'organizations_approval-requests-invalidate.md'
- 'Approval Requests List': 'organizations_approval-requests-list.md'
- 'Delete Access Approval Settings': 'organizations_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'organizations_get-access-approval-settings.md'
- 'Get Service Account': 'organizations_get-service-account.md'
- 'Update Access Approval Settings': 'organizations_update-access-approval-settings.md'
- 'Projects':
- 'Approval Requests Approve': 'projects_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'projects_approval-requests-dismiss.md'
- 'Approval Requests Get': 'projects_approval-requests-get.md'
- 'Approval Requests Invalidate': 'projects_approval-requests-invalidate.md'
- 'Approval Requests List': 'projects_approval-requests-list.md'
- 'Delete Access Approval Settings': 'projects_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'projects_get-access-approval-settings.md'
- 'Get Service Account': 'projects_get-service-account.md'
- 'Update Access Approval Settings': 'projects_update-access-approval-settings.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1"
version = "5.0.4+20240223"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1"
homepage = "https://cloud.google.com/assured-workloads/access-approval/docs"
documentation = "https://docs.rs/google-accessapproval1/5.0.4+20240223"
license = "MIT"
keywords = ["accessapproval", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,198 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accessapproval1` library allows access to all features of the *Google Access Approval* service.
This documentation was generated from *Access Approval* crate version *5.0.4+20240223*, where *20240223* is the exact revision of the *accessapproval:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Approval* *v1* API can be found at the
[official documentation site](https://cloud.google.com/assured-workloads/access-approval/docs).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/AccessApproval) ...
* folders
* [*approval requests approve*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestGetCall), [*approval requests invalidate*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestInvalidateCall), [*approval requests list*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderGetAccessApprovalSettingCall), [*get service account*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderGetServiceAccountCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::FolderUpdateAccessApprovalSettingCall)
* organizations
* [*approval requests approve*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestGetCall), [*approval requests invalidate*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestInvalidateCall), [*approval requests list*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationGetAccessApprovalSettingCall), [*get service account*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationGetServiceAccountCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::OrganizationUpdateAccessApprovalSettingCall)
* projects
* [*approval requests approve*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestGetCall), [*approval requests invalidate*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestInvalidateCall), [*approval requests list*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectGetAccessApprovalSettingCall), [*get service account*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectGetServiceAccountCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/api::ProjectUpdateAccessApprovalSettingCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/AccessApproval)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder)
* **[Resources](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.folders().approval_requests_approve(...).doit().await
let r = hub.folders().approval_requests_dismiss(...).doit().await
let r = hub.folders().approval_requests_get(...).doit().await
let r = hub.folders().approval_requests_invalidate(...).doit().await
let r = hub.organizations().approval_requests_approve(...).doit().await
let r = hub.organizations().approval_requests_dismiss(...).doit().await
let r = hub.organizations().approval_requests_get(...).doit().await
let r = hub.organizations().approval_requests_invalidate(...).doit().await
let r = hub.projects().approval_requests_approve(...).doit().await
let r = hub.projects().approval_requests_dismiss(...).doit().await
let r = hub.projects().approval_requests_get(...).doit().await
let r = hub.projects().approval_requests_invalidate(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accessapproval1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accessapproval1 as accessapproval1;
use accessapproval1::api::ApproveApprovalRequestMessage;
use accessapproval1::{Result, Error};
use std::default::Default;
use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = ApproveApprovalRequestMessage::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.folders().approval_requests_approve(req, "name")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Delegate) to the
[Method Builder](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::RequestValue) and
[decodable](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accessapproval1/5.0.4+20240223/google_accessapproval1/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accessapproval1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,218 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Approval* crate version *5.0.4+20240223*, where *20240223* is the exact revision of the *accessapproval:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Approval* *v1* API can be found at the
//! [official documentation site](https://cloud.google.com/assured-workloads/access-approval/docs).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessApproval) ...
//!
//! * folders
//! * [*approval requests approve*](api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](api::FolderApprovalRequestDismisCall), [*approval requests get*](api::FolderApprovalRequestGetCall), [*approval requests invalidate*](api::FolderApprovalRequestInvalidateCall), [*approval requests list*](api::FolderApprovalRequestListCall), [*delete access approval settings*](api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](api::FolderGetAccessApprovalSettingCall), [*get service account*](api::FolderGetServiceAccountCall) and [*update access approval settings*](api::FolderUpdateAccessApprovalSettingCall)
//! * organizations
//! * [*approval requests approve*](api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](api::OrganizationApprovalRequestDismisCall), [*approval requests get*](api::OrganizationApprovalRequestGetCall), [*approval requests invalidate*](api::OrganizationApprovalRequestInvalidateCall), [*approval requests list*](api::OrganizationApprovalRequestListCall), [*delete access approval settings*](api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](api::OrganizationGetAccessApprovalSettingCall), [*get service account*](api::OrganizationGetServiceAccountCall) and [*update access approval settings*](api::OrganizationUpdateAccessApprovalSettingCall)
//! * projects
//! * [*approval requests approve*](api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](api::ProjectApprovalRequestDismisCall), [*approval requests get*](api::ProjectApprovalRequestGetCall), [*approval requests invalidate*](api::ProjectApprovalRequestInvalidateCall), [*approval requests list*](api::ProjectApprovalRequestListCall), [*delete access approval settings*](api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](api::ProjectGetAccessApprovalSettingCall), [*get service account*](api::ProjectGetServiceAccountCall) and [*update access approval settings*](api::ProjectUpdateAccessApprovalSettingCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessApproval)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.folders().approval_requests_approve(...).doit().await
//! let r = hub.folders().approval_requests_dismiss(...).doit().await
//! let r = hub.folders().approval_requests_get(...).doit().await
//! let r = hub.folders().approval_requests_invalidate(...).doit().await
//! let r = hub.organizations().approval_requests_approve(...).doit().await
//! let r = hub.organizations().approval_requests_dismiss(...).doit().await
//! let r = hub.organizations().approval_requests_get(...).doit().await
//! let r = hub.organizations().approval_requests_invalidate(...).doit().await
//! let r = hub.projects().approval_requests_approve(...).doit().await
//! let r = hub.projects().approval_requests_dismiss(...).doit().await
//! let r = hub.projects().approval_requests_get(...).doit().await
//! let r = hub.projects().approval_requests_invalidate(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accessapproval1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accessapproval1 as accessapproval1;
//! use accessapproval1::api::ApproveApprovalRequestMessage;
//! use accessapproval1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accessapproval1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = ApproveApprovalRequestMessage::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.folders().approval_requests_approve(req, "name")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessApproval;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1_beta1-cli"
version = "5.0.4+20200708"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1-cli"
homepage = "https://cloud.google.com/access-approval/docs"
documentation = "http://byron.github.io/google-apis-rs/google_accessapproval1_beta1_cli"
license = "MIT"
keywords = ["accessapproval", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accessapproval1-beta1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accessapproval1_beta1]
path = "../accessapproval1_beta1"
version = "5.0.4+20200708"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,127 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accessapproval1-beta1` command-line interface *(CLI)* allows to use most features of the *Google Access Approval* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Approval* API can be found at the
[official documentation site](https://cloud.google.com/access-approval/docs).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accessapproval1_beta1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1-cli).
# Usage
This documentation was generated from the *Access Approval* API at revision *20200708*. The CLI is at version *5.0.4*.
```bash
accessapproval1-beta1 [options]
folders
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
organizations
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
projects
approval-requests-approve <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-dismiss <name> (-r <kv>)... [-p <v>]... [-o <out>]
approval-requests-get <name> [-p <v>]... [-o <out>]
approval-requests-list <parent> [-p <v>]... [-o <out>]
delete-access-approval-settings <name> [-p <v>]... [-o <out>]
get-access-approval-settings <name> [-p <v>]... [-o <out>]
update-access-approval-settings <name> (-r <kv>)... [-p <v>]... [-o <out>]
accessapproval1-beta1 --help
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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accessapproval1-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accessapproval1-beta1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accessapproval1-beta1-secret.json`, assuming that the required *accessapproval* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accessapproval1-beta1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,40 @@
site_name: Access Approval v5.0.4+20200708
site_url: http://byron.github.io/google-apis-rs/google-accessapproval1_beta1-cli
site_description: A complete library to interact with Access Approval (protocol v1beta1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Folders':
- 'Approval Requests Approve': 'folders_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'folders_approval-requests-dismiss.md'
- 'Approval Requests Get': 'folders_approval-requests-get.md'
- 'Approval Requests List': 'folders_approval-requests-list.md'
- 'Delete Access Approval Settings': 'folders_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'folders_get-access-approval-settings.md'
- 'Update Access Approval Settings': 'folders_update-access-approval-settings.md'
- 'Organizations':
- 'Approval Requests Approve': 'organizations_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'organizations_approval-requests-dismiss.md'
- 'Approval Requests Get': 'organizations_approval-requests-get.md'
- 'Approval Requests List': 'organizations_approval-requests-list.md'
- 'Delete Access Approval Settings': 'organizations_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'organizations_get-access-approval-settings.md'
- 'Update Access Approval Settings': 'organizations_update-access-approval-settings.md'
- 'Projects':
- 'Approval Requests Approve': 'projects_approval-requests-approve.md'
- 'Approval Requests Dismiss': 'projects_approval-requests-dismiss.md'
- 'Approval Requests Get': 'projects_approval-requests-get.md'
- 'Approval Requests List': 'projects_approval-requests-list.md'
- 'Delete Access Approval Settings': 'projects_delete-access-approval-settings.md'
- 'Get Access Approval Settings': 'projects_get-access-approval-settings.md'
- 'Update Access Approval Settings': 'projects_update-access-approval-settings.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accessapproval1_beta1"
version = "5.0.4+20200708"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Approval (protocol v1beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1"
homepage = "https://cloud.google.com/access-approval/docs"
documentation = "https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708"
license = "MIT"
keywords = ["accessapproval", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,195 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accessapproval1_beta1` library allows access to all features of the *Google Access Approval* service.
This documentation was generated from *Access Approval* crate version *5.0.4+20200708*, where *20200708* is the exact revision of the *accessapproval:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Approval* *v1_beta1* API can be found at the
[official documentation site](https://cloud.google.com/access-approval/docs).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/AccessApproval) ...
* folders
* [*approval requests approve*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestGetCall), [*approval requests list*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderGetAccessApprovalSettingCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::FolderUpdateAccessApprovalSettingCall)
* organizations
* [*approval requests approve*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestGetCall), [*approval requests list*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationGetAccessApprovalSettingCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::OrganizationUpdateAccessApprovalSettingCall)
* projects
* [*approval requests approve*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestDismisCall), [*approval requests get*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestGetCall), [*approval requests list*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectApprovalRequestListCall), [*delete access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectGetAccessApprovalSettingCall) and [*update access approval settings*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/api::ProjectUpdateAccessApprovalSettingCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/AccessApproval)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder)
* **[Resources](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.folders().approval_requests_approve(...).doit().await
let r = hub.folders().approval_requests_dismiss(...).doit().await
let r = hub.folders().approval_requests_get(...).doit().await
let r = hub.organizations().approval_requests_approve(...).doit().await
let r = hub.organizations().approval_requests_dismiss(...).doit().await
let r = hub.organizations().approval_requests_get(...).doit().await
let r = hub.projects().approval_requests_approve(...).doit().await
let r = hub.projects().approval_requests_dismiss(...).doit().await
let r = hub.projects().approval_requests_get(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accessapproval1_beta1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
use accessapproval1_beta1::api::ApproveApprovalRequestMessage;
use accessapproval1_beta1::{Result, Error};
use std::default::Default;
use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = ApproveApprovalRequestMessage::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.folders().approval_requests_approve(req, "name")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Delegate) to the
[Method Builder](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::RequestValue) and
[decodable](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accessapproval1_beta1/5.0.4+20200708/google_accessapproval1_beta1/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accessapproval1_beta1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,215 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Approval* crate version *5.0.4+20200708*, where *20200708* is the exact revision of the *accessapproval:v1beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Approval* *v1_beta1* API can be found at the
//! [official documentation site](https://cloud.google.com/access-approval/docs).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accessapproval1_beta1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessApproval) ...
//!
//! * folders
//! * [*approval requests approve*](api::FolderApprovalRequestApproveCall), [*approval requests dismiss*](api::FolderApprovalRequestDismisCall), [*approval requests get*](api::FolderApprovalRequestGetCall), [*approval requests list*](api::FolderApprovalRequestListCall), [*delete access approval settings*](api::FolderDeleteAccessApprovalSettingCall), [*get access approval settings*](api::FolderGetAccessApprovalSettingCall) and [*update access approval settings*](api::FolderUpdateAccessApprovalSettingCall)
//! * organizations
//! * [*approval requests approve*](api::OrganizationApprovalRequestApproveCall), [*approval requests dismiss*](api::OrganizationApprovalRequestDismisCall), [*approval requests get*](api::OrganizationApprovalRequestGetCall), [*approval requests list*](api::OrganizationApprovalRequestListCall), [*delete access approval settings*](api::OrganizationDeleteAccessApprovalSettingCall), [*get access approval settings*](api::OrganizationGetAccessApprovalSettingCall) and [*update access approval settings*](api::OrganizationUpdateAccessApprovalSettingCall)
//! * projects
//! * [*approval requests approve*](api::ProjectApprovalRequestApproveCall), [*approval requests dismiss*](api::ProjectApprovalRequestDismisCall), [*approval requests get*](api::ProjectApprovalRequestGetCall), [*approval requests list*](api::ProjectApprovalRequestListCall), [*delete access approval settings*](api::ProjectDeleteAccessApprovalSettingCall), [*get access approval settings*](api::ProjectGetAccessApprovalSettingCall) and [*update access approval settings*](api::ProjectUpdateAccessApprovalSettingCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessApproval)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.folders().approval_requests_approve(...).doit().await
//! let r = hub.folders().approval_requests_dismiss(...).doit().await
//! let r = hub.folders().approval_requests_get(...).doit().await
//! let r = hub.organizations().approval_requests_approve(...).doit().await
//! let r = hub.organizations().approval_requests_dismiss(...).doit().await
//! let r = hub.organizations().approval_requests_get(...).doit().await
//! let r = hub.projects().approval_requests_approve(...).doit().await
//! let r = hub.projects().approval_requests_dismiss(...).doit().await
//! let r = hub.projects().approval_requests_get(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accessapproval1_beta1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
//! use accessapproval1_beta1::api::ApproveApprovalRequestMessage;
//! use accessapproval1_beta1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accessapproval1_beta1::{AccessApproval, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessApproval::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = ApproveApprovalRequestMessage::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.folders().approval_requests_approve(req, "name")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessApproval;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1-cli"
version = "5.0.4+20240226"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1-cli"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "http://byron.github.io/google-apis-rs/google_accesscontextmanager1_cli"
license = "MIT"
keywords = ["accesscontextmanager", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accesscontextmanager1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accesscontextmanager1]
path = "../accesscontextmanager1"
version = "5.0.4+20240226"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,146 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accesscontextmanager1` command-line interface *(CLI)* allows to use most features of the *Google Access Context Manager* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Context Manager* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accesscontextmanager1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1-cli).
# Usage
This documentation was generated from the *Access Context Manager* API at revision *20240226*. The CLI is at version *5.0.4*.
```bash
accesscontextmanager1 [options]
access-policies
access-levels-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-delete <name> [-p <v>]... [-o <out>]
access-levels-get <name> [-p <v>]... [-o <out>]
access-levels-list <parent> [-p <v>]... [-o <out>]
access-levels-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-replace-all <parent> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-test-iam-permissions <resource> (-r <kv>)... [-p <v>]... [-o <out>]
authorized-orgs-descs-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
authorized-orgs-descs-delete <name> [-p <v>]... [-o <out>]
authorized-orgs-descs-get <name> [-p <v>]... [-o <out>]
authorized-orgs-descs-list <parent> [-p <v>]... [-o <out>]
authorized-orgs-descs-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
create (-r <kv>)... [-p <v>]... [-o <out>]
delete <name> [-p <v>]... [-o <out>]
get <name> [-p <v>]... [-o <out>]
get-iam-policy <resource> (-r <kv>)... [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-commit <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-delete <name> [-p <v>]... [-o <out>]
service-perimeters-get <name> [-p <v>]... [-o <out>]
service-perimeters-list <parent> [-p <v>]... [-o <out>]
service-perimeters-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-replace-all <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-test-iam-permissions <resource> (-r <kv>)... [-p <v>]... [-o <out>]
set-iam-policy <resource> (-r <kv>)... [-p <v>]... [-o <out>]
test-iam-permissions <resource> (-r <kv>)... [-p <v>]... [-o <out>]
operations
cancel <name> (-r <kv>)... [-p <v>]... [-o <out>]
delete <name> [-p <v>]... [-o <out>]
get <name> [-p <v>]... [-o <out>]
list <name> [-p <v>]... [-o <out>]
organizations
gcp-user-access-bindings-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
gcp-user-access-bindings-delete <name> [-p <v>]... [-o <out>]
gcp-user-access-bindings-get <name> [-p <v>]... [-o <out>]
gcp-user-access-bindings-list <parent> [-p <v>]... [-o <out>]
gcp-user-access-bindings-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
services
get <name> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
accesscontextmanager1 --help
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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accesscontextmanager1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accesscontextmanager1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accesscontextmanager1-secret.json`, assuming that the required *accesscontextmanager* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accesscontextmanager1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,59 @@
site_name: Access Context Manager v5.0.4+20240226
site_url: http://byron.github.io/google-apis-rs/google-accesscontextmanager1-cli
site_description: A complete library to interact with Access Context Manager (protocol v1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Access Policies':
- 'Access Levels Create': 'access-policies_access-levels-create.md'
- 'Access Levels Delete': 'access-policies_access-levels-delete.md'
- 'Access Levels Get': 'access-policies_access-levels-get.md'
- 'Access Levels List': 'access-policies_access-levels-list.md'
- 'Access Levels Patch': 'access-policies_access-levels-patch.md'
- 'Access Levels Replace All': 'access-policies_access-levels-replace-all.md'
- 'Access Levels Test Iam Permissions': 'access-policies_access-levels-test-iam-permissions.md'
- 'Authorized Orgs Descs Create': 'access-policies_authorized-orgs-descs-create.md'
- 'Authorized Orgs Descs Delete': 'access-policies_authorized-orgs-descs-delete.md'
- 'Authorized Orgs Descs Get': 'access-policies_authorized-orgs-descs-get.md'
- 'Authorized Orgs Descs List': 'access-policies_authorized-orgs-descs-list.md'
- 'Authorized Orgs Descs Patch': 'access-policies_authorized-orgs-descs-patch.md'
- 'Create': 'access-policies_create.md'
- 'Delete': 'access-policies_delete.md'
- 'Get': 'access-policies_get.md'
- 'Get Iam Policy': 'access-policies_get-iam-policy.md'
- 'List': 'access-policies_list.md'
- 'Patch': 'access-policies_patch.md'
- 'Service Perimeters Commit': 'access-policies_service-perimeters-commit.md'
- 'Service Perimeters Create': 'access-policies_service-perimeters-create.md'
- 'Service Perimeters Delete': 'access-policies_service-perimeters-delete.md'
- 'Service Perimeters Get': 'access-policies_service-perimeters-get.md'
- 'Service Perimeters List': 'access-policies_service-perimeters-list.md'
- 'Service Perimeters Patch': 'access-policies_service-perimeters-patch.md'
- 'Service Perimeters Replace All': 'access-policies_service-perimeters-replace-all.md'
- 'Service Perimeters Test Iam Permissions': 'access-policies_service-perimeters-test-iam-permissions.md'
- 'Set Iam Policy': 'access-policies_set-iam-policy.md'
- 'Test Iam Permissions': 'access-policies_test-iam-permissions.md'
- 'Operations':
- 'Cancel': 'operations_cancel.md'
- 'Delete': 'operations_delete.md'
- 'Get': 'operations_get.md'
- 'List': 'operations_list.md'
- 'Organizations':
- 'Gcp User Access Bindings Create': 'organizations_gcp-user-access-bindings-create.md'
- 'Gcp User Access Bindings Delete': 'organizations_gcp-user-access-bindings-delete.md'
- 'Gcp User Access Bindings Get': 'organizations_gcp-user-access-bindings-get.md'
- 'Gcp User Access Bindings List': 'organizations_gcp-user-access-bindings-list.md'
- 'Gcp User Access Bindings Patch': 'organizations_gcp-user-access-bindings-patch.md'
- 'Services':
- 'Get': 'services_get.md'
- 'List': 'services_list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1"
version = "5.0.4+20240226"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "https://docs.rs/google-accesscontextmanager1/5.0.4+20240226"
license = "MIT"
keywords = ["accesscontextmanager", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,207 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accesscontextmanager1` library allows access to all features of the *Google Access Context Manager* service.
This documentation was generated from *Access Context Manager* crate version *5.0.4+20240226*, where *20240226* is the exact revision of the *accesscontextmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Context Manager* *v1* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/AccessContextManager) ...
* [access policies](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicy)
* [*access levels create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelGetCall), [*access levels list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelListCall), [*access levels patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelPatchCall), [*access levels replace all*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelReplaceAllCall), [*access levels test iam permissions*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAccessLevelTestIamPermissionCall), [*authorized orgs descs create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescCreateCall), [*authorized orgs descs delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescDeleteCall), [*authorized orgs descs get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescGetCall), [*authorized orgs descs list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescListCall), [*authorized orgs descs patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyAuthorizedOrgsDescPatchCall), [*create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyCreateCall), [*delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyDeleteCall), [*get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyGetCall), [*get iam policy*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyGetIamPolicyCall), [*list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyListCall), [*patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyPatchCall), [*service perimeters commit*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterCommitCall), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterListCall), [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterPatchCall), [*service perimeters replace all*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterReplaceAllCall), [*service perimeters test iam permissions*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyServicePerimeterTestIamPermissionCall), [*set iam policy*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicySetIamPolicyCall) and [*test iam permissions*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::AccessPolicyTestIamPermissionCall)
* [operations](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::Operation)
* [*cancel*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationCancelCall), [*delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationDeleteCall), [*get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationGetCall) and [*list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OperationListCall)
* organizations
* [*gcp user access bindings create*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingCreateCall), [*gcp user access bindings delete*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingDeleteCall), [*gcp user access bindings get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingGetCall), [*gcp user access bindings list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingListCall) and [*gcp user access bindings patch*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::OrganizationGcpUserAccessBindingPatchCall)
* services
* [*get*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::ServiceGetCall) and [*list*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/api::ServiceListCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/AccessContextManager)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder)
* **[Resources](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.access_policies().access_levels_create(...).doit().await
let r = hub.access_policies().access_levels_delete(...).doit().await
let r = hub.access_policies().access_levels_patch(...).doit().await
let r = hub.access_policies().access_levels_replace_all(...).doit().await
let r = hub.access_policies().authorized_orgs_descs_create(...).doit().await
let r = hub.access_policies().authorized_orgs_descs_delete(...).doit().await
let r = hub.access_policies().authorized_orgs_descs_patch(...).doit().await
let r = hub.access_policies().service_perimeters_commit(...).doit().await
let r = hub.access_policies().service_perimeters_create(...).doit().await
let r = hub.access_policies().service_perimeters_delete(...).doit().await
let r = hub.access_policies().service_perimeters_patch(...).doit().await
let r = hub.access_policies().service_perimeters_replace_all(...).doit().await
let r = hub.access_policies().create(...).doit().await
let r = hub.access_policies().delete(...).doit().await
let r = hub.access_policies().patch(...).doit().await
let r = hub.operations().cancel(...).doit().await
let r = hub.operations().delete(...).doit().await
let r = hub.operations().get(...).doit().await
let r = hub.operations().list(...).doit().await
let r = hub.organizations().gcp_user_access_bindings_create(...).doit().await
let r = hub.organizations().gcp_user_access_bindings_delete(...).doit().await
let r = hub.organizations().gcp_user_access_bindings_patch(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accesscontextmanager1 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accesscontextmanager1 as accesscontextmanager1;
use accesscontextmanager1::{Result, Error};
use std::default::Default;
use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.operations().list("name")
.page_token("magna")
.page_size(-11)
.filter("ipsum")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Delegate) to the
[Method Builder](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::RequestValue) and
[decodable](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accesscontextmanager1/5.0.4+20240226/google_accesscontextmanager1/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accesscontextmanager1** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,227 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Context Manager* crate version *5.0.4+20240226*, where *20240226* is the exact revision of the *accesscontextmanager:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Context Manager* *v1* API can be found at the
//! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessContextManager) ...
//!
//! * [access policies](api::AccessPolicy)
//! * [*access levels create*](api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](api::AccessPolicyAccessLevelGetCall), [*access levels list*](api::AccessPolicyAccessLevelListCall), [*access levels patch*](api::AccessPolicyAccessLevelPatchCall), [*access levels replace all*](api::AccessPolicyAccessLevelReplaceAllCall), [*access levels test iam permissions*](api::AccessPolicyAccessLevelTestIamPermissionCall), [*authorized orgs descs create*](api::AccessPolicyAuthorizedOrgsDescCreateCall), [*authorized orgs descs delete*](api::AccessPolicyAuthorizedOrgsDescDeleteCall), [*authorized orgs descs get*](api::AccessPolicyAuthorizedOrgsDescGetCall), [*authorized orgs descs list*](api::AccessPolicyAuthorizedOrgsDescListCall), [*authorized orgs descs patch*](api::AccessPolicyAuthorizedOrgsDescPatchCall), [*create*](api::AccessPolicyCreateCall), [*delete*](api::AccessPolicyDeleteCall), [*get*](api::AccessPolicyGetCall), [*get iam policy*](api::AccessPolicyGetIamPolicyCall), [*list*](api::AccessPolicyListCall), [*patch*](api::AccessPolicyPatchCall), [*service perimeters commit*](api::AccessPolicyServicePerimeterCommitCall), [*service perimeters create*](api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](api::AccessPolicyServicePerimeterListCall), [*service perimeters patch*](api::AccessPolicyServicePerimeterPatchCall), [*service perimeters replace all*](api::AccessPolicyServicePerimeterReplaceAllCall), [*service perimeters test iam permissions*](api::AccessPolicyServicePerimeterTestIamPermissionCall), [*set iam policy*](api::AccessPolicySetIamPolicyCall) and [*test iam permissions*](api::AccessPolicyTestIamPermissionCall)
//! * [operations](api::Operation)
//! * [*cancel*](api::OperationCancelCall), [*delete*](api::OperationDeleteCall), [*get*](api::OperationGetCall) and [*list*](api::OperationListCall)
//! * organizations
//! * [*gcp user access bindings create*](api::OrganizationGcpUserAccessBindingCreateCall), [*gcp user access bindings delete*](api::OrganizationGcpUserAccessBindingDeleteCall), [*gcp user access bindings get*](api::OrganizationGcpUserAccessBindingGetCall), [*gcp user access bindings list*](api::OrganizationGcpUserAccessBindingListCall) and [*gcp user access bindings patch*](api::OrganizationGcpUserAccessBindingPatchCall)
//! * services
//! * [*get*](api::ServiceGetCall) and [*list*](api::ServiceListCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessContextManager)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.access_policies().access_levels_create(...).doit().await
//! let r = hub.access_policies().access_levels_delete(...).doit().await
//! let r = hub.access_policies().access_levels_patch(...).doit().await
//! let r = hub.access_policies().access_levels_replace_all(...).doit().await
//! let r = hub.access_policies().authorized_orgs_descs_create(...).doit().await
//! let r = hub.access_policies().authorized_orgs_descs_delete(...).doit().await
//! let r = hub.access_policies().authorized_orgs_descs_patch(...).doit().await
//! let r = hub.access_policies().service_perimeters_commit(...).doit().await
//! let r = hub.access_policies().service_perimeters_create(...).doit().await
//! let r = hub.access_policies().service_perimeters_delete(...).doit().await
//! let r = hub.access_policies().service_perimeters_patch(...).doit().await
//! let r = hub.access_policies().service_perimeters_replace_all(...).doit().await
//! let r = hub.access_policies().create(...).doit().await
//! let r = hub.access_policies().delete(...).doit().await
//! let r = hub.access_policies().patch(...).doit().await
//! let r = hub.operations().cancel(...).doit().await
//! let r = hub.operations().delete(...).doit().await
//! let r = hub.operations().get(...).doit().await
//! let r = hub.operations().list(...).doit().await
//! let r = hub.organizations().gcp_user_access_bindings_create(...).doit().await
//! let r = hub.organizations().gcp_user_access_bindings_delete(...).doit().await
//! let r = hub.organizations().gcp_user_access_bindings_patch(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accesscontextmanager1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accesscontextmanager1 as accesscontextmanager1;
//! use accesscontextmanager1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accesscontextmanager1::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.operations().list("name")
//! .page_token("At")
//! .page_size(-8)
//! .filter("sed")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessContextManager;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1_beta-cli"
version = "5.0.4+20230123"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1beta)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta-cli"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "http://byron.github.io/google-apis-rs/google_accesscontextmanager1_beta_cli"
license = "MIT"
keywords = ["accesscontextmanager", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "accesscontextmanager1-beta"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-accesscontextmanager1_beta]
path = "../accesscontextmanager1_beta"
version = "5.0.4+20230123"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,121 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `accesscontextmanager1-beta` command-line interface *(CLI)* allows to use most features of the *Google Access Context Manager* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *Access Context Manager* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-accesscontextmanager1_beta-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta-cli).
# Usage
This documentation was generated from the *Access Context Manager* API at revision *20230123*. The CLI is at version *5.0.4*.
```bash
accesscontextmanager1-beta [options]
access-policies
access-levels-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
access-levels-delete <name> [-p <v>]... [-o <out>]
access-levels-get <name> [-p <v>]... [-o <out>]
access-levels-list <parent> [-p <v>]... [-o <out>]
access-levels-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
create (-r <kv>)... [-p <v>]... [-o <out>]
delete <name> [-p <v>]... [-o <out>]
get <name> [-p <v>]... [-o <out>]
list [-p <v>]... [-o <out>]
patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-create <parent> (-r <kv>)... [-p <v>]... [-o <out>]
service-perimeters-delete <name> [-p <v>]... [-o <out>]
service-perimeters-get <name> [-p <v>]... [-o <out>]
service-perimeters-list <parent> [-p <v>]... [-o <out>]
service-perimeters-patch <name> (-r <kv>)... [-p <v>]... [-o <out>]
operations
get <name> [-p <v>]... [-o <out>]
accesscontextmanager1-beta --help
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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `accesscontextmanager1-beta-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/accesscontextmanager1-beta-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/accesscontextmanager1-beta-secret.json`, assuming that the required *accesscontextmanager* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `accesscontextmanager1-beta --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,34 @@
site_name: Access Context Manager v5.0.4+20230123
site_url: http://byron.github.io/google-apis-rs/google-accesscontextmanager1_beta-cli
site_description: A complete library to interact with Access Context Manager (protocol v1beta)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Access Policies':
- 'Access Levels Create': 'access-policies_access-levels-create.md'
- 'Access Levels Delete': 'access-policies_access-levels-delete.md'
- 'Access Levels Get': 'access-policies_access-levels-get.md'
- 'Access Levels List': 'access-policies_access-levels-list.md'
- 'Access Levels Patch': 'access-policies_access-levels-patch.md'
- 'Create': 'access-policies_create.md'
- 'Delete': 'access-policies_delete.md'
- 'Get': 'access-policies_get.md'
- 'List': 'access-policies_list.md'
- 'Patch': 'access-policies_patch.md'
- 'Service Perimeters Create': 'access-policies_service-perimeters-create.md'
- 'Service Perimeters Delete': 'access-policies_service-perimeters-delete.md'
- 'Service Perimeters Get': 'access-policies_service-perimeters-get.md'
- 'Service Perimeters List': 'access-policies_service-perimeters-list.md'
- 'Service Perimeters Patch': 'access-policies_service-perimeters-patch.md'
- 'Operations':
- 'Get': 'operations_get.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-accesscontextmanager1_beta"
version = "5.0.4+20230123"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Access Context Manager (protocol v1beta)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta"
homepage = "https://cloud.google.com/access-context-manager/docs/reference/rest/"
documentation = "https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123"
license = "MIT"
keywords = ["accesscontextmanager", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,195 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-accesscontextmanager1_beta` library allows access to all features of the *Google Access Context Manager* service.
This documentation was generated from *Access Context Manager* crate version *5.0.4+20230123*, where *20230123* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Access Context Manager* *v1_beta* API can be found at the
[official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/AccessContextManager) ...
* [access policies](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicy)
* [*access levels create*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelGetCall), [*access levels list*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelListCall), [*access levels patch*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyAccessLevelPatchCall), [*create*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyCreateCall), [*delete*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyDeleteCall), [*get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyGetCall), [*list*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyListCall), [*patch*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyPatchCall), [*service perimeters create*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterListCall) and [*service perimeters patch*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::AccessPolicyServicePerimeterPatchCall)
* [operations](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::Operation)
* [*get*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/api::OperationGetCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/AccessContextManager)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder)
* **[Resources](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.access_policies().access_levels_create(...).doit().await
let r = hub.access_policies().access_levels_delete(...).doit().await
let r = hub.access_policies().access_levels_patch(...).doit().await
let r = hub.access_policies().service_perimeters_create(...).doit().await
let r = hub.access_policies().service_perimeters_delete(...).doit().await
let r = hub.access_policies().service_perimeters_patch(...).doit().await
let r = hub.access_policies().create(...).doit().await
let r = hub.access_policies().delete(...).doit().await
let r = hub.access_policies().patch(...).doit().await
let r = hub.operations().get(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-accesscontextmanager1_beta = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
use accesscontextmanager1_beta::api::AccessLevel;
use accesscontextmanager1_beta::{Result, Error};
use std::default::Default;
use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = AccessLevel::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.access_policies().access_levels_patch(req, "name")
.update_mask(&Default::default())
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Delegate) to the
[Method Builder](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::RequestValue) and
[decodable](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-accesscontextmanager1_beta/5.0.4+20230123/google_accesscontextmanager1_beta/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **accesscontextmanager1_beta** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,215 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Access Context Manager* crate version *5.0.4+20230123*, where *20230123* is the exact revision of the *accesscontextmanager:v1beta* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Access Context Manager* *v1_beta* API can be found at the
//! [official documentation site](https://cloud.google.com/access-context-manager/docs/reference/rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/accesscontextmanager1_beta).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AccessContextManager) ...
//!
//! * [access policies](api::AccessPolicy)
//! * [*access levels create*](api::AccessPolicyAccessLevelCreateCall), [*access levels delete*](api::AccessPolicyAccessLevelDeleteCall), [*access levels get*](api::AccessPolicyAccessLevelGetCall), [*access levels list*](api::AccessPolicyAccessLevelListCall), [*access levels patch*](api::AccessPolicyAccessLevelPatchCall), [*create*](api::AccessPolicyCreateCall), [*delete*](api::AccessPolicyDeleteCall), [*get*](api::AccessPolicyGetCall), [*list*](api::AccessPolicyListCall), [*patch*](api::AccessPolicyPatchCall), [*service perimeters create*](api::AccessPolicyServicePerimeterCreateCall), [*service perimeters delete*](api::AccessPolicyServicePerimeterDeleteCall), [*service perimeters get*](api::AccessPolicyServicePerimeterGetCall), [*service perimeters list*](api::AccessPolicyServicePerimeterListCall) and [*service perimeters patch*](api::AccessPolicyServicePerimeterPatchCall)
//! * [operations](api::Operation)
//! * [*get*](api::OperationGetCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AccessContextManager)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.access_policies().access_levels_create(...).doit().await
//! let r = hub.access_policies().access_levels_delete(...).doit().await
//! let r = hub.access_policies().access_levels_patch(...).doit().await
//! let r = hub.access_policies().service_perimeters_create(...).doit().await
//! let r = hub.access_policies().service_perimeters_delete(...).doit().await
//! let r = hub.access_policies().service_perimeters_patch(...).doit().await
//! let r = hub.access_policies().create(...).doit().await
//! let r = hub.access_policies().delete(...).doit().await
//! let r = hub.access_policies().patch(...).doit().await
//! let r = hub.operations().get(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-accesscontextmanager1_beta = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
//! use accesscontextmanager1_beta::api::AccessLevel;
//! use accesscontextmanager1_beta::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use accesscontextmanager1_beta::{AccessContextManager, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AccessContextManager::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = AccessLevel::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.access_policies().access_levels_patch(req, "name")
//! .update_mask(&Default::default())
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AccessContextManager;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer1d3-cli"
version = "5.0.4+20210330"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3-cli"
homepage = "https://developers.google.com/ad-exchange/buyer-rest"
documentation = "http://byron.github.io/google-apis-rs/google_adexchangebuyer1d3_cli"
license = "MIT"
keywords = ["adexchangebuyer", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "adexchangebuyer1d3"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-adexchangebuyer1d3]
path = "../adexchangebuyer1d3"
version = "5.0.4+20210330"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

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

View File

@@ -0,0 +1,44 @@
site_name: Ad Exchange Buyer v5.0.4+20210330
site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d3-cli
site_description: A complete library to interact with Ad Exchange Buyer (protocol v1.3)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Accounts':
- 'Get': 'accounts_get.md'
- 'List': 'accounts_list.md'
- 'Patch': 'accounts_patch.md'
- 'Update': 'accounts_update.md'
- 'Billing Info':
- 'Get': 'billing-info_get.md'
- 'List': 'billing-info_list.md'
- 'Budget':
- 'Get': 'budget_get.md'
- 'Patch': 'budget_patch.md'
- 'Update': 'budget_update.md'
- 'Creatives':
- 'Get': 'creatives_get.md'
- 'Insert': 'creatives_insert.md'
- 'List': 'creatives_list.md'
- 'Direct Deals':
- 'Get': 'direct-deals_get.md'
- 'List': 'direct-deals_list.md'
- 'Performance Report':
- 'List': 'performance-report_list.md'
- 'Pretargeting Config':
- 'Delete': 'pretargeting-config_delete.md'
- 'Get': 'pretargeting-config_get.md'
- 'Insert': 'pretargeting-config_insert.md'
- 'List': 'pretargeting-config_list.md'
- 'Patch': 'pretargeting-config_patch.md'
- 'Update': 'pretargeting-config_update.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer1d3"
version = "5.0.4+20210330"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.3)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3"
homepage = "https://developers.google.com/ad-exchange/buyer-rest"
documentation = "https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330"
license = "MIT"
keywords = ["adexchangebuyer", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,198 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-adexchangebuyer1d3` library allows access to all features of the *Google Ad Exchange Buyer* service.
This documentation was generated from *Ad Exchange Buyer* crate version *5.0.4+20210330*, where *20210330* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/AdExchangeBuyer) ...
* [accounts](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::Account)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountGetCall), [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountListCall), [*patch*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::AccountUpdateCall)
* [billing info](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BillingInfo)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BillingInfoGetCall) and [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BillingInfoListCall)
* [budget](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::Budget)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BudgetGetCall), [*patch*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BudgetPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::BudgetUpdateCall)
* [creatives](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::Creative)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::CreativeGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::CreativeInsertCall) and [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::CreativeListCall)
* [direct deals](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::DirectDeal)
* [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::DirectDealGetCall) and [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::DirectDealListCall)
* [performance report](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PerformanceReport)
* [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PerformanceReportListCall)
* [pretargeting config](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfig)
* [*delete*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigDeleteCall), [*get*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigInsertCall), [*list*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigListCall), [*patch*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/api::PretargetingConfigUpdateCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/AdExchangeBuyer)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder)
* **[Resources](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.pretargeting_config().get(...).doit().await
let r = hub.pretargeting_config().insert(...).doit().await
let r = hub.pretargeting_config().patch(...).doit().await
let r = hub.pretargeting_config().update(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-adexchangebuyer1d3 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
use adexchangebuyer1d3::api::PretargetingConfig;
use adexchangebuyer1d3::{Result, Error};
use std::default::Default;
use adexchangebuyer1d3::{AdExchangeBuyer, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AdExchangeBuyer::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// As the method needs a request, you would usually fill it with the desired information
// into the respective structure. Some of the parts shown here might not be applicable !
// Values shown here are possibly random and not representative !
let mut req = PretargetingConfig::default();
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.pretargeting_config().patch(req, -22, -33)
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Delegate) to the
[Method Builder](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::RequestValue) and
[decodable](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-adexchangebuyer1d3/5.0.4+20210330/google_adexchangebuyer1d3/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **adexchangebuyer1d3** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,218 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Ad Exchange Buyer* crate version *5.0.4+20210330*, where *20210330* is the exact revision of the *adexchangebuyer:v1.3* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Ad Exchange Buyer* *v1d3* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d3).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AdExchangeBuyer) ...
//!
//! * [accounts](api::Account)
//! * [*get*](api::AccountGetCall), [*list*](api::AccountListCall), [*patch*](api::AccountPatchCall) and [*update*](api::AccountUpdateCall)
//! * [billing info](api::BillingInfo)
//! * [*get*](api::BillingInfoGetCall) and [*list*](api::BillingInfoListCall)
//! * [budget](api::Budget)
//! * [*get*](api::BudgetGetCall), [*patch*](api::BudgetPatchCall) and [*update*](api::BudgetUpdateCall)
//! * [creatives](api::Creative)
//! * [*get*](api::CreativeGetCall), [*insert*](api::CreativeInsertCall) and [*list*](api::CreativeListCall)
//! * [direct deals](api::DirectDeal)
//! * [*get*](api::DirectDealGetCall) and [*list*](api::DirectDealListCall)
//! * [performance report](api::PerformanceReport)
//! * [*list*](api::PerformanceReportListCall)
//! * [pretargeting config](api::PretargetingConfig)
//! * [*delete*](api::PretargetingConfigDeleteCall), [*get*](api::PretargetingConfigGetCall), [*insert*](api::PretargetingConfigInsertCall), [*list*](api::PretargetingConfigListCall), [*patch*](api::PretargetingConfigPatchCall) and [*update*](api::PretargetingConfigUpdateCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AdExchangeBuyer)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.pretargeting_config().get(...).doit().await
//! let r = hub.pretargeting_config().insert(...).doit().await
//! let r = hub.pretargeting_config().patch(...).doit().await
//! let r = hub.pretargeting_config().update(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-adexchangebuyer1d3 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
//! use adexchangebuyer1d3::api::PretargetingConfig;
//! use adexchangebuyer1d3::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use adexchangebuyer1d3::{AdExchangeBuyer, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AdExchangeBuyer::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // As the method needs a request, you would usually fill it with the desired information
//! // into the respective structure. Some of the parts shown here might not be applicable !
//! // Values shown here are possibly random and not representative !
//! let mut req = PretargetingConfig::default();
//!
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.pretargeting_config().patch(req, -11, -55)
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AdExchangeBuyer;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer1d4-cli"
version = "5.0.4+20210330"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.4)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d4-cli"
homepage = "https://developers.google.com/ad-exchange/buyer-rest"
documentation = "http://byron.github.io/google-apis-rs/google_adexchangebuyer1d4_cli"
license = "MIT"
keywords = ["adexchangebuyer", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "adexchangebuyer1d4"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-adexchangebuyer1d4]
path = "../adexchangebuyer1d4"
version = "5.0.4+20210330"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

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

View File

@@ -0,0 +1,66 @@
site_name: Ad Exchange Buyer v5.0.4+20210330
site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer1d4-cli
site_description: A complete library to interact with Ad Exchange Buyer (protocol v1.4)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d4-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Accounts':
- 'Get': 'accounts_get.md'
- 'List': 'accounts_list.md'
- 'Patch': 'accounts_patch.md'
- 'Update': 'accounts_update.md'
- 'Billing Info':
- 'Get': 'billing-info_get.md'
- 'List': 'billing-info_list.md'
- 'Budget':
- 'Get': 'budget_get.md'
- 'Patch': 'budget_patch.md'
- 'Update': 'budget_update.md'
- 'Creatives':
- 'Add Deal': 'creatives_add-deal.md'
- 'Get': 'creatives_get.md'
- 'Insert': 'creatives_insert.md'
- 'List': 'creatives_list.md'
- 'List Deals': 'creatives_list-deals.md'
- 'Remove Deal': 'creatives_remove-deal.md'
- 'Marketplacedeals':
- 'Delete': 'marketplacedeals_delete.md'
- 'Insert': 'marketplacedeals_insert.md'
- 'List': 'marketplacedeals_list.md'
- 'Update': 'marketplacedeals_update.md'
- 'Marketplacenotes':
- 'Insert': 'marketplacenotes_insert.md'
- 'List': 'marketplacenotes_list.md'
- 'Marketplaceprivateauction':
- 'Updateproposal': 'marketplaceprivateauction_updateproposal.md'
- 'Performance Report':
- 'List': 'performance-report_list.md'
- 'Pretargeting Config':
- 'Delete': 'pretargeting-config_delete.md'
- 'Get': 'pretargeting-config_get.md'
- 'Insert': 'pretargeting-config_insert.md'
- 'List': 'pretargeting-config_list.md'
- 'Patch': 'pretargeting-config_patch.md'
- 'Update': 'pretargeting-config_update.md'
- 'Products':
- 'Get': 'products_get.md'
- 'Search': 'products_search.md'
- 'Proposals':
- 'Get': 'proposals_get.md'
- 'Insert': 'proposals_insert.md'
- 'Patch': 'proposals_patch.md'
- 'Search': 'proposals_search.md'
- 'Setupcomplete': 'proposals_setupcomplete.md'
- 'Update': 'proposals_update.md'
- 'Pubprofiles':
- 'List': 'pubprofiles_list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer1d4"
version = "5.0.4+20210330"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Buyer (protocol v1.4)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d4"
homepage = "https://developers.google.com/ad-exchange/buyer-rest"
documentation = "https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330"
license = "MIT"
keywords = ["adexchangebuyer", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,210 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-adexchangebuyer1d4` library allows access to all features of the *Google Ad Exchange Buyer* service.
This documentation was generated from *Ad Exchange Buyer* crate version *5.0.4+20210330*, where *20210330* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Ad Exchange Buyer* *v1d4* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/AdExchangeBuyer) ...
* [accounts](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::Account)
* [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::AccountGetCall), [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::AccountListCall), [*patch*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::AccountPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::AccountUpdateCall)
* [billing info](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::BillingInfo)
* [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::BillingInfoGetCall) and [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::BillingInfoListCall)
* [budget](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::Budget)
* [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::BudgetGetCall), [*patch*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::BudgetPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::BudgetUpdateCall)
* [creatives](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::Creative)
* [*add deal*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::CreativeAddDealCall), [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::CreativeGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::CreativeInsertCall), [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::CreativeListCall), [*list deals*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::CreativeListDealCall) and [*remove deal*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::CreativeRemoveDealCall)
* marketplacedeals
* [*delete*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplacedealDeleteCall), [*insert*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplacedealInsertCall), [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplacedealListCall) and [*update*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplacedealUpdateCall)
* marketplacenotes
* [*insert*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplacenoteInsertCall) and [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplacenoteListCall)
* marketplaceprivateauction
* [*updateproposal*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::MarketplaceprivateauctionUpdateproposalCall)
* [performance report](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PerformanceReport)
* [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PerformanceReportListCall)
* [pretargeting config](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfig)
* [*delete*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfigDeleteCall), [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfigGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfigInsertCall), [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfigListCall), [*patch*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfigPatchCall) and [*update*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PretargetingConfigUpdateCall)
* [products](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::Product)
* [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProductGetCall) and [*search*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProductSearchCall)
* [proposals](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::Proposal)
* [*get*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProposalGetCall), [*insert*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProposalInsertCall), [*patch*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProposalPatchCall), [*search*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProposalSearchCall), [*setupcomplete*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProposalSetupcompleteCall) and [*update*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::ProposalUpdateCall)
* pubprofiles
* [*list*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/api::PubprofileListCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/AdExchangeBuyer)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::CallBuilder)
* **[Resources](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.creatives().add_deal(...).doit().await
let r = hub.creatives().get(...).doit().await
let r = hub.creatives().insert(...).doit().await
let r = hub.creatives().list(...).doit().await
let r = hub.creatives().list_deals(...).doit().await
let r = hub.creatives().remove_deal(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-adexchangebuyer1d4 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4;
use adexchangebuyer1d4::{Result, Error};
use std::default::Default;
use adexchangebuyer1d4::{AdExchangeBuyer, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AdExchangeBuyer::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.creatives().list()
.page_token("et")
.open_auction_status_filter("magna")
.max_results(90)
.deals_status_filter("ipsum")
.add_buyer_creative_id("voluptua.")
.add_account_id(-27)
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Delegate) to the
[Method Builder](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::RequestValue) and
[decodable](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-adexchangebuyer1d4/5.0.4+20210330/google_adexchangebuyer1d4/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **adexchangebuyer1d4** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,230 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Ad Exchange Buyer* crate version *5.0.4+20210330*, where *20210330* is the exact revision of the *adexchangebuyer:v1.4* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Ad Exchange Buyer* *v1d4* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/buyer-rest).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer1d4).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AdExchangeBuyer) ...
//!
//! * [accounts](api::Account)
//! * [*get*](api::AccountGetCall), [*list*](api::AccountListCall), [*patch*](api::AccountPatchCall) and [*update*](api::AccountUpdateCall)
//! * [billing info](api::BillingInfo)
//! * [*get*](api::BillingInfoGetCall) and [*list*](api::BillingInfoListCall)
//! * [budget](api::Budget)
//! * [*get*](api::BudgetGetCall), [*patch*](api::BudgetPatchCall) and [*update*](api::BudgetUpdateCall)
//! * [creatives](api::Creative)
//! * [*add deal*](api::CreativeAddDealCall), [*get*](api::CreativeGetCall), [*insert*](api::CreativeInsertCall), [*list*](api::CreativeListCall), [*list deals*](api::CreativeListDealCall) and [*remove deal*](api::CreativeRemoveDealCall)
//! * marketplacedeals
//! * [*delete*](api::MarketplacedealDeleteCall), [*insert*](api::MarketplacedealInsertCall), [*list*](api::MarketplacedealListCall) and [*update*](api::MarketplacedealUpdateCall)
//! * marketplacenotes
//! * [*insert*](api::MarketplacenoteInsertCall) and [*list*](api::MarketplacenoteListCall)
//! * marketplaceprivateauction
//! * [*updateproposal*](api::MarketplaceprivateauctionUpdateproposalCall)
//! * [performance report](api::PerformanceReport)
//! * [*list*](api::PerformanceReportListCall)
//! * [pretargeting config](api::PretargetingConfig)
//! * [*delete*](api::PretargetingConfigDeleteCall), [*get*](api::PretargetingConfigGetCall), [*insert*](api::PretargetingConfigInsertCall), [*list*](api::PretargetingConfigListCall), [*patch*](api::PretargetingConfigPatchCall) and [*update*](api::PretargetingConfigUpdateCall)
//! * [products](api::Product)
//! * [*get*](api::ProductGetCall) and [*search*](api::ProductSearchCall)
//! * [proposals](api::Proposal)
//! * [*get*](api::ProposalGetCall), [*insert*](api::ProposalInsertCall), [*patch*](api::ProposalPatchCall), [*search*](api::ProposalSearchCall), [*setupcomplete*](api::ProposalSetupcompleteCall) and [*update*](api::ProposalUpdateCall)
//! * pubprofiles
//! * [*list*](api::PubprofileListCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AdExchangeBuyer)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.creatives().add_deal(...).doit().await
//! let r = hub.creatives().get(...).doit().await
//! let r = hub.creatives().insert(...).doit().await
//! let r = hub.creatives().list(...).doit().await
//! let r = hub.creatives().list_deals(...).doit().await
//! let r = hub.creatives().remove_deal(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-adexchangebuyer1d4 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_adexchangebuyer1d4 as adexchangebuyer1d4;
//! use adexchangebuyer1d4::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use adexchangebuyer1d4::{AdExchangeBuyer, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AdExchangeBuyer::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.creatives().list()
//! .page_token("sanctus")
//! .open_auction_status_filter("sed")
//! .max_results(99)
//! .deals_status_filter("takimata")
//! .add_buyer_creative_id("amet.")
//! .add_account_id(-20)
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AdExchangeBuyer;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer2_v2_beta1-cli"
version = "5.0.4+20240305"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with AdExchangeBuyerII (protocol v2beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer2_v2_beta1-cli"
homepage = "https://developers.google.com/authorized-buyers/apis/reference/rest/"
documentation = "http://byron.github.io/google-apis-rs/google_adexchangebuyer2_v2_beta1_cli"
license = "MIT"
keywords = ["adexchangebuyer2", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "adexchangebuyer2-v2-beta1"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-adexchangebuyer2_v2_beta1]
path = "../adexchangebuyer2_v2_beta1"
version = "5.0.4+20240305"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,184 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/cli/README.md.mako'
DO NOT EDIT !
-->
The `adexchangebuyer2-v2-beta1` command-line interface *(CLI)* allows to use most features of the *Google AdExchangeBuyerII* service from the comfort of your terminal.
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
Everything else about the *AdExchangeBuyerII* API can be found at the
[official documentation site](https://developers.google.com/authorized-buyers/apis/reference/rest/).
# Installation and Source Code
Install the command-line interface with cargo using:
```bash
cargo install google-adexchangebuyer2_v2_beta1-cli
```
Find the source code [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer2_v2_beta1-cli).
# Usage
This documentation was generated from the *AdExchangeBuyerII* API at revision *20240305*. The CLI is at version *5.0.4*.
```bash
adexchangebuyer2-v2-beta1 [options]
accounts
clients-create <account-id> (-r <kv>)... [-p <v>]... [-o <out>]
clients-get <account-id> <client-account-id> [-p <v>]... [-o <out>]
clients-invitations-create <account-id> <client-account-id> (-r <kv>)... [-p <v>]... [-o <out>]
clients-invitations-get <account-id> <client-account-id> <invitation-id> [-p <v>]... [-o <out>]
clients-invitations-list <account-id> <client-account-id> [-p <v>]... [-o <out>]
clients-list <account-id> [-p <v>]... [-o <out>]
clients-update <account-id> <client-account-id> (-r <kv>)... [-p <v>]... [-o <out>]
clients-users-get <account-id> <client-account-id> <user-id> [-p <v>]... [-o <out>]
clients-users-list <account-id> <client-account-id> [-p <v>]... [-o <out>]
clients-users-update <account-id> <client-account-id> <user-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives-create <account-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives-deal-associations-add <account-id> <creative-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives-deal-associations-list <account-id> <creative-id> [-p <v>]... [-o <out>]
creatives-deal-associations-remove <account-id> <creative-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives-get <account-id> <creative-id> [-p <v>]... [-o <out>]
creatives-list <account-id> [-p <v>]... [-o <out>]
creatives-stop-watching <account-id> <creative-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives-update <account-id> <creative-id> (-r <kv>)... [-p <v>]... [-o <out>]
creatives-watch <account-id> <creative-id> (-r <kv>)... [-p <v>]... [-o <out>]
finalized-proposals-list <account-id> [-p <v>]... [-o <out>]
finalized-proposals-pause <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
finalized-proposals-resume <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
products-get <account-id> <product-id> [-p <v>]... [-o <out>]
products-list <account-id> [-p <v>]... [-o <out>]
proposals-accept <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-add-note <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-cancel-negotiation <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-complete-setup <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-create <account-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-get <account-id> <proposal-id> [-p <v>]... [-o <out>]
proposals-list <account-id> [-p <v>]... [-o <out>]
proposals-pause <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-resume <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
proposals-update <account-id> <proposal-id> (-r <kv>)... [-p <v>]... [-o <out>]
publisher-profiles-get <account-id> <publisher-profile-id> [-p <v>]... [-o <out>]
publisher-profiles-list <account-id> [-p <v>]... [-o <out>]
bidders
accounts-filter-sets-bid-metrics-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-bid-response-errors-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-bid-responses-without-bids-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-create <owner-name> (-r <kv>)... [-p <v>]... [-o <out>]
accounts-filter-sets-delete <name> [-p <v>]... [-o <out>]
accounts-filter-sets-filtered-bid-requests-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-filtered-bids-creatives-list <filter-set-name> <creative-status-id> [-p <v>]... [-o <out>]
accounts-filter-sets-filtered-bids-details-list <filter-set-name> <creative-status-id> [-p <v>]... [-o <out>]
accounts-filter-sets-filtered-bids-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-get <name> [-p <v>]... [-o <out>]
accounts-filter-sets-impression-metrics-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-list <owner-name> [-p <v>]... [-o <out>]
accounts-filter-sets-losing-bids-list <filter-set-name> [-p <v>]... [-o <out>]
accounts-filter-sets-non-billable-winning-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-bid-metrics-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-bid-response-errors-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-bid-responses-without-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-create <owner-name> (-r <kv>)... [-p <v>]... [-o <out>]
filter-sets-delete <name> [-p <v>]... [-o <out>]
filter-sets-filtered-bid-requests-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-filtered-bids-creatives-list <filter-set-name> <creative-status-id> [-p <v>]... [-o <out>]
filter-sets-filtered-bids-details-list <filter-set-name> <creative-status-id> [-p <v>]... [-o <out>]
filter-sets-filtered-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-get <name> [-p <v>]... [-o <out>]
filter-sets-impression-metrics-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-list <owner-name> [-p <v>]... [-o <out>]
filter-sets-losing-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-non-billable-winning-bids-list <filter-set-name> [-p <v>]... [-o <out>]
buyers
filter-sets-bid-metrics-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-bid-response-errors-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-bid-responses-without-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-create <owner-name> (-r <kv>)... [-p <v>]... [-o <out>]
filter-sets-delete <name> [-p <v>]... [-o <out>]
filter-sets-filtered-bid-requests-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-filtered-bids-creatives-list <filter-set-name> <creative-status-id> [-p <v>]... [-o <out>]
filter-sets-filtered-bids-details-list <filter-set-name> <creative-status-id> [-p <v>]... [-o <out>]
filter-sets-filtered-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-get <name> [-p <v>]... [-o <out>]
filter-sets-impression-metrics-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-list <owner-name> [-p <v>]... [-o <out>]
filter-sets-losing-bids-list <filter-set-name> [-p <v>]... [-o <out>]
filter-sets-non-billable-winning-bids-list <filter-set-name> [-p <v>]... [-o <out>]
adexchangebuyer2-v2-beta1 --help
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]
```
# Configuration
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `adexchangebuyer2-v2-beta1-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
More information about the various kinds of persistent data are given in the following paragraphs.
# Authentication
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
method that is read-only, it will ask only for a read-only scope.
You may use the `--scope` flag to specify a scope directly.
All applicable scopes are documented in the respective method's CLI documentation.
The first time a scope is used, the user is asked for permission. Follow the instructions given
by the CLI to grant permissions, or to decline.
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
directory, e.g. `~/.google-service-cli/adexchangebuyer2-v2-beta1-token-<scope-hash>.json`. No manual management of these tokens
is necessary.
To revoke granted authentication, please refer to the [official documentation][revoke-access].
# Application Secrets
In order to allow any application to use Google services, it will need to be registered using the
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
one by one. Most APIs can be used for free and have a daily quota.
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
comes with a default application secret that is configured accordingly. This also means that heavy usage
all around the world may deplete the daily quota.
You can workaround this limitation by putting your own secrets file at this location:
`~/.google-service-cli/adexchangebuyer2-v2-beta1-secret.json`, assuming that the required *adexchangebuyer2* API
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
*APIs & auth -> Credentials -> Download JSON* and used as is.
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
# Debugging
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
what exactly led to a particular issue. This is done by allowing all client-server communication to be
output to standard error *as-is*.
The `--debug` flag will print errors using the `Debug` representation to standard error.
You may consider redirecting standard error into a file for ease of use, e.g. `adexchangebuyer2-v2-beta1 --debug <resource> <method> [options] 2>debug.txt`.
[scopes]: https://developers.google.com/+/api/oauth#scopes
[revoke-access]: http://webapps.stackexchange.com/a/30849
[google-dev-console]: https://console.developers.google.com/
[google-project-new]: https://developers.google.com/console/help/new/

View File

@@ -0,0 +1,97 @@
site_name: AdExchangeBuyerII v5.0.4+20240305
site_url: http://byron.github.io/google-apis-rs/google-adexchangebuyer2_v2_beta1-cli
site_description: A complete library to interact with AdExchangeBuyerII (protocol v2beta1)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer2_v2_beta1-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Accounts':
- 'Clients Create': 'accounts_clients-create.md'
- 'Clients Get': 'accounts_clients-get.md'
- 'Clients Invitations Create': 'accounts_clients-invitations-create.md'
- 'Clients Invitations Get': 'accounts_clients-invitations-get.md'
- 'Clients Invitations List': 'accounts_clients-invitations-list.md'
- 'Clients List': 'accounts_clients-list.md'
- 'Clients Update': 'accounts_clients-update.md'
- 'Clients Users Get': 'accounts_clients-users-get.md'
- 'Clients Users List': 'accounts_clients-users-list.md'
- 'Clients Users Update': 'accounts_clients-users-update.md'
- 'Creatives Create': 'accounts_creatives-create.md'
- 'Creatives Deal Associations Add': 'accounts_creatives-deal-associations-add.md'
- 'Creatives Deal Associations List': 'accounts_creatives-deal-associations-list.md'
- 'Creatives Deal Associations Remove': 'accounts_creatives-deal-associations-remove.md'
- 'Creatives Get': 'accounts_creatives-get.md'
- 'Creatives List': 'accounts_creatives-list.md'
- 'Creatives Stop Watching': 'accounts_creatives-stop-watching.md'
- 'Creatives Update': 'accounts_creatives-update.md'
- 'Creatives Watch': 'accounts_creatives-watch.md'
- 'Finalized Proposals List': 'accounts_finalized-proposals-list.md'
- 'Finalized Proposals Pause': 'accounts_finalized-proposals-pause.md'
- 'Finalized Proposals Resume': 'accounts_finalized-proposals-resume.md'
- 'Products Get': 'accounts_products-get.md'
- 'Products List': 'accounts_products-list.md'
- 'Proposals Accept': 'accounts_proposals-accept.md'
- 'Proposals Add Note': 'accounts_proposals-add-note.md'
- 'Proposals Cancel Negotiation': 'accounts_proposals-cancel-negotiation.md'
- 'Proposals Complete Setup': 'accounts_proposals-complete-setup.md'
- 'Proposals Create': 'accounts_proposals-create.md'
- 'Proposals Get': 'accounts_proposals-get.md'
- 'Proposals List': 'accounts_proposals-list.md'
- 'Proposals Pause': 'accounts_proposals-pause.md'
- 'Proposals Resume': 'accounts_proposals-resume.md'
- 'Proposals Update': 'accounts_proposals-update.md'
- 'Publisher Profiles Get': 'accounts_publisher-profiles-get.md'
- 'Publisher Profiles List': 'accounts_publisher-profiles-list.md'
- 'Bidders':
- 'Accounts Filter Sets Bid Metrics List': 'bidders_accounts-filter-sets-bid-metrics-list.md'
- 'Accounts Filter Sets Bid Response Errors List': 'bidders_accounts-filter-sets-bid-response-errors-list.md'
- 'Accounts Filter Sets Bid Responses Without Bids List': 'bidders_accounts-filter-sets-bid-responses-without-bids-list.md'
- 'Accounts Filter Sets Create': 'bidders_accounts-filter-sets-create.md'
- 'Accounts Filter Sets Delete': 'bidders_accounts-filter-sets-delete.md'
- 'Accounts Filter Sets Filtered Bid Requests List': 'bidders_accounts-filter-sets-filtered-bid-requests-list.md'
- 'Accounts Filter Sets Filtered Bids Creatives List': 'bidders_accounts-filter-sets-filtered-bids-creatives-list.md'
- 'Accounts Filter Sets Filtered Bids Details List': 'bidders_accounts-filter-sets-filtered-bids-details-list.md'
- 'Accounts Filter Sets Filtered Bids List': 'bidders_accounts-filter-sets-filtered-bids-list.md'
- 'Accounts Filter Sets Get': 'bidders_accounts-filter-sets-get.md'
- 'Accounts Filter Sets Impression Metrics List': 'bidders_accounts-filter-sets-impression-metrics-list.md'
- 'Accounts Filter Sets List': 'bidders_accounts-filter-sets-list.md'
- 'Accounts Filter Sets Losing Bids List': 'bidders_accounts-filter-sets-losing-bids-list.md'
- 'Accounts Filter Sets Non Billable Winning Bids List': 'bidders_accounts-filter-sets-non-billable-winning-bids-list.md'
- 'Filter Sets Bid Metrics List': 'bidders_filter-sets-bid-metrics-list.md'
- 'Filter Sets Bid Response Errors List': 'bidders_filter-sets-bid-response-errors-list.md'
- 'Filter Sets Bid Responses Without Bids List': 'bidders_filter-sets-bid-responses-without-bids-list.md'
- 'Filter Sets Create': 'bidders_filter-sets-create.md'
- 'Filter Sets Delete': 'bidders_filter-sets-delete.md'
- 'Filter Sets Filtered Bid Requests List': 'bidders_filter-sets-filtered-bid-requests-list.md'
- 'Filter Sets Filtered Bids Creatives List': 'bidders_filter-sets-filtered-bids-creatives-list.md'
- 'Filter Sets Filtered Bids Details List': 'bidders_filter-sets-filtered-bids-details-list.md'
- 'Filter Sets Filtered Bids List': 'bidders_filter-sets-filtered-bids-list.md'
- 'Filter Sets Get': 'bidders_filter-sets-get.md'
- 'Filter Sets Impression Metrics List': 'bidders_filter-sets-impression-metrics-list.md'
- 'Filter Sets List': 'bidders_filter-sets-list.md'
- 'Filter Sets Losing Bids List': 'bidders_filter-sets-losing-bids-list.md'
- 'Filter Sets Non Billable Winning Bids List': 'bidders_filter-sets-non-billable-winning-bids-list.md'
- 'Buyers':
- 'Filter Sets Bid Metrics List': 'buyers_filter-sets-bid-metrics-list.md'
- 'Filter Sets Bid Response Errors List': 'buyers_filter-sets-bid-response-errors-list.md'
- 'Filter Sets Bid Responses Without Bids List': 'buyers_filter-sets-bid-responses-without-bids-list.md'
- 'Filter Sets Create': 'buyers_filter-sets-create.md'
- 'Filter Sets Delete': 'buyers_filter-sets-delete.md'
- 'Filter Sets Filtered Bid Requests List': 'buyers_filter-sets-filtered-bid-requests-list.md'
- 'Filter Sets Filtered Bids Creatives List': 'buyers_filter-sets-filtered-bids-creatives-list.md'
- 'Filter Sets Filtered Bids Details List': 'buyers_filter-sets-filtered-bids-details-list.md'
- 'Filter Sets Filtered Bids List': 'buyers_filter-sets-filtered-bids-list.md'
- 'Filter Sets Get': 'buyers_filter-sets-get.md'
- 'Filter Sets Impression Metrics List': 'buyers_filter-sets-impression-metrics-list.md'
- 'Filter Sets List': 'buyers_filter-sets-list.md'
- 'Filter Sets Losing Bids List': 'buyers_filter-sets-losing-bids-list.md'
- 'Filter Sets Non Billable Winning Bids List': 'buyers_filter-sets-non-billable-winning-bids-list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangebuyer2_v2_beta1"
version = "5.0.4+20240305"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with AdExchangeBuyerII (protocol v2beta1)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer2_v2_beta1"
homepage = "https://developers.google.com/authorized-buyers/apis/reference/rest/"
documentation = "https://docs.rs/google-adexchangebuyer2_v2_beta1/5.0.4+20240305"
license = "MIT"
keywords = ["adexchangebuyer2", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,216 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *AdExchangeBuyerII* crate version *5.0.4+20240305*, where *20240305* is the exact revision of the *adexchangebuyer2:v2beta1* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *AdExchangeBuyerII* *v2_beta1* API can be found at the
//! [official documentation site](https://developers.google.com/authorized-buyers/apis/reference/rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangebuyer2_v2_beta1).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AdExchangeBuyerII) ...
//!
//! * accounts
//! * [*clients create*](api::AccountClientCreateCall), [*clients get*](api::AccountClientGetCall), [*clients invitations create*](api::AccountClientInvitationCreateCall), [*clients invitations get*](api::AccountClientInvitationGetCall), [*clients invitations list*](api::AccountClientInvitationListCall), [*clients list*](api::AccountClientListCall), [*clients update*](api::AccountClientUpdateCall), [*clients users get*](api::AccountClientUserGetCall), [*clients users list*](api::AccountClientUserListCall), [*clients users update*](api::AccountClientUserUpdateCall), [*creatives create*](api::AccountCreativeCreateCall), [*creatives deal associations add*](api::AccountCreativeDealAssociationAddCall), [*creatives deal associations list*](api::AccountCreativeDealAssociationListCall), [*creatives deal associations remove*](api::AccountCreativeDealAssociationRemoveCall), [*creatives get*](api::AccountCreativeGetCall), [*creatives list*](api::AccountCreativeListCall), [*creatives stop watching*](api::AccountCreativeStopWatchingCall), [*creatives update*](api::AccountCreativeUpdateCall), [*creatives watch*](api::AccountCreativeWatchCall), [*finalized proposals list*](api::AccountFinalizedProposalListCall), [*finalized proposals pause*](api::AccountFinalizedProposalPauseCall), [*finalized proposals resume*](api::AccountFinalizedProposalResumeCall), [*products get*](api::AccountProductGetCall), [*products list*](api::AccountProductListCall), [*proposals accept*](api::AccountProposalAcceptCall), [*proposals add note*](api::AccountProposalAddNoteCall), [*proposals cancel negotiation*](api::AccountProposalCancelNegotiationCall), [*proposals complete setup*](api::AccountProposalCompleteSetupCall), [*proposals create*](api::AccountProposalCreateCall), [*proposals get*](api::AccountProposalGetCall), [*proposals list*](api::AccountProposalListCall), [*proposals pause*](api::AccountProposalPauseCall), [*proposals resume*](api::AccountProposalResumeCall), [*proposals update*](api::AccountProposalUpdateCall), [*publisher profiles get*](api::AccountPublisherProfileGetCall) and [*publisher profiles list*](api::AccountPublisherProfileListCall)
//! * bidders
//! * [*accounts filter sets bid metrics list*](api::BidderAccountFilterSetBidMetricListCall), [*accounts filter sets bid response errors list*](api::BidderAccountFilterSetBidResponseErrorListCall), [*accounts filter sets bid responses without bids list*](api::BidderAccountFilterSetBidResponsesWithoutBidListCall), [*accounts filter sets create*](api::BidderAccountFilterSetCreateCall), [*accounts filter sets delete*](api::BidderAccountFilterSetDeleteCall), [*accounts filter sets filtered bid requests list*](api::BidderAccountFilterSetFilteredBidRequestListCall), [*accounts filter sets filtered bids creatives list*](api::BidderAccountFilterSetFilteredBidCreativeListCall), [*accounts filter sets filtered bids details list*](api::BidderAccountFilterSetFilteredBidDetailListCall), [*accounts filter sets filtered bids list*](api::BidderAccountFilterSetFilteredBidListCall), [*accounts filter sets get*](api::BidderAccountFilterSetGetCall), [*accounts filter sets impression metrics list*](api::BidderAccountFilterSetImpressionMetricListCall), [*accounts filter sets list*](api::BidderAccountFilterSetListCall), [*accounts filter sets losing bids list*](api::BidderAccountFilterSetLosingBidListCall), [*accounts filter sets non billable winning bids list*](api::BidderAccountFilterSetNonBillableWinningBidListCall), [*filter sets bid metrics list*](api::BidderFilterSetBidMetricListCall), [*filter sets bid response errors list*](api::BidderFilterSetBidResponseErrorListCall), [*filter sets bid responses without bids list*](api::BidderFilterSetBidResponsesWithoutBidListCall), [*filter sets create*](api::BidderFilterSetCreateCall), [*filter sets delete*](api::BidderFilterSetDeleteCall), [*filter sets filtered bid requests list*](api::BidderFilterSetFilteredBidRequestListCall), [*filter sets filtered bids creatives list*](api::BidderFilterSetFilteredBidCreativeListCall), [*filter sets filtered bids details list*](api::BidderFilterSetFilteredBidDetailListCall), [*filter sets filtered bids list*](api::BidderFilterSetFilteredBidListCall), [*filter sets get*](api::BidderFilterSetGetCall), [*filter sets impression metrics list*](api::BidderFilterSetImpressionMetricListCall), [*filter sets list*](api::BidderFilterSetListCall), [*filter sets losing bids list*](api::BidderFilterSetLosingBidListCall) and [*filter sets non billable winning bids list*](api::BidderFilterSetNonBillableWinningBidListCall)
//! * [buyers](api::Buyer)
//! * [*filter sets bid metrics list*](api::BuyerFilterSetBidMetricListCall), [*filter sets bid response errors list*](api::BuyerFilterSetBidResponseErrorListCall), [*filter sets bid responses without bids list*](api::BuyerFilterSetBidResponsesWithoutBidListCall), [*filter sets create*](api::BuyerFilterSetCreateCall), [*filter sets delete*](api::BuyerFilterSetDeleteCall), [*filter sets filtered bid requests list*](api::BuyerFilterSetFilteredBidRequestListCall), [*filter sets filtered bids creatives list*](api::BuyerFilterSetFilteredBidCreativeListCall), [*filter sets filtered bids details list*](api::BuyerFilterSetFilteredBidDetailListCall), [*filter sets filtered bids list*](api::BuyerFilterSetFilteredBidListCall), [*filter sets get*](api::BuyerFilterSetGetCall), [*filter sets impression metrics list*](api::BuyerFilterSetImpressionMetricListCall), [*filter sets list*](api::BuyerFilterSetListCall), [*filter sets losing bids list*](api::BuyerFilterSetLosingBidListCall) and [*filter sets non billable winning bids list*](api::BuyerFilterSetNonBillableWinningBidListCall)
//!
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AdExchangeBuyerII)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.buyers().filter_sets_bid_metrics_list(...).doit().await
//! let r = hub.buyers().filter_sets_bid_response_errors_list(...).doit().await
//! let r = hub.buyers().filter_sets_bid_responses_without_bids_list(...).doit().await
//! let r = hub.buyers().filter_sets_filtered_bid_requests_list(...).doit().await
//! let r = hub.buyers().filter_sets_filtered_bids_creatives_list(...).doit().await
//! let r = hub.buyers().filter_sets_filtered_bids_details_list(...).doit().await
//! let r = hub.buyers().filter_sets_filtered_bids_list(...).doit().await
//! let r = hub.buyers().filter_sets_impression_metrics_list(...).doit().await
//! let r = hub.buyers().filter_sets_losing_bids_list(...).doit().await
//! let r = hub.buyers().filter_sets_non_billable_winning_bids_list(...).doit().await
//! let r = hub.buyers().filter_sets_create(...).doit().await
//! let r = hub.buyers().filter_sets_delete(...).doit().await
//! let r = hub.buyers().filter_sets_get(...).doit().await
//! let r = hub.buyers().filter_sets_list(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-adexchangebuyer2_v2_beta1 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_adexchangebuyer2_v2_beta1 as adexchangebuyer2_v2_beta1;
//! use adexchangebuyer2_v2_beta1::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use adexchangebuyer2_v2_beta1::{AdExchangeBuyerII, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AdExchangeBuyerII::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.buyers().filter_sets_filtered_bids_creatives_list("filterSetName", -27)
//! .page_token("sanctus")
//! .page_size(-80)
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AdExchangeBuyerII;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

View File

@@ -0,0 +1,42 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangeseller2-cli"
version = "5.0.4+20171101"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangeseller2-cli"
homepage = "https://developers.google.com/ad-exchange/seller-rest/"
documentation = "http://byron.github.io/google-apis-rs/google_adexchangeseller2_cli"
license = "MIT"
keywords = ["adexchangeseller", "google", "cli"]
autobins = false
edition = "2018"
[[bin]]
name = "adexchangeseller2"
path = "src/main.rs"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-clis-common = { path = "../../google-clis-common", version = "6.0" }
strsim = "^0.5"
clap = "^2.0"
http = "^0.2"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "^ 1.0", features = ["full"] }
tower-service = "^0.3.1"
[dependencies.google-adexchangeseller2]
path = "../adexchangeseller2"
version = "5.0.4+20171101"

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

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

View File

@@ -0,0 +1,31 @@
site_name: Ad Exchange Seller v5.0.4+20171101
site_url: http://byron.github.io/google-apis-rs/google-adexchangeseller2-cli
site_description: A complete library to interact with Ad Exchange Seller (protocol v2.0)
repo_url: https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangeseller2-cli
docs_dir: docs
site_dir: build_html
nav:
- Home: 'index.md'
- 'Accounts':
- 'Adclients List': 'accounts_adclients-list.md'
- 'Alerts List': 'accounts_alerts-list.md'
- 'Customchannels Get': 'accounts_customchannels-get.md'
- 'Customchannels List': 'accounts_customchannels-list.md'
- 'Get': 'accounts_get.md'
- 'List': 'accounts_list.md'
- 'Metadata Dimensions List': 'accounts_metadata-dimensions-list.md'
- 'Metadata Metrics List': 'accounts_metadata-metrics-list.md'
- 'Preferreddeals Get': 'accounts_preferreddeals-get.md'
- 'Preferreddeals List': 'accounts_preferreddeals-list.md'
- 'Reports Generate': 'accounts_reports-generate.md'
- 'Reports Saved Generate': 'accounts_reports-saved-generate.md'
- 'Reports Saved List': 'accounts_reports-saved-list.md'
- 'Urlchannels List': 'accounts_urlchannels-list.md'
theme: readthedocs
copyright: Copyright &copy; 2015-2020, `Sebastian Thiel`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
# DO NOT EDIT !
# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako'
# DO NOT EDIT !
[package]
name = "google-adexchangeseller2"
version = "5.0.4+20171101"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
description = "A complete library to interact with Ad Exchange Seller (protocol v2.0)"
repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangeseller2"
homepage = "https://developers.google.com/ad-exchange/seller-rest/"
documentation = "https://docs.rs/google-adexchangeseller2/5.0.4+20171101"
license = "MIT"
keywords = ["adexchangeseller", "google", "protocol", "web", "api"]
autobins = false
edition = "2018"
[dependencies]
anyhow = "^ 1.0"
hyper-rustls = "0.24.0"
mime = "^ 0.3.0"
serde = { version = "^ 1.0", features = ["derive"] }
serde_json = "^ 1.0"
itertools = "^ 0.10"
google-apis-common = { path = "../../google-apis-common", version = "6.0" }
hyper = "^ 0.14"
http = "^0.2"
tokio = "^1.0"
tower-service = "^0.3.1"
url = "= 1.7"
[features]
yup-oauth2 = ["google-apis-common/yup-oauth2"]
default = ["yup-oauth2"]

View File

@@ -0,0 +1,30 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/LICENSE.md.mako'
DO NOT EDIT !
-->
The MIT License (MIT)
=====================
Copyright © `2015-2020` `Sebastian Thiel`
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,201 @@
<!---
DO NOT EDIT !
This file was generated automatically from 'src/generator/templates/api/README.md.mako'
DO NOT EDIT !
-->
The `google-adexchangeseller2` library allows access to all features of the *Google Ad Exchange Seller* service.
This documentation was generated from *Ad Exchange Seller* crate version *5.0.4+20171101*, where *20171101* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
Everything else about the *Ad Exchange Seller* *v2* API can be found at the
[official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
# Features
Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/AdExchangeSeller) ...
* [accounts](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::Account)
* [*adclients list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountAdclientListCall), [*alerts list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountAlertListCall), [*customchannels get*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountCustomchannelGetCall), [*customchannels list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountCustomchannelListCall), [*get*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountGetCall), [*list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountListCall), [*metadata dimensions list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountMetadataDimensionListCall), [*metadata metrics list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountMetadataMetricListCall), [*preferreddeals get*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountPreferreddealGetCall), [*preferreddeals list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountPreferreddealListCall), [*reports generate*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountReportGenerateCall), [*reports saved generate*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountReportSavedGenerateCall), [*reports saved list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountReportSavedListCall) and [*urlchannels list*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountUrlchannelListCall)
Download supported by ...
* [*reports generate accounts*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/api::AccountReportGenerateCall)
# Structure of this Library
The API is structured into the following primary items:
* **[Hub](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/AdExchangeSeller)**
* a central object to maintain state and allow accessing all *Activities*
* creates [*Method Builders*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::MethodsBuilder) which in turn
allow access to individual [*Call Builders*](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::CallBuilder)
* **[Resources](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Resource)**
* primary types that you can apply *Activities* to
* a collection of properties and *Parts*
* **[Parts](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Part)**
* a collection of properties
* never directly used in *Activities*
* **[Activities](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::CallBuilder)**
* operations to apply to *Resources*
All *structures* are marked with applicable traits to further categorize them and ease browsing.
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).doit().await
```
Or specifically ...
```ignore
let r = hub.accounts().adclients_list(...).doit().await
let r = hub.accounts().alerts_list(...).doit().await
let r = hub.accounts().customchannels_get(...).doit().await
let r = hub.accounts().customchannels_list(...).doit().await
let r = hub.accounts().metadata_dimensions_list(...).doit().await
let r = hub.accounts().metadata_metrics_list(...).doit().await
let r = hub.accounts().preferreddeals_get(...).doit().await
let r = hub.accounts().preferreddeals_list(...).doit().await
let r = hub.accounts().reports_saved_generate(...).doit().await
let r = hub.accounts().reports_saved_list(...).doit().await
let r = hub.accounts().reports_generate(...).doit().await
let r = hub.accounts().urlchannels_list(...).doit().await
let r = hub.accounts().get(...).doit().await
let r = hub.accounts().list(...).doit().await
```
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
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.
# Usage
## Setting up your Project
To use this library, you would put the following lines into your `Cargo.toml` file:
```toml
[dependencies]
google-adexchangeseller2 = "*"
serde = "^1.0"
serde_json = "^1.0"
```
## A complete example
```Rust
extern crate hyper;
extern crate hyper_rustls;
extern crate google_adexchangeseller2 as adexchangeseller2;
use adexchangeseller2::{Result, Error};
use std::default::Default;
use adexchangeseller2::{AdExchangeSeller, oauth2, hyper, hyper_rustls, chrono, FieldMask};
// Get an ApplicationSecret instance by some means. It contains the `client_id` and
// `client_secret`, among other things.
let secret: oauth2::ApplicationSecret = Default::default();
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
// unless you replace `None` with the desired Flow.
// 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
// retrieve them from storage.
let auth = oauth2::InstalledFlowAuthenticator::builder(
secret,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
).build().await.unwrap();
let mut hub = AdExchangeSeller::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
// You can configure optional parameters by calling the respective setters at will, and
// execute the final call using `doit()`.
// Values shown here are possibly random and not representative !
let result = hub.accounts().reports_generate("accountId", "startDate", "endDate")
.start_index(46)
.add_sort("voluptua.")
.add_metric("At")
.max_results(93)
.locale("sed")
.add_filter("amet.")
.add_dimension("takimata")
.doit().await;
match result {
Err(e) => match e {
// The Error enum provides details about what exactly happened.
// You can also just use its `Debug`, `Display` or `Error` traits
Error::HttpError(_)
|Error::Io(_)
|Error::MissingAPIKey
|Error::MissingToken(_)
|Error::Cancelled
|Error::UploadSizeLimitExceeded(_, _)
|Error::Failure(_)
|Error::BadRequest(_)
|Error::FieldClash(_)
|Error::JsonDecodeError(_, _) => println!("{}", e),
},
Ok(res) => println!("Success: {:?}", res),
}
```
## Handling Errors
All errors produced by the system are provided either as [Result](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Result) enumeration as return value of
the doit() methods, or handed as possibly intermediate results to either the
[Hub Delegate](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
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.
## Uploads and Downloads
If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Result), should be
read by you to obtain the media.
If such a method also supports a [Response Result](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::ResponseResult), 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
this call: `.param("alt", "media")`.
Methods supporting uploads can do so using up to 2 different protocols:
*simple* and *resumable*. The distinctiveness of each is represented by customized
`doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
## Customization and Callbacks
You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Delegate) to the
[Method Builder](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::CallBuilder) before making the final `doit()` call.
Respective methods will be called to provide progress information, as well as determine whether the system should
retry on failure.
The [delegate trait](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
## Optional Parts in Server-Requests
All structures provided by this library are made to be [encodable](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::RequestValue) and
[decodable](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
are valid.
Most optionals are are considered [Parts](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::Part) 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.
## Builder Arguments
Using [method builders](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::CallBuilder), 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.
* [PODs][wiki-pod] are handed by copy
* strings are passed as `&str`
* [request values](https://docs.rs/google-adexchangeseller2/5.0.4+20171101/google_adexchangeseller2/client::RequestValue) are moved
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
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
[google-go-api]: https://github.com/google/google-api-go-client
# License
The **adexchangeseller2** library was generated by Sebastian Thiel, and is placed
under the *MIT* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,221 @@
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *Ad Exchange Seller* crate version *5.0.4+20171101*, where *20171101* is the exact revision of the *adexchangeseller:v2.0* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//!
//! Everything else about the *Ad Exchange Seller* *v2* API can be found at the
//! [official documentation site](https://developers.google.com/ad-exchange/seller-rest/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/adexchangeseller2).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](AdExchangeSeller) ...
//!
//! * [accounts](api::Account)
//! * [*adclients list*](api::AccountAdclientListCall), [*alerts list*](api::AccountAlertListCall), [*customchannels get*](api::AccountCustomchannelGetCall), [*customchannels list*](api::AccountCustomchannelListCall), [*get*](api::AccountGetCall), [*list*](api::AccountListCall), [*metadata dimensions list*](api::AccountMetadataDimensionListCall), [*metadata metrics list*](api::AccountMetadataMetricListCall), [*preferreddeals get*](api::AccountPreferreddealGetCall), [*preferreddeals list*](api::AccountPreferreddealListCall), [*reports generate*](api::AccountReportGenerateCall), [*reports saved generate*](api::AccountReportSavedGenerateCall), [*reports saved list*](api::AccountReportSavedListCall) and [*urlchannels list*](api::AccountUrlchannelListCall)
//!
//!
//! Download supported by ...
//!
//! * [*reports generate accounts*](api::AccountReportGenerateCall)
//!
//!
//!
//! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs).
//!
//! # Structure of this Library
//!
//! The API is structured into the following primary items:
//!
//! * **[Hub](AdExchangeSeller)**
//! * a central object to maintain state and allow accessing all *Activities*
//! * creates [*Method Builders*](client::MethodsBuilder) which in turn
//! allow access to individual [*Call Builders*](client::CallBuilder)
//! * **[Resources](client::Resource)**
//! * primary types that you can apply *Activities* to
//! * a collection of properties and *Parts*
//! * **[Parts](client::Part)**
//! * a collection of properties
//! * never directly used in *Activities*
//! * **[Activities](client::CallBuilder)**
//! * operations to apply to *Resources*
//!
//! All *structures* are marked with applicable traits to further categorize them and ease browsing.
//!
//! Generally speaking, you can invoke *Activities* like this:
//!
//! ```Rust,ignore
//! let r = hub.resource().activity(...).doit().await
//! ```
//!
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.accounts().adclients_list(...).doit().await
//! let r = hub.accounts().alerts_list(...).doit().await
//! let r = hub.accounts().customchannels_get(...).doit().await
//! let r = hub.accounts().customchannels_list(...).doit().await
//! let r = hub.accounts().metadata_dimensions_list(...).doit().await
//! let r = hub.accounts().metadata_metrics_list(...).doit().await
//! let r = hub.accounts().preferreddeals_get(...).doit().await
//! let r = hub.accounts().preferreddeals_list(...).doit().await
//! let r = hub.accounts().reports_saved_generate(...).doit().await
//! let r = hub.accounts().reports_saved_list(...).doit().await
//! let r = hub.accounts().reports_generate(...).doit().await
//! let r = hub.accounts().urlchannels_list(...).doit().await
//! let r = hub.accounts().get(...).doit().await
//! let r = hub.accounts().list(...).doit().await
//! ```
//!
//! 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
//! 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.
//!
//! # Usage
//!
//! ## Setting up your Project
//!
//! To use this library, you would put the following lines into your `Cargo.toml` file:
//!
//! ```toml
//! [dependencies]
//! google-adexchangeseller2 = "*"
//! serde = "^1.0"
//! serde_json = "^1.0"
//! ```
//!
//! ## A complete example
//!
//! ```test_harness,no_run
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_adexchangeseller2 as adexchangeseller2;
//! use adexchangeseller2::{Result, Error};
//! # async fn dox() {
//! use std::default::Default;
//! use adexchangeseller2::{AdExchangeSeller, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // `client_secret`, among other things.
//! let secret: oauth2::ApplicationSecret = Default::default();
//! // Instantiate the authenticator. It will choose a suitable authentication flow for you,
//! // unless you replace `None` with the desired Flow.
//! // 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
//! // retrieve them from storage.
//! let auth = oauth2::InstalledFlowAuthenticator::builder(
//! secret,
//! oauth2::InstalledFlowReturnMethod::HTTPRedirect,
//! ).build().await.unwrap();
//! let mut hub = AdExchangeSeller::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! // You can configure optional parameters by calling the respective setters at will, and
//! // execute the final call using `doit()`.
//! // Values shown here are possibly random and not representative !
//! let result = hub.accounts().reports_generate("accountId", "startDate", "endDate")
//! .start_index(39)
//! .add_sort("Lorem")
//! .add_metric("gubergren")
//! .max_results(26)
//! .locale("dolor")
//! .add_filter("ea")
//! .add_dimension("ipsum")
//! .doit().await;
//!
//! match result {
//! Err(e) => match e {
//! // The Error enum provides details about what exactly happened.
//! // You can also just use its `Debug`, `Display` or `Error` traits
//! Error::HttpError(_)
//! |Error::Io(_)
//! |Error::MissingAPIKey
//! |Error::MissingToken(_)
//! |Error::Cancelled
//! |Error::UploadSizeLimitExceeded(_, _)
//! |Error::Failure(_)
//! |Error::BadRequest(_)
//! |Error::FieldClash(_)
//! |Error::JsonDecodeError(_, _) => println!("{}", e),
//! },
//! Ok(res) => println!("Success: {:?}", res),
//! }
//! # }
//! ```
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! 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.
//!
//! ## Uploads and Downloads
//! If a method supports downloads, the response body, which is part of the [Result](client::Result), should be
//! read by you to obtain the media.
//! If such a method also supports a [Response Result](client::ResponseResult), 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
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) 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.
//!
//! ## Builder Arguments
//!
//! Using [method builders](client::CallBuilder), 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.
//!
//! * [PODs][wiki-pod] are handed by copy
//! * strings are passed as `&str`
//! * [request values](client::RequestValue) are moved
//!
//! 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
//! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
//! [google-go-api]: https://github.com/google/google-api-go-client
//!
//!
// 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.
// 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 ... .
#![allow(unused_imports, unused_mut, dead_code)]
// DO NOT EDIT !
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
// Re-export the hyper and hyper_rustls crate, they are required to build the hub
pub use hyper;
pub use hyper_rustls;
pub extern crate google_apis_common as client;
pub use client::chrono;
pub mod api;
// Re-export the hub type and some basic client structs
pub use api::AdExchangeSeller;
pub use client::{Result, Error, Delegate, FieldMask};
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
#[cfg(feature = "yup-oauth2")]
pub use client::oauth2;

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