make regen-apis

This commit is contained in:
OMGeeky
2023-10-21 23:50:27 +02:00
parent b09392b768
commit ec6083f22f
1959 changed files with 911619 additions and 913545 deletions

View File

@@ -1,328 +1,4 @@
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.3".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.3`.
///
/// 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 ###
// #################
use super::*;
/// Gets a site's Abusive Experience Report summary.
///
/// A builder for the *get* method supported by a *site* resource.
@@ -356,10 +32,10 @@ impl<'a, S> ViolatingSiteMethods<'a, S> {
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>,
pub(super) hub: &'a AbusiveExperienceReport<S>,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for SiteGetCall<'a, S> {}
@@ -573,9 +249,9 @@ where
pub struct ViolatingSiteListCall<'a, S>
where S: 'a {
hub: &'a AbusiveExperienceReport<S>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
pub(super) hub: &'a AbusiveExperienceReport<S>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for ViolatingSiteListCall<'a, S> {}

View File

@@ -0,0 +1,109 @@
use super::*;
/// 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>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _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.3".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.3`.
///
/// 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)
}
}

View File

@@ -0,0 +1,110 @@
use super::*;
/// 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 {
pub(super) 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 {
pub(super) 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(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,65 @@
use super::*;
/// 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 {}

View File

@@ -0,0 +1,2 @@
use super::*;

View File

@@ -1,539 +0,0 @@
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.3".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.3`.
///
/// 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,229 @@
use super::*;
/// 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 {
pub(super) hub: &'a Acceleratedmobilepageurl<S>,
pub(super) _request: BatchGetAmpUrlsRequest,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _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,112 @@
use super::*;
/// 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>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _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.3".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.3`.
///
/// 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)
}
}

View File

@@ -0,0 +1,58 @@
use super::*;
/// 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 {
pub(super) 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(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,100 @@
use super::*;
/// 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 {}

View File

@@ -0,0 +1,2 @@
use super::*;

View File

@@ -0,0 +1,118 @@
use super::*;
/// Central instance to access all AccessApproval related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessApproval<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessApproval<S> {}
impl<'a, S> AccessApproval<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessApproval<S> {
AccessApproval {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accessapproval.googleapis.com/".to_string(),
_root_url: "https://accessapproval.googleapis.com/".to_string(),
}
}
pub fn folders(&'a self) -> FolderMethods<'a, S> {
FolderMethods { hub: &self }
}
pub fn organizations(&'a self) -> OrganizationMethods<'a, S> {
OrganizationMethods { hub: &self }
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { 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.3`.
///
/// 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://accessapproval.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://accessapproval.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)
}
}

View File

@@ -0,0 +1,619 @@
use super::*;
/// A builder providing access to all methods supported on *folder* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, 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 = AccessApproval::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 `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_invalidate(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)`, `get_service_account(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.folders();
/// # }
/// ```
pub struct FolderMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for FolderMethods<'a, S> {}
impl<'a, S> FolderMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> FolderApprovalRequestApproveCall<'a, S> {
FolderApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> FolderApprovalRequestDismisCall<'a, S> {
FolderApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub fn approval_requests_get(&self, name: &str) -> FolderApprovalRequestGetCall<'a, S> {
FolderApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval. Returns FAILED_PRECONDITION if the request exists but is not in an approved state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to invalidate.
pub fn approval_requests_invalidate(&self, request: InvalidateApprovalRequestMessage, name: &str) -> FolderApprovalRequestInvalidateCall<'a, S> {
FolderApprovalRequestInvalidateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
pub fn approval_requests_list(&self, parent: &str) -> FolderApprovalRequestListCall<'a, S> {
FolderApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> FolderDeleteAccessApprovalSettingCall<'a, S> {
FolderDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub fn get_access_approval_settings(&self, name: &str) -> FolderGetAccessApprovalSettingCall<'a, S> {
FolderGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalServiceAccount to retrieve.
pub fn get_service_account(&self, name: &str) -> FolderGetServiceAccountCall<'a, S> {
FolderGetServiceAccountCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> FolderUpdateAccessApprovalSettingCall<'a, S> {
FolderUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *organization* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, 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 = AccessApproval::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 `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_invalidate(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)`, `get_service_account(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.organizations();
/// # }
/// ```
pub struct OrganizationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for OrganizationMethods<'a, S> {}
impl<'a, S> OrganizationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestApproveCall<'a, S> {
OrganizationApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestDismisCall<'a, S> {
OrganizationApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub fn approval_requests_get(&self, name: &str) -> OrganizationApprovalRequestGetCall<'a, S> {
OrganizationApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval. Returns FAILED_PRECONDITION if the request exists but is not in an approved state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to invalidate.
pub fn approval_requests_invalidate(&self, request: InvalidateApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestInvalidateCall<'a, S> {
OrganizationApprovalRequestInvalidateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
pub fn approval_requests_list(&self, parent: &str) -> OrganizationApprovalRequestListCall<'a, S> {
OrganizationApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> OrganizationDeleteAccessApprovalSettingCall<'a, S> {
OrganizationDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub fn get_access_approval_settings(&self, name: &str) -> OrganizationGetAccessApprovalSettingCall<'a, S> {
OrganizationGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalServiceAccount to retrieve.
pub fn get_service_account(&self, name: &str) -> OrganizationGetServiceAccountCall<'a, S> {
OrganizationGetServiceAccountCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> OrganizationUpdateAccessApprovalSettingCall<'a, S> {
OrganizationUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1 as accessapproval1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1::{AccessApproval, 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 = AccessApproval::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 `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_invalidate(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)`, `get_service_account(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> ProjectApprovalRequestApproveCall<'a, S> {
ProjectApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> ProjectApprovalRequestDismisCall<'a, S> {
ProjectApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
pub fn approval_requests_get(&self, name: &str) -> ProjectApprovalRequestGetCall<'a, S> {
ProjectApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest. NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval. Returns FAILED_PRECONDITION if the request exists but is not in an approved state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to invalidate.
pub fn approval_requests_invalidate(&self, request: InvalidateApprovalRequestMessage, name: &str) -> ProjectApprovalRequestInvalidateCall<'a, S> {
ProjectApprovalRequestInvalidateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
pub fn approval_requests_list(&self, parent: &str) -> ProjectApprovalRequestListCall<'a, S> {
ProjectApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> ProjectDeleteAccessApprovalSettingCall<'a, S> {
ProjectDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
pub fn get_access_approval_settings(&self, name: &str) -> ProjectGetAccessApprovalSettingCall<'a, S> {
ProjectGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalServiceAccount to retrieve.
pub fn get_service_account(&self, name: &str) -> ProjectGetServiceAccountCall<'a, S> {
ProjectGetServiceAccountCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> ProjectUpdateAccessApprovalSettingCall<'a, S> {
ProjectUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,384 @@
use super::*;
/// Access Approval service account related to a project/folder/organization.
///
/// # 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 service account folders](FolderGetServiceAccountCall) (response)
/// * [get service account organizations](OrganizationGetServiceAccountCall) (response)
/// * [get service account projects](ProjectGetServiceAccountCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessApprovalServiceAccount {
/// Email address of the service account.
#[serde(rename="accountEmail")]
pub account_email: Option<String>,
/// The resource name of the Access Approval service account. Format is one of: * "projects/{project}/serviceAccount" * "folders/{folder}/serviceAccount" * "organizations/{organization}/serviceAccount"
pub name: Option<String>,
}
impl client::ResponseResult for AccessApprovalServiceAccount {}
/// Settings on a Project/Folder/Organization related to Access Approval.
///
/// # 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 access approval settings folders](FolderGetAccessApprovalSettingCall) (response)
/// * [update access approval settings folders](FolderUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings organizations](OrganizationGetAccessApprovalSettingCall) (response)
/// * [update access approval settings organizations](OrganizationUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings projects](ProjectGetAccessApprovalSettingCall) (response)
/// * [update access approval settings projects](ProjectUpdateAccessApprovalSettingCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessApprovalSettings {
/// The asymmetric crypto key version to use for signing approval requests. Empty active_key_version indicates that a Google-managed key should be used for signing. This property will be ignored if set by an ancestor of this resource, and new non-empty values may not be set.
#[serde(rename="activeKeyVersion")]
pub active_key_version: Option<String>,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings method). If the field is true, that indicates that an ancestor of this Project or Folder has set active_key_version (this field will always be unset for the organization since organizations do not have ancestors).
#[serde(rename="ancestorHasActiveKeyVersion")]
pub ancestor_has_active_key_version: Option<bool>,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings method). If the field is true, that indicates that at least one service is enrolled for Access Approval in one or more ancestors of the Project or Folder (this field will always be unset for the organization since organizations do not have ancestors).
#[serde(rename="enrolledAncestor")]
pub enrolled_ancestor: Option<bool>,
/// A list of Google Cloud Services for which the given resource has Access Approval enrolled. Access requests for the resource given by name against any of these services contained here will be required to have explicit approval. If name refers to an organization, enrollment can be done for individual services. If name refers to a folder or project, enrollment can only be done on an all or nothing basis. If a cloud_product is repeated in this list, the first entry will be honored and all following entries will be discarded. A maximum of 10 enrolled services will be enforced, to be expanded as the set of supported services is expanded.
#[serde(rename="enrolledServices")]
pub enrolled_services: Option<Vec<EnrolledService>>,
/// Output only. This field is read only (not settable via UpdateAccessApprovalSettings method). If the field is true, that indicates that there is some configuration issue with the active_key_version configured at this level in the resource hierarchy (e.g. it doesn't exist or the Access Approval service account doesn't have the correct permissions on it, etc.) This key version is not necessarily the effective key version at this level, as key versions are inherited top-down.
#[serde(rename="invalidKeyVersion")]
pub invalid_key_version: Option<bool>,
/// The resource name of the settings. Format is one of: * "projects/{project}/accessApprovalSettings" * "folders/{folder}/accessApprovalSettings" * "organizations/{organization}/accessApprovalSettings"
pub name: Option<String>,
/// A list of email addresses to which notifications relating to approval requests should be sent. Notifications relating to a resource will be sent to all emails in the settings of ancestor resources of that resource. A maximum of 50 email addresses are allowed.
#[serde(rename="notificationEmails")]
pub notification_emails: Option<Vec<String>>,
}
impl client::RequestValue for AccessApprovalSettings {}
impl client::ResponseResult for AccessApprovalSettings {}
/// Home office and physical location of the principal.
///
/// 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 AccessLocations {
/// The "home office" location of the principal. A two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some limited situations Google systems may refer refer to a region code instead of a country code. Possible Region Codes: * ASI: Asia * EUR: Europe * OCE: Oceania * AFR: Africa * NAM: North America * SAM: South America * ANT: Antarctica * ANY: Any location
#[serde(rename="principalOfficeCountry")]
pub principal_office_country: Option<String>,
/// Physical location of the principal at the time of the access. A two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some limited situations Google systems may refer refer to a region code instead of a country code. Possible Region Codes: * ASI: Asia * EUR: Europe * OCE: Oceania * AFR: Africa * NAM: North America * SAM: South America * ANT: Antarctica * ANY: Any location
#[serde(rename="principalPhysicalLocationCountry")]
pub principal_physical_location_country: Option<String>,
}
impl client::Part for AccessLocations {}
/// There is no detailed description.
///
/// 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 AccessReason {
/// More detail about certain reason types. See comments for each type above.
pub detail: Option<String>,
/// Type of access justification.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for AccessReason {}
/// A request for the customer to approve access to a resource.
///
/// # 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*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (response)
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (response)
/// * [approval requests get folders](FolderApprovalRequestGetCall) (response)
/// * [approval requests invalidate folders](FolderApprovalRequestInvalidateCall) (response)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (response)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (response)
/// * [approval requests get organizations](OrganizationApprovalRequestGetCall) (response)
/// * [approval requests invalidate organizations](OrganizationApprovalRequestInvalidateCall) (response)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (response)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (response)
/// * [approval requests get projects](ProjectApprovalRequestGetCall) (response)
/// * [approval requests invalidate projects](ProjectApprovalRequestInvalidateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApprovalRequest {
/// Access was approved.
pub approve: Option<ApproveDecision>,
/// The request was dismissed.
pub dismiss: Option<DismissDecision>,
/// The resource name of the request. Format is "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}".
pub name: Option<String>,
/// The time at which approval was requested.
#[serde(rename="requestTime")]
pub request_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The requested expiration for the approval. If the request is approved, access will be granted from the time of approval until the expiration time.
#[serde(rename="requestedExpiration")]
pub requested_expiration: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The locations for which approval is being requested.
#[serde(rename="requestedLocations")]
pub requested_locations: Option<AccessLocations>,
/// The justification for which approval is being requested.
#[serde(rename="requestedReason")]
pub requested_reason: Option<AccessReason>,
/// The resource for which approval is being requested. The format of the resource name is defined at https://cloud.google.com/apis/design/resource_names. The resource name here may either be a "full" resource name (e.g. "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative" resource name (e.g. "shelves/shelf1/books/book2") as described in the resource name specification.
#[serde(rename="requestedResourceName")]
pub requested_resource_name: Option<String>,
/// Properties related to the resource represented by requested_resource_name.
#[serde(rename="requestedResourceProperties")]
pub requested_resource_properties: Option<ResourceProperties>,
}
impl client::ResponseResult for ApprovalRequest {}
/// Request to approve an ApprovalRequest.
///
/// # 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*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (request)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (request)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApproveApprovalRequestMessage {
/// The expiration time of this approval.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::RequestValue for ApproveApprovalRequestMessage {}
/// A decision that has been made to approve access to a resource.
///
/// 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 ApproveDecision {
/// The time at which approval was granted.
#[serde(rename="approveTime")]
pub approve_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// True when the request has been auto-approved.
#[serde(rename="autoApproved")]
pub auto_approved: Option<bool>,
/// The time at which the approval expires.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// If set, denotes the timestamp at which the approval is invalidated.
#[serde(rename="invalidateTime")]
pub invalidate_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The signature for the ApprovalRequest and details on how it was signed.
#[serde(rename="signatureInfo")]
pub signature_info: Option<SignatureInfo>,
}
impl client::Part for ApproveDecision {}
/// Request to dismiss an approval request.
///
/// # 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*).
///
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (request)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (request)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DismissApprovalRequestMessage { _never_set: Option<bool> }
impl client::RequestValue for DismissApprovalRequestMessage {}
/// A decision that has been made to dismiss an approval request.
///
/// 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 DismissDecision {
/// The time at which the approval request was dismissed.
#[serde(rename="dismissTime")]
pub dismiss_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// This field will be true if the ApprovalRequest was implicitly dismissed due to inaction by the access approval approvers (the request is not acted on by the approvers before the exiration time).
pub implicit: Option<bool>,
}
impl client::Part for DismissDecision {}
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
///
/// # 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*).
///
/// * [delete access approval settings folders](FolderDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings organizations](OrganizationDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings projects](ProjectDeleteAccessApprovalSettingCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Represents the enrollment of a cloud resource into a specific service.
///
/// 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 EnrolledService {
/// The product for which Access Approval will be enrolled. Allowed values are listed below (case-sensitive): * all * GA * App Engine . * Artifact Registry * BigQuery * Cloud Bigtable * Cloud Key Management Service * Compute Engine * Cloud Dataflow * Cloud Dataproc * Cloud DLP * Cloud EKM * Cloud HSM * Cloud Identity and Access Management * Cloud Logging * Cloud Pub/Sub * Cloud Spanner * Cloud SQL * Cloud Storage * Google Kubernetes Engine * Organization Policy Serivice * Persistent Disk * Resource Manager * Secret Manager * Speaker ID Note: These values are supported as input for legacy purposes, but will not be returned from the API. * all * ga-only * appengine.googleapis.com * artifactregistry.googleapis.com * bigquery.googleapis.com * bigtable.googleapis.com * container.googleapis.com * cloudkms.googleapis.com * cloudresourcemanager.googleapis.com * cloudsql.googleapis.com * compute.googleapis.com * dataflow.googleapis.com * dataproc.googleapis.com * dlp.googleapis.com * iam.googleapis.com * logging.googleapis.com * orgpolicy.googleapis.com * pubsub.googleapis.com * spanner.googleapis.com * secretmanager.googleapis.com * speakerid.googleapis.com * storage.googleapis.com Calls to UpdateAccessApprovalSettings using 'all' or any of the XXX.googleapis.com will be translated to the associated product name ('all', 'App Engine', etc.). Note: 'all' will enroll the resource in all products supported at both 'GA' and 'Preview' levels. More information about levels of support is available at https://cloud.google.com/access-approval/docs/supported-services
#[serde(rename="cloudProduct")]
pub cloud_product: Option<String>,
/// The enrollment level of the service.
#[serde(rename="enrollmentLevel")]
pub enrollment_level: Option<String>,
}
impl client::Part for EnrolledService {}
/// Request to invalidate an existing approval.
///
/// # 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*).
///
/// * [approval requests invalidate folders](FolderApprovalRequestInvalidateCall) (request)
/// * [approval requests invalidate organizations](OrganizationApprovalRequestInvalidateCall) (request)
/// * [approval requests invalidate projects](ProjectApprovalRequestInvalidateCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct InvalidateApprovalRequestMessage { _never_set: Option<bool> }
impl client::RequestValue for InvalidateApprovalRequestMessage {}
/// Response to listing of ApprovalRequest objects.
///
/// # 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*).
///
/// * [approval requests list folders](FolderApprovalRequestListCall) (response)
/// * [approval requests list organizations](OrganizationApprovalRequestListCall) (response)
/// * [approval requests list projects](ProjectApprovalRequestListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListApprovalRequestsResponse {
/// Approval request details.
#[serde(rename="approvalRequests")]
pub approval_requests: Option<Vec<ApprovalRequest>>,
/// Token to retrieve the next page of results, or empty if there are no more.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListApprovalRequestsResponse {}
/// The properties associated with the resource of the request.
///
/// 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 ResourceProperties {
/// Whether an approval will exclude the descendants of the resource being requested.
#[serde(rename="excludesDescendants")]
pub excludes_descendants: Option<bool>,
}
impl client::Part for ResourceProperties {}
/// Information about the digital signature of the resource.
///
/// 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 SignatureInfo {
/// The resource name of the customer CryptoKeyVersion used for signing.
#[serde(rename="customerKmsKeyVersion")]
pub customer_kms_key_version: Option<String>,
/// The public key for the Google default signing, encoded in PEM format. The signature was created using a private key which may be verified using this public key.
#[serde(rename="googlePublicKeyPem")]
pub google_public_key_pem: Option<String>,
/// The digital signature.
#[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
pub signature: Option<Vec<u8>>,
}
impl client::Part for SignatureInfo {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -0,0 +1,118 @@
use super::*;
/// Central instance to access all AccessApproval related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessApproval<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessApproval<S> {}
impl<'a, S> AccessApproval<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessApproval<S> {
AccessApproval {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accessapproval.googleapis.com/".to_string(),
_root_url: "https://accessapproval.googleapis.com/".to_string(),
}
}
pub fn folders(&'a self) -> FolderMethods<'a, S> {
FolderMethods { hub: &self }
}
pub fn organizations(&'a self) -> OrganizationMethods<'a, S> {
OrganizationMethods { hub: &self }
}
pub fn projects(&'a self) -> ProjectMethods<'a, S> {
ProjectMethods { 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.3`.
///
/// 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://accessapproval.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://accessapproval.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)
}
}

View File

@@ -0,0 +1,589 @@
use super::*;
/// A builder providing access to all methods supported on *folder* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, 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 = AccessApproval::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 `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.folders();
/// # }
/// ```
pub struct FolderMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for FolderMethods<'a, S> {}
impl<'a, S> FolderMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest.
///
/// Returns NOT_FOUND if the request does not exist. Returns
/// FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> FolderApprovalRequestApproveCall<'a, S> {
FolderApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest.
///
/// NOTE: This does not deny access to the resource if another request has been
/// made and approved. It is equivalent in effect to ignoring the request
/// altogether.
///
/// Returns NOT_FOUND if the request does not exist.
///
/// Returns FAILED_PRECONDITION if the request exists but is not in a pending
/// state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> FolderApprovalRequestDismisCall<'a, S> {
FolderApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - Name of the approval request to retrieve.
pub fn approval_requests_get(&self, name: &str) -> FolderApprovalRequestGetCall<'a, S> {
FolderApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization.
/// Approval requests can be filtered by state (pending, active, dismissed).
/// The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project_id}",
/// "folders/{folder_id}", or "organizations/{organization_id}".
pub fn approval_requests_list(&self, parent: &str) -> FolderApprovalRequestListCall<'a, S> {
FolderApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization.
/// This will have the effect of disabling Access Approval for the project,
/// folder, or organization, but only if all ancestors also have Access
/// Approval disabled. If Access Approval is enabled at a higher level of the
/// hierarchy, then Access Approval will still be enabled at this level as
/// the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> FolderDeleteAccessApprovalSettingCall<'a, S> {
FolderDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to retrieve.
pub fn get_access_approval_settings(&self, name: &str) -> FolderGetAccessApprovalSettingCall<'a, S> {
FolderGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization.
/// Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> FolderUpdateAccessApprovalSettingCall<'a, S> {
FolderUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *organization* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, 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 = AccessApproval::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 `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.organizations();
/// # }
/// ```
pub struct OrganizationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for OrganizationMethods<'a, S> {}
impl<'a, S> OrganizationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest.
///
/// Returns NOT_FOUND if the request does not exist. Returns
/// FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestApproveCall<'a, S> {
OrganizationApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest.
///
/// NOTE: This does not deny access to the resource if another request has been
/// made and approved. It is equivalent in effect to ignoring the request
/// altogether.
///
/// Returns NOT_FOUND if the request does not exist.
///
/// Returns FAILED_PRECONDITION if the request exists but is not in a pending
/// state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> OrganizationApprovalRequestDismisCall<'a, S> {
OrganizationApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - Name of the approval request to retrieve.
pub fn approval_requests_get(&self, name: &str) -> OrganizationApprovalRequestGetCall<'a, S> {
OrganizationApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization.
/// Approval requests can be filtered by state (pending, active, dismissed).
/// The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project_id}",
/// "folders/{folder_id}", or "organizations/{organization_id}".
pub fn approval_requests_list(&self, parent: &str) -> OrganizationApprovalRequestListCall<'a, S> {
OrganizationApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization.
/// This will have the effect of disabling Access Approval for the project,
/// folder, or organization, but only if all ancestors also have Access
/// Approval disabled. If Access Approval is enabled at a higher level of the
/// hierarchy, then Access Approval will still be enabled at this level as
/// the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> OrganizationDeleteAccessApprovalSettingCall<'a, S> {
OrganizationDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to retrieve.
pub fn get_access_approval_settings(&self, name: &str) -> OrganizationGetAccessApprovalSettingCall<'a, S> {
OrganizationGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization.
/// Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> OrganizationUpdateAccessApprovalSettingCall<'a, S> {
OrganizationUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`AccessApproval`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accessapproval1_beta1 as accessapproval1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accessapproval1_beta1::{AccessApproval, 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 = AccessApproval::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 `approval_requests_approve(...)`, `approval_requests_dismiss(...)`, `approval_requests_get(...)`, `approval_requests_list(...)`, `delete_access_approval_settings(...)`, `get_access_approval_settings(...)` and `update_access_approval_settings(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessApproval<S>,
}
impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {}
impl<'a, S> ProjectMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Approves a request and returns the updated ApprovalRequest.
///
/// Returns NOT_FOUND if the request does not exist. Returns
/// FAILED_PRECONDITION if the request exists but is not in a pending state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the approval request to approve.
pub fn approval_requests_approve(&self, request: ApproveApprovalRequestMessage, name: &str) -> ProjectApprovalRequestApproveCall<'a, S> {
ProjectApprovalRequestApproveCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Dismisses a request. Returns the updated ApprovalRequest.
///
/// NOTE: This does not deny access to the resource if another request has been
/// made and approved. It is equivalent in effect to ignoring the request
/// altogether.
///
/// Returns NOT_FOUND if the request does not exist.
///
/// Returns FAILED_PRECONDITION if the request exists but is not in a pending
/// state.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Name of the ApprovalRequest to dismiss.
pub fn approval_requests_dismiss(&self, request: DismissApprovalRequestMessage, name: &str) -> ProjectApprovalRequestDismisCall<'a, S> {
ProjectApprovalRequestDismisCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an approval request. Returns NOT_FOUND if the request does not exist.
///
/// # Arguments
///
/// * `name` - Name of the approval request to retrieve.
pub fn approval_requests_get(&self, name: &str) -> ProjectApprovalRequestGetCall<'a, S> {
ProjectApprovalRequestGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists approval requests associated with a project, folder, or organization.
/// Approval requests can be filtered by state (pending, active, dismissed).
/// The order is reverse chronological.
///
/// # Arguments
///
/// * `parent` - The parent resource. This may be "projects/{project_id}",
/// "folders/{folder_id}", or "organizations/{organization_id}".
pub fn approval_requests_list(&self, parent: &str) -> ProjectApprovalRequestListCall<'a, S> {
ProjectApprovalRequestListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes the settings associated with a project, folder, or organization.
/// This will have the effect of disabling Access Approval for the project,
/// folder, or organization, but only if all ancestors also have Access
/// Approval disabled. If Access Approval is enabled at a higher level of the
/// hierarchy, then Access Approval will still be enabled at this level as
/// the settings are inherited.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to delete.
pub fn delete_access_approval_settings(&self, name: &str) -> ProjectDeleteAccessApprovalSettingCall<'a, S> {
ProjectDeleteAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the settings associated with a project, folder, or organization.
///
/// # Arguments
///
/// * `name` - Name of the AccessApprovalSettings to retrieve.
pub fn get_access_approval_settings(&self, name: &str) -> ProjectGetAccessApprovalSettingCall<'a, S> {
ProjectGetAccessApprovalSettingCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings associated with a project, folder, or organization.
/// Settings to update are determined by the value of field_mask.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub fn update_access_approval_settings(&self, request: AccessApprovalSettings, name: &str) -> ProjectUpdateAccessApprovalSettingCall<'a, S> {
ProjectUpdateAccessApprovalSettingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,370 @@
use super::*;
/// Settings on a Project/Folder/Organization related to Access Approval.
///
/// # 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 access approval settings folders](FolderGetAccessApprovalSettingCall) (response)
/// * [update access approval settings folders](FolderUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings organizations](OrganizationGetAccessApprovalSettingCall) (response)
/// * [update access approval settings organizations](OrganizationUpdateAccessApprovalSettingCall) (request|response)
/// * [get access approval settings projects](ProjectGetAccessApprovalSettingCall) (response)
/// * [update access approval settings projects](ProjectUpdateAccessApprovalSettingCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessApprovalSettings {
/// Output only. This field is read only (not settable via
/// UpdateAccessAccessApprovalSettings method). If the field is true, that
/// indicates that at least one service is enrolled for Access Approval in one
/// or more ancestors of the Project or Folder (this field will always be
/// unset for the organization since organizations do not have ancestors).
#[serde(rename="enrolledAncestor")]
pub enrolled_ancestor: Option<bool>,
/// A list of Google Cloud Services for which the given resource has Access
/// Approval enrolled. Access requests for the resource given by name against
/// any of these services contained here will be required to have explicit
/// approval. If name refers to an organization, enrollment can be done for
/// individual services. If name refers to a folder or project, enrollment can
/// only be done on an all or nothing basis.
///
/// If a cloud_product is repeated in this list, the first entry will be
/// honored and all following entries will be discarded. A maximum of 10
/// enrolled services will be enforced, to be expanded as the set of supported
/// services is expanded.
#[serde(rename="enrolledServices")]
pub enrolled_services: Option<Vec<EnrolledService>>,
/// The resource name of the settings. Format is one of:
/// <ol>
/// <li>"projects/{project_id}/accessApprovalSettings"</li>
/// <li>"folders/{folder_id}/accessApprovalSettings"</li>
/// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
/// <ol>
pub name: Option<String>,
/// A list of email addresses to which notifications relating to approval
/// requests should be sent. Notifications relating to a resource will be sent
/// to all emails in the settings of ancestor resources of that resource. A
/// maximum of 50 email addresses are allowed.
#[serde(rename="notificationEmails")]
pub notification_emails: Option<Vec<String>>,
}
impl client::RequestValue for AccessApprovalSettings {}
impl client::ResponseResult for AccessApprovalSettings {}
/// Home office and physical location of the principal.
///
/// 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 AccessLocations {
/// The "home office" location of the principal. A two-letter country code
/// (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some
/// limited situations Google systems may refer refer to a region code instead
/// of a country code.
/// Possible Region Codes:
/// <ol>
/// <li>ASI: Asia</li>
/// <li>EUR: Europe</li>
/// <li>OCE: Oceania</li>
/// <li>AFR: Africa</li>
/// <li>NAM: North America</li>
/// <li>SAM: South America</li>
/// <li>ANT: Antarctica</li>
/// <li>ANY: Any location</li>
/// </ol>
#[serde(rename="principalOfficeCountry")]
pub principal_office_country: Option<String>,
/// Physical location of the principal at the time of the access. A
/// two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or
/// a region code. In some limited situations Google systems may refer refer to
/// a region code instead of a country code.
/// Possible Region Codes:
/// <ol>
/// <li>ASI: Asia</li>
/// <li>EUR: Europe</li>
/// <li>OCE: Oceania</li>
/// <li>AFR: Africa</li>
/// <li>NAM: North America</li>
/// <li>SAM: South America</li>
/// <li>ANT: Antarctica</li>
/// <li>ANY: Any location</li>
/// </ol>
#[serde(rename="principalPhysicalLocationCountry")]
pub principal_physical_location_country: Option<String>,
}
impl client::Part for AccessLocations {}
/// There is no detailed description.
///
/// 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 AccessReason {
/// More detail about certain reason types. See comments for each type above.
pub detail: Option<String>,
/// Type of access justification.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for AccessReason {}
/// A request for the customer to approve access to a resource.
///
/// # 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*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (response)
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (response)
/// * [approval requests get folders](FolderApprovalRequestGetCall) (response)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (response)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (response)
/// * [approval requests get organizations](OrganizationApprovalRequestGetCall) (response)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (response)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (response)
/// * [approval requests get projects](ProjectApprovalRequestGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApprovalRequest {
/// Access was approved.
pub approve: Option<ApproveDecision>,
/// The request was dismissed.
pub dismiss: Option<DismissDecision>,
/// The resource name of the request. Format is
/// "{projects|folders|organizations}/{id}/approvalRequests/{approval_request_id}".
pub name: Option<String>,
/// The time at which approval was requested.
#[serde(rename="requestTime")]
pub request_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The requested expiration for the approval. If the request is approved,
/// access will be granted from the time of approval until the expiration time.
#[serde(rename="requestedExpiration")]
pub requested_expiration: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The locations for which approval is being requested.
#[serde(rename="requestedLocations")]
pub requested_locations: Option<AccessLocations>,
/// The justification for which approval is being requested.
#[serde(rename="requestedReason")]
pub requested_reason: Option<AccessReason>,
/// The resource for which approval is being requested. The format of the
/// resource name is defined at
/// https://cloud.google.com/apis/design/resource_names. The resource name here
/// may either be a "full" resource name (e.g.
/// "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative"
/// resource name (e.g. "shelves/shelf1/books/book2") as described in the
/// resource name specification.
#[serde(rename="requestedResourceName")]
pub requested_resource_name: Option<String>,
/// Properties related to the resource represented by requested_resource_name.
#[serde(rename="requestedResourceProperties")]
pub requested_resource_properties: Option<ResourceProperties>,
}
impl client::ResponseResult for ApprovalRequest {}
/// Request to approve an ApprovalRequest.
///
/// # 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*).
///
/// * [approval requests approve folders](FolderApprovalRequestApproveCall) (request)
/// * [approval requests approve organizations](OrganizationApprovalRequestApproveCall) (request)
/// * [approval requests approve projects](ProjectApprovalRequestApproveCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ApproveApprovalRequestMessage {
/// The expiration time of this approval.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::RequestValue for ApproveApprovalRequestMessage {}
/// A decision that has been made to approve access to a resource.
///
/// 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 ApproveDecision {
/// The time at which approval was granted.
#[serde(rename="approveTime")]
pub approve_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The time at which the approval expires.
#[serde(rename="expireTime")]
pub expire_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Part for ApproveDecision {}
/// Request to dismiss an approval request.
///
/// # 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*).
///
/// * [approval requests dismiss folders](FolderApprovalRequestDismisCall) (request)
/// * [approval requests dismiss organizations](OrganizationApprovalRequestDismisCall) (request)
/// * [approval requests dismiss projects](ProjectApprovalRequestDismisCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DismissApprovalRequestMessage { _never_set: Option<bool> }
impl client::RequestValue for DismissApprovalRequestMessage {}
/// A decision that has been made to dismiss an approval request.
///
/// 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 DismissDecision {
/// The time at which the approval request was dismissed.
#[serde(rename="dismissTime")]
pub dismiss_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Part for DismissDecision {}
/// A generic empty message that you can re-use to avoid defining duplicated
/// empty messages in your APIs. A typical example is to use it as the request
/// or the response type of an API method. For instance:
///
/// ````text
/// service Foo {
/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
/// }
/// ````
///
/// The JSON representation for `Empty` is empty JSON object `{}`.
///
/// # 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*).
///
/// * [delete access approval settings folders](FolderDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings organizations](OrganizationDeleteAccessApprovalSettingCall) (response)
/// * [delete access approval settings projects](ProjectDeleteAccessApprovalSettingCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Represents the enrollment of a cloud resource into a specific service.
///
/// 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 EnrolledService {
/// The product for which Access Approval will be enrolled. Allowed values are
/// listed below (case-sensitive):
/// <ol>
/// <li>all</li>
/// <li>appengine.googleapis.com</li>
/// <li>bigquery.googleapis.com</li>
/// <li>bigtable.googleapis.com</li>
/// <li>cloudkms.googleapis.com</li>
/// <li>compute.googleapis.com</li>
/// <li>dataflow.googleapis.com</li>
/// <li>iam.googleapis.com</li>
/// <li>pubsub.googleapis.com</li>
/// <li>storage.googleapis.com</li>
/// <ol>
#[serde(rename="cloudProduct")]
pub cloud_product: Option<String>,
/// The enrollment level of the service.
#[serde(rename="enrollmentLevel")]
pub enrollment_level: Option<String>,
}
impl client::Part for EnrolledService {}
/// Response to listing of ApprovalRequest objects.
///
/// # 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*).
///
/// * [approval requests list folders](FolderApprovalRequestListCall) (response)
/// * [approval requests list organizations](OrganizationApprovalRequestListCall) (response)
/// * [approval requests list projects](ProjectApprovalRequestListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListApprovalRequestsResponse {
/// Approval request details.
#[serde(rename="approvalRequests")]
pub approval_requests: Option<Vec<ApprovalRequest>>,
/// Token to retrieve the next page of results, or empty if there are no more.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListApprovalRequestsResponse {}
/// The properties associated with the resource of the request.
///
/// 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 ResourceProperties {
/// Whether an approval will exclude the descendants of the resource being
/// requested.
#[serde(rename="excludesDescendants")]
pub excludes_descendants: Option<bool>,
}
impl client::Part for ResourceProperties {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage your data across Google Cloud Platform services
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -0,0 +1,115 @@
use super::*;
/// Central instance to access all AccessContextManager related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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("takimata")
/// .page_size(-52)
/// .filter("duo")
/// .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 AccessContextManager<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessContextManager<S> {}
impl<'a, S> AccessContextManager<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessContextManager<S> {
AccessContextManager {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accesscontextmanager.googleapis.com/".to_string(),
_root_url: "https://accesscontextmanager.googleapis.com/".to_string(),
}
}
pub fn access_policies(&'a self) -> AccessPolicyMethods<'a, S> {
AccessPolicyMethods { hub: &self }
}
pub fn operations(&'a self) -> OperationMethods<'a, S> {
OperationMethods { hub: &self }
}
pub fn organizations(&'a self) -> OrganizationMethods<'a, S> {
OrganizationMethods { 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.3`.
///
/// 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://accesscontextmanager.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://accesscontextmanager.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)
}
}

View File

@@ -0,0 +1,805 @@
use super::*;
/// A builder providing access to all methods supported on *accessPolicy* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, 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 = AccessContextManager::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 `access_levels_create(...)`, `access_levels_delete(...)`, `access_levels_get(...)`, `access_levels_list(...)`, `access_levels_patch(...)`, `access_levels_replace_all(...)`, `access_levels_test_iam_permissions(...)`, `authorized_orgs_descs_create(...)`, `authorized_orgs_descs_delete(...)`, `authorized_orgs_descs_get(...)`, `authorized_orgs_descs_list(...)`, `authorized_orgs_descs_patch(...)`, `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `patch(...)`, `service_perimeters_commit(...)`, `service_perimeters_create(...)`, `service_perimeters_delete(...)`, `service_perimeters_get(...)`, `service_perimeters_list(...)`, `service_perimeters_patch(...)`, `service_perimeters_replace_all(...)`, `service_perimeters_test_iam_permissions(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)`
/// // to build up your call.
/// let rb = hub.access_policies();
/// # }
/// ```
pub struct AccessPolicyMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for AccessPolicyMethods<'a, S> {}
impl<'a, S> AccessPolicyMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Creates an access level. The long-running operation from this RPC has a successful status after the access level propagates to long-lasting storage. If access levels contain errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Access Level. Format: `accessPolicies/{policy_id}`
pub fn access_levels_create(&self, request: AccessLevel, parent: &str) -> AccessPolicyAccessLevelCreateCall<'a, S> {
AccessPolicyAccessLevelCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes an access level based on the resource name. The long-running operation from this RPC has a successful status after the access level has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_delete(&self, name: &str) -> AccessPolicyAccessLevelDeleteCall<'a, S> {
AccessPolicyAccessLevelDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an access level based on the resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_get(&self, name: &str) -> AccessPolicyAccessLevelGetCall<'a, S> {
AccessPolicyAccessLevelGetCall {
hub: self.hub,
_name: name.to_string(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all access levels for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Access Levels from. Format: `accessPolicies/{policy_id}`
pub fn access_levels_list(&self, parent: &str) -> AccessPolicyAccessLevelListCall<'a, S> {
AccessPolicyAccessLevelListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an access level. The long-running operation from this RPC has a successful status after the changes to the access level propagate to long-lasting storage. If access levels contain errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
pub fn access_levels_patch(&self, request: AccessLevel, name: &str) -> AccessPolicyAccessLevelPatchCall<'a, S> {
AccessPolicyAccessLevelPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Replaces all existing access levels in an access policy with the access levels provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. If the replacement contains errors, an error response is returned for the first error encountered. Upon error, the replacement is cancelled, and existing access levels are not affected. The Operation.response field contains ReplaceAccessLevelsResponse. Removing access levels contained in existing service perimeters result in an error.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns these Access Levels. Format: `accessPolicies/{policy_id}`
pub fn access_levels_replace_all(&self, request: ReplaceAccessLevelsRequest, parent: &str) -> AccessPolicyAccessLevelReplaceAllCall<'a, S> {
AccessPolicyAccessLevelReplaceAllCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn access_levels_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> AccessPolicyAccessLevelTestIamPermissionCall<'a, S> {
AccessPolicyAccessLevelTestIamPermissionCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a authorized orgs desc. The long-running operation from this RPC has a successful status after the authorized orgs desc propagates to long-lasting storage. If a authorized orgs desc contains errors, an error response is returned for the first error encountered. The name of this `AuthorizedOrgsDesc` will be assigned during creation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Authorized Orgs Desc. Format: `accessPolicies/{policy_id}`
pub fn authorized_orgs_descs_create(&self, request: AuthorizedOrgsDesc, parent: &str) -> AccessPolicyAuthorizedOrgsDescCreateCall<'a, S> {
AccessPolicyAuthorizedOrgsDescCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a authorized orgs desc based on the resource name. The long-running operation from this RPC has a successful status after the authorized orgs desc is removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Authorized Orgs Desc. Format: `accessPolicies/{policy_id}/authorizedOrgsDesc/{authorized_orgs_desc_id}`
pub fn authorized_orgs_descs_delete(&self, name: &str) -> AccessPolicyAuthorizedOrgsDescDeleteCall<'a, S> {
AccessPolicyAuthorizedOrgsDescDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets a authorized orgs desc based on the resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Authorized Orgs Desc. Format: `accessPolicies/{policy_id}/authorizedOrgsDescs/{authorized_orgs_descs_id}`
pub fn authorized_orgs_descs_get(&self, name: &str) -> AccessPolicyAuthorizedOrgsDescGetCall<'a, S> {
AccessPolicyAuthorizedOrgsDescGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all authorized orgs descs for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Authorized Orgs Desc from. Format: `accessPolicies/{policy_id}`
pub fn authorized_orgs_descs_list(&self, parent: &str) -> AccessPolicyAuthorizedOrgsDescListCall<'a, S> {
AccessPolicyAuthorizedOrgsDescListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a authorized orgs desc. The long-running operation from this RPC has a successful status after the authorized orgs desc propagates to long-lasting storage. If a authorized orgs desc contains errors, an error response is returned for the first error encountered. Only the organization list in `AuthorizedOrgsDesc` can be updated. The name, authorization_type, asset_type and authorization_direction cannot be updated.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Assigned by the server during creation. The last segment has an arbitrary length and has only URI unreserved characters (as defined by [RFC 3986 Section 2.3](https://tools.ietf.org/html/rfc3986#section-2.3)). Should not be specified by the client during creation. Example: "accessPolicies/122256/authorizedOrgs/b3-BhcX_Ud5N"
pub fn authorized_orgs_descs_patch(&self, request: AuthorizedOrgsDesc, name: &str) -> AccessPolicyAuthorizedOrgsDescPatchCall<'a, S> {
AccessPolicyAuthorizedOrgsDescPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Commits the dry-run specification for all the service perimeters in an access policy. A commit operation on a service perimeter involves copying its `spec` field to the `status` field of the service perimeter. Only service perimeters with `use_explicit_dry_run_spec` field set to true are affected by a commit operation. The long-running operation from this RPC has a successful status after the dry-run specifications for all the service perimeters have been committed. If a commit fails, it causes the long-running operation to return an error response and the entire commit operation is cancelled. When successful, the Operation.response field contains CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are cleared after a successful commit operation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the parent Access Policy which owns all Service Perimeters in scope for the commit operation. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_commit(&self, request: CommitServicePerimetersRequest, parent: &str) -> AccessPolicyServicePerimeterCommitCall<'a, S> {
AccessPolicyServicePerimeterCommitCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a service perimeter. The long-running operation from this RPC has a successful status after the service perimeter propagates to long-lasting storage. If a service perimeter contains errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Service Perimeter. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_create(&self, request: ServicePerimeter, parent: &str) -> AccessPolicyServicePerimeterCreateCall<'a, S> {
AccessPolicyServicePerimeterCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a service perimeter based on the resource name. The long-running operation from this RPC has a successful status after the service perimeter is removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`
pub fn service_perimeters_delete(&self, name: &str) -> AccessPolicyServicePerimeterDeleteCall<'a, S> {
AccessPolicyServicePerimeterDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets a service perimeter based on the resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`
pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, S> {
AccessPolicyServicePerimeterGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all service perimeters for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Service Perimeters from. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_list(&self, parent: &str) -> AccessPolicyServicePerimeterListCall<'a, S> {
AccessPolicyServicePerimeterListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a service perimeter. The long-running operation from this RPC has a successful status after the service perimeter propagates to long-lasting storage. If a service perimeter contains errors, an error response is returned for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, S> {
AccessPolicyServicePerimeterPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Replace all existing service perimeters in an access policy with the service perimeters provided. This is done atomically. The long-running operation from this RPC has a successful status after all replacements propagate to long-lasting storage. Replacements containing errors result in an error response for the first error encountered. Upon an error, replacement are cancelled and existing service perimeters are not affected. The Operation.response field contains ReplaceServicePerimetersResponse.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns these Service Perimeters. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_replace_all(&self, request: ReplaceServicePerimetersRequest, parent: &str) -> AccessPolicyServicePerimeterReplaceAllCall<'a, S> {
AccessPolicyServicePerimeterReplaceAllCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn service_perimeters_test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> AccessPolicyServicePerimeterTestIamPermissionCall<'a, S> {
AccessPolicyServicePerimeterTestIamPermissionCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage. Syntactic and basic semantic errors are returned in `metadata` as a BadRequest proto.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn create(&self, request: AccessPolicy) -> AccessPolicyCreateCall<'a, S> {
AccessPolicyCreateCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes an access policy based on the resource name. The long-running operation has a successful status after the access policy is removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to delete. Format `accessPolicies/{policy_id}`
pub fn delete(&self, name: &str) -> AccessPolicyDeleteCall<'a, S> {
AccessPolicyDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns an access policy based on the name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to get. Format `accessPolicies/{policy_id}`
pub fn get(&self, name: &str) -> AccessPolicyGetCall<'a, S> {
AccessPolicyGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the IAM policy for the specified Access Context Manager access policy.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn get_iam_policy(&self, request: GetIamPolicyRequest, resource: &str) -> AccessPolicyGetIamPolicyCall<'a, S> {
AccessPolicyGetIamPolicyCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all access policies in an organization.
pub fn list(&self) -> AccessPolicyListCall<'a, S> {
AccessPolicyListCall {
hub: self.hub,
_parent: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an access policy. The long-running operation from this RPC has a successful status after the changes to the access policy propagate to long-lasting storage.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}`
pub fn patch(&self, request: AccessPolicy, name: &str) -> AccessPolicyPatchCall<'a, S> {
AccessPolicyPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the IAM policy for the specified Access Context Manager access policy. This method replaces the existing IAM policy on the access policy. The IAM policy controls the set of users who can perform specific operations on the Access Context Manager access policy.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn set_iam_policy(&self, request: SetIamPolicyRequest, resource: &str) -> AccessPolicySetIamPolicyCall<'a, S> {
AccessPolicySetIamPolicyCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the IAM permissions that the caller has on the specified Access Context Manager resource. The resource can be an AccessPolicy, AccessLevel, or ServicePerimeter. This method does not support other resources.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
pub fn test_iam_permissions(&self, request: TestIamPermissionsRequest, resource: &str) -> AccessPolicyTestIamPermissionCall<'a, S> {
AccessPolicyTestIamPermissionCall {
hub: self.hub,
_request: request,
_resource: resource.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *operation* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, 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 = AccessContextManager::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 `cancel(...)`, `delete(...)`, `get(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.operations();
/// # }
/// ```
pub struct OperationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for OperationMethods<'a, S> {}
impl<'a, S> OperationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name of the operation resource to be cancelled.
pub fn cancel(&self, request: CancelOperationRequest, name: &str) -> OperationCancelCall<'a, S> {
OperationCancelCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
///
/// # Arguments
///
/// * `name` - The name of the operation resource to be deleted.
pub fn delete(&self, name: &str) -> OperationDeleteCall<'a, S> {
OperationDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
///
/// # Arguments
///
/// * `name` - The name of the operation resource.
pub fn get(&self, name: &str) -> OperationGetCall<'a, S> {
OperationGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
///
/// # Arguments
///
/// * `name` - The name of the operation's parent resource.
pub fn list(&self, name: &str) -> OperationListCall<'a, S> {
OperationListCall {
hub: self.hub,
_name: name.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *organization* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1 as accesscontextmanager1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1::{AccessContextManager, 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 = AccessContextManager::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 `gcp_user_access_bindings_create(...)`, `gcp_user_access_bindings_delete(...)`, `gcp_user_access_bindings_get(...)`, `gcp_user_access_bindings_list(...)` and `gcp_user_access_bindings_patch(...)`
/// // to build up your call.
/// let rb = hub.organizations();
/// # }
/// ```
pub struct OrganizationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for OrganizationMethods<'a, S> {}
impl<'a, S> OrganizationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Creates a GcpUserAccessBinding. If the client specifies a name, the server ignores it. Fails if a resource already exists with the same group_key. Completion of this long-running operation does not necessarily signify that the new binding is deployed onto all affected users, which may take more time.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Example: "organizations/256"
pub fn gcp_user_access_bindings_create(&self, request: GcpUserAccessBinding, parent: &str) -> OrganizationGcpUserAccessBindingCreateCall<'a, S> {
OrganizationGcpUserAccessBindingCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a GcpUserAccessBinding. Completion of this long-running operation does not necessarily signify that the binding deletion is deployed onto all affected users, which may take more time.
///
/// # Arguments
///
/// * `name` - Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
pub fn gcp_user_access_bindings_delete(&self, name: &str) -> OrganizationGcpUserAccessBindingDeleteCall<'a, S> {
OrganizationGcpUserAccessBindingDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the GcpUserAccessBinding with the given name.
///
/// # Arguments
///
/// * `name` - Required. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
pub fn gcp_user_access_bindings_get(&self, name: &str) -> OrganizationGcpUserAccessBindingGetCall<'a, S> {
OrganizationGcpUserAccessBindingGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all GcpUserAccessBindings for a Google Cloud organization.
///
/// # Arguments
///
/// * `parent` - Required. Example: "organizations/256"
pub fn gcp_user_access_bindings_list(&self, parent: &str) -> OrganizationGcpUserAccessBindingListCall<'a, S> {
OrganizationGcpUserAccessBindingListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a GcpUserAccessBinding. Completion of this long-running operation does not necessarily signify that the changed binding is deployed onto all affected users, which may take more time.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Immutable. Assigned by the server during creation. The last segment has an arbitrary length and has only URI unreserved characters (as defined by [RFC 3986 Section 2.3](https://tools.ietf.org/html/rfc3986#section-2.3)). Should not be specified by the client during creation. Example: "organizations/256/gcpUserAccessBindings/b3-BhcX_Ud5N"
pub fn gcp_user_access_bindings_patch(&self, request: GcpUserAccessBinding, name: &str) -> OrganizationGcpUserAccessBindingPatchCall<'a, S> {
OrganizationGcpUserAccessBindingPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -0,0 +1,116 @@
use super::*;
/// Central instance to access all AccessContextManager related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AccessContextManager<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AccessContextManager<S> {}
impl<'a, S> AccessContextManager<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AccessContextManager<S> {
AccessContextManager {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://accesscontextmanager.googleapis.com/".to_string(),
_root_url: "https://accesscontextmanager.googleapis.com/".to_string(),
}
}
pub fn access_policies(&'a self) -> AccessPolicyMethods<'a, S> {
AccessPolicyMethods { hub: &self }
}
pub fn operations(&'a self) -> OperationMethods<'a, S> {
OperationMethods { 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.3`.
///
/// 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://accesscontextmanager.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://accesscontextmanager.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)
}
}

View File

@@ -0,0 +1,372 @@
use super::*;
/// A builder providing access to all methods supported on *accessPolicy* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1_beta::{AccessContextManager, 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 = AccessContextManager::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 `access_levels_create(...)`, `access_levels_delete(...)`, `access_levels_get(...)`, `access_levels_list(...)`, `access_levels_patch(...)`, `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)`, `service_perimeters_create(...)`, `service_perimeters_delete(...)`, `service_perimeters_get(...)`, `service_perimeters_list(...)` and `service_perimeters_patch(...)`
/// // to build up your call.
/// let rb = hub.access_policies();
/// # }
/// ```
pub struct AccessPolicyMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for AccessPolicyMethods<'a, S> {}
impl<'a, S> AccessPolicyMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Create an Access Level. The longrunning operation from this RPC will have a successful status once the Access Level has propagated to long-lasting storage. Access Levels containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Access Level. Format: `accessPolicies/{policy_id}`
pub fn access_levels_create(&self, request: AccessLevel, parent: &str) -> AccessPolicyAccessLevelCreateCall<'a, S> {
AccessPolicyAccessLevelCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete an Access Level by resource name. The longrunning operation from this RPC will have a successful status once the Access Level has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_delete(&self, name: &str) -> AccessPolicyAccessLevelDeleteCall<'a, S> {
AccessPolicyAccessLevelDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get an Access Level by resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Access Level. Format: `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
pub fn access_levels_get(&self, name: &str) -> AccessPolicyAccessLevelGetCall<'a, S> {
AccessPolicyAccessLevelGetCall {
hub: self.hub,
_name: name.to_string(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all Access Levels for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Access Levels from. Format: `accessPolicies/{policy_id}`
pub fn access_levels_list(&self, parent: &str) -> AccessPolicyAccessLevelListCall<'a, S> {
AccessPolicyAccessLevelListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_access_level_format: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update an Access Level. The longrunning operation from this RPC will have a successful status once the changes to the Access Level have propagated to long-lasting storage. Access Levels containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
pub fn access_levels_patch(&self, request: AccessLevel, name: &str) -> AccessPolicyAccessLevelPatchCall<'a, S> {
AccessPolicyAccessLevelPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Create a Service Perimeter. The longrunning operation from this RPC will have a successful status once the Service Perimeter has propagated to long-lasting storage. Service Perimeters containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Resource name for the access policy which owns this Service Perimeter. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_create(&self, request: ServicePerimeter, parent: &str) -> AccessPolicyServicePerimeterCreateCall<'a, S> {
AccessPolicyServicePerimeterCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete a Service Perimeter by resource name. The longrunning operation from this RPC will have a successful status once the Service Perimeter has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`
pub fn service_perimeters_delete(&self, name: &str) -> AccessPolicyServicePerimeterDeleteCall<'a, S> {
AccessPolicyServicePerimeterDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get a Service Perimeter by resource name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the Service Perimeter. Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`
pub fn service_perimeters_get(&self, name: &str) -> AccessPolicyServicePerimeterGetCall<'a, S> {
AccessPolicyServicePerimeterGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all Service Perimeters for an access policy.
///
/// # Arguments
///
/// * `parent` - Required. Resource name for the access policy to list Service Perimeters from. Format: `accessPolicies/{policy_id}`
pub fn service_perimeters_list(&self, parent: &str) -> AccessPolicyServicePerimeterListCall<'a, S> {
AccessPolicyServicePerimeterListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update a Service Perimeter. The longrunning operation from this RPC will have a successful status once the changes to the Service Perimeter have propagated to long-lasting storage. Service Perimeter containing errors will result in an error response for the first error encountered.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
pub fn service_perimeters_patch(&self, request: ServicePerimeter, name: &str) -> AccessPolicyServicePerimeterPatchCall<'a, S> {
AccessPolicyServicePerimeterPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Create an `AccessPolicy`. Fails if this organization already has a `AccessPolicy`. The longrunning Operation will have a successful status once the `AccessPolicy` has propagated to long-lasting storage. Syntactic and basic semantic errors will be returned in `metadata` as a BadRequest proto.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn create(&self, request: AccessPolicy) -> AccessPolicyCreateCall<'a, S> {
AccessPolicyCreateCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete an AccessPolicy by resource name. The longrunning Operation will have a successful status once the AccessPolicy has been removed from long-lasting storage.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to delete. Format `accessPolicies/{policy_id}`
pub fn delete(&self, name: &str) -> AccessPolicyDeleteCall<'a, S> {
AccessPolicyDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get an AccessPolicy by name.
///
/// # Arguments
///
/// * `name` - Required. Resource name for the access policy to get. Format `accessPolicies/{policy_id}`
pub fn get(&self, name: &str) -> AccessPolicyGetCall<'a, S> {
AccessPolicyGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all AccessPolicies under a container.
pub fn list(&self) -> AccessPolicyListCall<'a, S> {
AccessPolicyListCall {
hub: self.hub,
_parent: Default::default(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update an AccessPolicy. The longrunning Operation from this RPC will have a successful status once the changes to the AccessPolicy have propagated to long-lasting storage. Syntactic and basic semantic errors will be returned in `metadata` as a BadRequest proto.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
pub fn patch(&self, request: AccessPolicy, name: &str) -> AccessPolicyPatchCall<'a, S> {
AccessPolicyPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *operation* resources.
/// It is not used directly, but through the [`AccessContextManager`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_accesscontextmanager1_beta as accesscontextmanager1_beta;
///
/// # async fn dox() {
/// use std::default::Default;
/// use accesscontextmanager1_beta::{AccessContextManager, 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 = AccessContextManager::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.operations();
/// # }
/// ```
pub struct OperationMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AccessContextManager<S>,
}
impl<'a, S> client::MethodsBuilder for OperationMethods<'a, S> {}
impl<'a, S> OperationMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
///
/// # Arguments
///
/// * `name` - The name of the operation resource.
pub fn get(&self, name: &str) -> OperationGetCall<'a, S> {
OperationGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,434 @@
use super::*;
/// An `AccessLevel` is a label that can be applied to requests to Google Cloud services, along with a list of requirements necessary for the label to be applied.
///
/// # 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*).
///
/// * [access levels create access policies](AccessPolicyAccessLevelCreateCall) (request)
/// * [access levels get access policies](AccessPolicyAccessLevelGetCall) (response)
/// * [access levels patch access policies](AccessPolicyAccessLevelPatchCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessLevel {
/// A `BasicLevel` composed of `Conditions`.
pub basic: Option<BasicLevel>,
/// A `CustomLevel` written in the Common Expression Language.
pub custom: Option<CustomLevel>,
/// Description of the `AccessLevel` and its use. Does not affect behavior.
pub description: Option<String>,
/// Resource name for the `AccessLevel`. Format: `accessPolicies/{access_policy}/accessLevels/{access_level}`. The `access_level` component must begin with a letter, followed by alphanumeric characters or `_`. Its maximum length is 50 characters. After you create an `AccessLevel`, you cannot change its `name`.
pub name: Option<String>,
/// Human readable title. Must be unique within the Policy.
pub title: Option<String>,
}
impl client::RequestValue for AccessLevel {}
impl client::ResponseResult for AccessLevel {}
/// `AccessPolicy` is a container for `AccessLevels` (which define the necessary attributes to use Google Cloud services) and `ServicePerimeters` (which define regions of services able to freely pass data within a perimeter). An access policy is globally visible within an organization, and the restrictions it specifies apply to all projects within an organization.
///
/// # 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*).
///
/// * [create access policies](AccessPolicyCreateCall) (request)
/// * [get access policies](AccessPolicyGetCall) (response)
/// * [patch access policies](AccessPolicyPatchCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccessPolicy {
/// Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
pub name: Option<String>,
/// Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently immutable once created. Format: `organizations/{organization_id}`
pub parent: Option<String>,
/// Required. Human readable title. Does not affect behavior.
pub title: Option<String>,
}
impl client::RequestValue for AccessPolicy {}
impl client::ResponseResult for AccessPolicy {}
/// `BasicLevel` is an `AccessLevel` using a set of recommended features.
///
/// 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 BasicLevel {
/// How the `conditions` list should be combined to determine if a request is granted this `AccessLevel`. If AND is used, each `Condition` in `conditions` must be satisfied for the `AccessLevel` to be applied. If OR is used, at least one `Condition` in `conditions` must be satisfied for the `AccessLevel` to be applied. Default behavior is AND.
#[serde(rename="combiningFunction")]
pub combining_function: Option<String>,
/// Required. A list of requirements for the `AccessLevel` to be granted.
pub conditions: Option<Vec<Condition>>,
}
impl client::Part for BasicLevel {}
/// A condition necessary for an `AccessLevel` to be granted. The Condition is an AND over its fields. So a Condition is true if: 1) the request IP is from one of the listed subnetworks AND 2) the originating device complies with the listed device policy AND 3) all listed access levels are granted AND 4) the request was sent at a time allowed by the DateTimeRestriction.
///
/// 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 Condition {
/// Device specific restrictions, all restrictions must hold for the Condition to be true. If not specified, all devices are allowed.
#[serde(rename="devicePolicy")]
pub device_policy: Option<DevicePolicy>,
/// CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for a CIDR IP address block, the specified IP address portion must be properly truncated (i.e. all the host bits must be zero) or the input is considered malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas "2001:db8::1/32" is not. The originating IP of a request must be in one of the listed subnets in order for this Condition to be true. If empty, all IP addresses are allowed.
#[serde(rename="ipSubnetworks")]
pub ip_subnetworks: Option<Vec<String>>,
/// The request must be made by one of the provided user or service accounts. Groups are not supported. Syntax: `user:{emailid}` `serviceAccount:{emailid}` If not specified, a request may come from any user.
pub members: Option<Vec<String>>,
/// Whether to negate the Condition. If true, the Condition becomes a NAND over its non-empty fields, each field must be false for the Condition overall to be satisfied. Defaults to false.
pub negate: Option<bool>,
/// The request must originate from one of the provided countries/regions. Must be valid ISO 3166-1 alpha-2 codes.
pub regions: Option<Vec<String>>,
/// A list of other access levels defined in the same `Policy`, referenced by resource name. Referencing an `AccessLevel` which does not exist is an error. All access levels listed must be granted for the Condition to be true. Example: "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
#[serde(rename="requiredAccessLevels")]
pub required_access_levels: Option<Vec<String>>,
}
impl client::Part for Condition {}
/// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language to represent the necessary conditions for the level to apply to a request. See CEL spec at: https://github.com/google/cel-spec
///
/// 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 CustomLevel {
/// Required. A Cloud CEL expression evaluating to a boolean.
pub expr: Option<Expr>,
}
impl client::Part for CustomLevel {}
/// `DevicePolicy` specifies device specific restrictions necessary to acquire a given access level. A `DevicePolicy` specifies requirements for requests from devices to be granted access levels, it does not do any enforcement on the device. `DevicePolicy` acts as an AND over all specified fields, and each repeated field is an OR over its elements. Any unset fields are ignored. For example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be true for requests originating from encrypted Linux desktops and encrypted Windows desktops.
///
/// 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 DevicePolicy {
/// Allowed device management levels, an empty list allows all management levels.
#[serde(rename="allowedDeviceManagementLevels")]
pub allowed_device_management_levels: Option<Vec<String>>,
/// Allowed encryptions statuses, an empty list allows all statuses.
#[serde(rename="allowedEncryptionStatuses")]
pub allowed_encryption_statuses: Option<Vec<String>>,
/// Allowed OS versions, an empty list allows all types and all versions.
#[serde(rename="osConstraints")]
pub os_constraints: Option<Vec<OsConstraint>>,
/// Whether the device needs to be approved by the customer admin.
#[serde(rename="requireAdminApproval")]
pub require_admin_approval: Option<bool>,
/// Whether the device needs to be corp owned.
#[serde(rename="requireCorpOwned")]
pub require_corp_owned: Option<bool>,
/// Whether or not screenlock is required for the DevicePolicy to be true. Defaults to `false`.
#[serde(rename="requireScreenlock")]
pub require_screenlock: Option<bool>,
}
impl client::Part for DevicePolicy {}
/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
///
/// 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 Expr {
/// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
pub description: Option<String>,
/// Textual representation of an expression in Common Expression Language syntax.
pub expression: Option<String>,
/// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
pub location: Option<String>,
/// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
pub title: Option<String>,
}
impl client::Part for Expr {}
/// A response to `ListAccessLevelsRequest`.
///
/// # 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*).
///
/// * [access levels list access policies](AccessPolicyAccessLevelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAccessLevelsResponse {
/// List of the Access Level instances.
#[serde(rename="accessLevels")]
pub access_levels: Option<Vec<AccessLevel>>,
/// The pagination token to retrieve the next page of results. If the value is empty, no further results remain.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAccessLevelsResponse {}
/// A response to `ListAccessPoliciesRequest`.
///
/// # 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 access policies](AccessPolicyListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAccessPoliciesResponse {
/// List of the AccessPolicy instances.
#[serde(rename="accessPolicies")]
pub access_policies: Option<Vec<AccessPolicy>>,
/// The pagination token to retrieve the next page of results. If the value is empty, no further results remain.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAccessPoliciesResponse {}
/// A response to `ListServicePerimetersRequest`.
///
/// # 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*).
///
/// * [service perimeters list access policies](AccessPolicyServicePerimeterListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListServicePerimetersResponse {
/// The pagination token to retrieve the next page of results. If the value is empty, no further results remain.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// List of the Service Perimeter instances.
#[serde(rename="servicePerimeters")]
pub service_perimeters: Option<Vec<ServicePerimeter>>,
}
impl client::ResponseResult for ListServicePerimetersResponse {}
/// This resource represents a long-running operation that is the result of a network API call.
///
/// # 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*).
///
/// * [access levels create access policies](AccessPolicyAccessLevelCreateCall) (response)
/// * [access levels delete access policies](AccessPolicyAccessLevelDeleteCall) (response)
/// * [access levels patch access policies](AccessPolicyAccessLevelPatchCall) (response)
/// * [service perimeters create access policies](AccessPolicyServicePerimeterCreateCall) (response)
/// * [service perimeters delete access policies](AccessPolicyServicePerimeterDeleteCall) (response)
/// * [service perimeters patch access policies](AccessPolicyServicePerimeterPatchCall) (response)
/// * [create access policies](AccessPolicyCreateCall) (response)
/// * [delete access policies](AccessPolicyDeleteCall) (response)
/// * [patch access policies](AccessPolicyPatchCall) (response)
/// * [get operations](OperationGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Operation {
/// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
pub done: Option<bool>,
/// The error result of the operation in case of failure or cancellation.
pub error: Option<Status>,
/// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
pub metadata: Option<HashMap<String, json::Value>>,
/// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
pub name: Option<String>,
/// The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
pub response: Option<HashMap<String, json::Value>>,
}
impl client::Resource for Operation {}
impl client::ResponseResult for Operation {}
/// A restriction on the OS type and version of devices making requests.
///
/// 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 OsConstraint {
/// The minimum allowed OS version. If not set, any version of this OS satisfies the constraint. Format: `"major.minor.patch"`. Examples: `"10.5.301"`, `"9.2.1"`.
#[serde(rename="minimumVersion")]
pub minimum_version: Option<String>,
/// Required. The allowed OS type.
#[serde(rename="osType")]
pub os_type: Option<String>,
/// Only allows requests from devices with a verified Chrome OS. Verifications includes requirements that the device is enterprise-managed, conformant to domain policies, and the caller has permission to call the API targeted by the request.
#[serde(rename="requireVerifiedChromeOs")]
pub require_verified_chrome_os: Option<bool>,
}
impl client::Part for OsConstraint {}
/// `ServicePerimeter` describes a set of Google Cloud resources which can freely import and export data amongst themselves, but not export outside of the `ServicePerimeter`. If a request with a source within this `ServicePerimeter` has a target outside of the `ServicePerimeter`, the request will be blocked. Otherwise the request is allowed. There are two types of Service Perimeter - Regular and Bridge. Regular Service Perimeters cannot overlap, a single Google Cloud project can only belong to a single regular Service Perimeter. Service Perimeter Bridges can contain only Google Cloud projects as members, a single Google Cloud project may belong to multiple Service Perimeter Bridges.
///
/// # 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*).
///
/// * [service perimeters create access policies](AccessPolicyServicePerimeterCreateCall) (request)
/// * [service perimeters get access policies](AccessPolicyServicePerimeterGetCall) (response)
/// * [service perimeters patch access policies](AccessPolicyServicePerimeterPatchCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ServicePerimeter {
/// Description of the `ServicePerimeter` and its use. Does not affect behavior.
pub description: Option<String>,
/// Resource name for the `ServicePerimeter`. Format: `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`. The `service_perimeter` component must begin with a letter, followed by alphanumeric characters or `_`. After you create a `ServicePerimeter`, you cannot change its `name`.
pub name: Option<String>,
/// Perimeter type indicator. A single project is allowed to be a member of single regular perimeter, but multiple service perimeter bridges. A project cannot be a included in a perimeter bridge without being included in regular perimeter. For perimeter bridges, restricted/unrestricted service lists as well as access lists must be empty.
#[serde(rename="perimeterType")]
pub perimeter_type: Option<String>,
/// Current ServicePerimeter configuration. Specifies sets of resources, restricted/unrestricted services and access levels that determine perimeter content and boundaries.
pub status: Option<ServicePerimeterConfig>,
/// Human readable title. Must be unique within the Policy.
pub title: Option<String>,
}
impl client::RequestValue for ServicePerimeter {}
impl client::ResponseResult for ServicePerimeter {}
/// `ServicePerimeterConfig` specifies a set of Google Cloud resources that describe specific Service Perimeter configuration.
///
/// 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 ServicePerimeterConfig {
/// A list of `AccessLevel` resource names that allow resources within the `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed must be in the same policy as this `ServicePerimeter`. Referencing a nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are listed, resources within the perimeter can only be accessed via Google Cloud calls with request origins within the perimeter. Example: `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. For Service Perimeter Bridge, must be empty.
#[serde(rename="accessLevels")]
pub access_levels: Option<Vec<String>>,
/// A list of Google Cloud resources that are inside of the service perimeter. Currently only projects are allowed. Format: `projects/{project_number}`
pub resources: Option<Vec<String>>,
/// Google Cloud services that are subject to the Service Perimeter restrictions. Must contain a list of services. For example, if `storage.googleapis.com` is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions.
#[serde(rename="restrictedServices")]
pub restricted_services: Option<Vec<String>>,
/// Google Cloud services that are not subject to the Service Perimeter restrictions. Deprecated. Must be set to a single wildcard "*". The wildcard means that unless explicitly specified by "restricted_services" list, any service is treated as unrestricted.
#[serde(rename="unrestrictedServices")]
pub unrestricted_services: Option<Vec<String>>,
/// Beta. Configuration for APIs allowed within Perimeter.
#[serde(rename="vpcAccessibleServices")]
pub vpc_accessible_services: Option<VpcAccessibleServices>,
}
impl client::Part for ServicePerimeterConfig {}
/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
///
/// 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 Status {
/// The status code, which should be an enum value of google.rpc.Code.
pub code: Option<i32>,
/// A list of messages that carry the error details. There is a common set of message types for APIs to use.
pub details: Option<Vec<HashMap<String, json::Value>>>,
/// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
pub message: Option<String>,
}
impl client::Part for Status {}
/// Specifies how APIs are allowed to communicate within the Service Perimeter.
///
/// 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 VpcAccessibleServices {
/// The list of APIs usable within the Service Perimeter. Must be empty unless 'enable_restriction' is True. You can specify a list of individual services, as well as include the 'RESTRICTED-SERVICES' value, which automatically includes all of the services protected by the perimeter.
#[serde(rename="allowedServices")]
pub allowed_services: Option<Vec<String>>,
/// Whether to restrict API calls within the Service Perimeter to the list of APIs specified in 'allowed_services'.
#[serde(rename="enableRestriction")]
pub enable_restriction: Option<bool>,
}
impl client::Part for VpcAccessibleServices {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}

View File

@@ -0,0 +1,130 @@
use super::*;
/// Central instance to access all AdExchangeBuyer related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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, -28, -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),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AdExchangeBuyer<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdExchangeBuyer<S> {}
impl<'a, S> AdExchangeBuyer<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdExchangeBuyer<S> {
AdExchangeBuyer {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://www.googleapis.com/adexchangebuyer/v1.3/".to_string(),
_root_url: "https://www.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { hub: &self }
}
pub fn billing_info(&'a self) -> BillingInfoMethods<'a, S> {
BillingInfoMethods { hub: &self }
}
pub fn budget(&'a self) -> BudgetMethods<'a, S> {
BudgetMethods { hub: &self }
}
pub fn creatives(&'a self) -> CreativeMethods<'a, S> {
CreativeMethods { hub: &self }
}
pub fn direct_deals(&'a self) -> DirectDealMethods<'a, S> {
DirectDealMethods { hub: &self }
}
pub fn performance_report(&'a self) -> PerformanceReportMethods<'a, S> {
PerformanceReportMethods { hub: &self }
}
pub fn pretargeting_config(&'a self) -> PretargetingConfigMethods<'a, S> {
PretargetingConfigMethods { 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.3`.
///
/// 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://www.googleapis.com/adexchangebuyer/v1.3/`.
///
/// 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://www.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)
}
}

View File

@@ -0,0 +1,666 @@
use super::*;
/// A builder providing access to all methods supported on *account* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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(...)`, `list(...)`, `patch(...)` and `update(...)`
/// // to build up your call.
/// let rb = hub.accounts();
/// # }
/// ```
pub struct AccountMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for AccountMethods<'a, S> {}
impl<'a, S> AccountMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets one account by ID.
///
/// # Arguments
///
/// * `id` - The account id
pub fn get(&self, id: i32) -> AccountGetCall<'a, S> {
AccountGetCall {
hub: self.hub,
_id: id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the authenticated user's list of accounts.
pub fn list(&self) -> AccountListCall<'a, S> {
AccountListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an existing account. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `id` - The account id
pub fn patch(&self, request: Account, id: i32) -> AccountPatchCall<'a, S> {
AccountPatchCall {
hub: self.hub,
_request: request,
_id: id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an existing account.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `id` - The account id
pub fn update(&self, request: Account, id: i32) -> AccountUpdateCall<'a, S> {
AccountUpdateCall {
hub: self.hub,
_request: request,
_id: id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *billingInfo* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.billing_info();
/// # }
/// ```
pub struct BillingInfoMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for BillingInfoMethods<'a, S> {}
impl<'a, S> BillingInfoMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns the billing information for one account specified by account ID.
///
/// # Arguments
///
/// * `accountId` - The account id.
pub fn get(&self, account_id: i32) -> BillingInfoGetCall<'a, S> {
BillingInfoGetCall {
hub: self.hub,
_account_id: account_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves a list of billing information for all accounts of the authenticated user.
pub fn list(&self) -> BillingInfoListCall<'a, S> {
BillingInfoListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *budget* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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(...)`, `patch(...)` and `update(...)`
/// // to build up your call.
/// let rb = hub.budget();
/// # }
/// ```
pub struct BudgetMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for BudgetMethods<'a, S> {}
impl<'a, S> BudgetMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns the budget information for the adgroup specified by the accountId and billingId.
///
/// # Arguments
///
/// * `accountId` - The account id to get the budget information for.
/// * `billingId` - The billing id to get the budget information for.
pub fn get(&self, account_id: i64, billing_id: i64) -> BudgetGetCall<'a, S> {
BudgetGetCall {
hub: self.hub,
_account_id: account_id,
_billing_id: billing_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - The account id associated with the budget being updated.
/// * `billingId` - The billing id associated with the budget being updated.
pub fn patch(&self, request: Budget, account_id: i64, billing_id: i64) -> BudgetPatchCall<'a, S> {
BudgetPatchCall {
hub: self.hub,
_request: request,
_account_id: account_id,
_billing_id: billing_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the budget amount for the budget of the adgroup specified by the accountId and billingId, with the budget amount in the request.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - The account id associated with the budget being updated.
/// * `billingId` - The billing id associated with the budget being updated.
pub fn update(&self, request: Budget, account_id: i64, billing_id: i64) -> BudgetUpdateCall<'a, S> {
BudgetUpdateCall {
hub: self.hub,
_request: request,
_account_id: account_id,
_billing_id: billing_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *creative* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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(...)`, `insert(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.creatives();
/// # }
/// ```
pub struct CreativeMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for CreativeMethods<'a, S> {}
impl<'a, S> CreativeMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets the status for a single creative. A creative will be available 30-40 minutes after submission.
///
/// # Arguments
///
/// * `accountId` - The id for the account that will serve this creative.
/// * `buyerCreativeId` - The buyer-specific id for this creative.
pub fn get(&self, account_id: i32, buyer_creative_id: &str) -> CreativeGetCall<'a, S> {
CreativeGetCall {
hub: self.hub,
_account_id: account_id,
_buyer_creative_id: buyer_creative_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Submit a new creative.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn insert(&self, request: Creative) -> CreativeInsertCall<'a, S> {
CreativeInsertCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves a list of the authenticated user's active creatives. A creative will be available 30-40 minutes after submission.
pub fn list(&self) -> CreativeListCall<'a, S> {
CreativeListCall {
hub: self.hub,
_status_filter: Default::default(),
_page_token: Default::default(),
_max_results: Default::default(),
_buyer_creative_id: Default::default(),
_account_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *directDeal* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.direct_deals();
/// # }
/// ```
pub struct DirectDealMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for DirectDealMethods<'a, S> {}
impl<'a, S> DirectDealMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Gets one direct deal by ID.
///
/// # Arguments
///
/// * `id` - The direct deal id
pub fn get(&self, id: i64) -> DirectDealGetCall<'a, S> {
DirectDealGetCall {
hub: self.hub,
_id: id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the authenticated user's list of direct deals.
pub fn list(&self) -> DirectDealListCall<'a, S> {
DirectDealListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *performanceReport* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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.performance_report();
/// # }
/// ```
pub struct PerformanceReportMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for PerformanceReportMethods<'a, S> {}
impl<'a, S> PerformanceReportMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Retrieves the authenticated user's list of performance metrics.
///
/// # Arguments
///
/// * `accountId` - The account id to get the reports.
/// * `endDateTime` - The end time of the report in ISO 8601 timestamp format using UTC.
/// * `startDateTime` - The start time of the report in ISO 8601 timestamp format using UTC.
pub fn list(&self, account_id: i64, end_date_time: &str, start_date_time: &str) -> PerformanceReportListCall<'a, S> {
PerformanceReportListCall {
hub: self.hub,
_account_id: account_id,
_end_date_time: end_date_time.to_string(),
_start_date_time: start_date_time.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *pretargetingConfig* resources.
/// It is not used directly, but through the [`AdExchangeBuyer`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangebuyer1d3 as adexchangebuyer1d3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangebuyer1d3::{AdExchangeBuyer, 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 = AdExchangeBuyer::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 `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
/// // to build up your call.
/// let rb = hub.pretargeting_config();
/// # }
/// ```
pub struct PretargetingConfigMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeBuyer<S>,
}
impl<'a, S> client::MethodsBuilder for PretargetingConfigMethods<'a, S> {}
impl<'a, S> PretargetingConfigMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Deletes an existing pretargeting config.
///
/// # Arguments
///
/// * `accountId` - The account id to delete the pretargeting config for.
/// * `configId` - The specific id of the configuration to delete.
pub fn delete(&self, account_id: i64, config_id: i64) -> PretargetingConfigDeleteCall<'a, S> {
PretargetingConfigDeleteCall {
hub: self.hub,
_account_id: account_id,
_config_id: config_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets a specific pretargeting configuration
///
/// # Arguments
///
/// * `accountId` - The account id to get the pretargeting config for.
/// * `configId` - The specific id of the configuration to retrieve.
pub fn get(&self, account_id: i64, config_id: i64) -> PretargetingConfigGetCall<'a, S> {
PretargetingConfigGetCall {
hub: self.hub,
_account_id: account_id,
_config_id: config_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Inserts a new pretargeting configuration.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - The account id to insert the pretargeting config for.
pub fn insert(&self, request: PretargetingConfig, account_id: i64) -> PretargetingConfigInsertCall<'a, S> {
PretargetingConfigInsertCall {
hub: self.hub,
_request: request,
_account_id: account_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves a list of the authenticated user's pretargeting configurations.
///
/// # Arguments
///
/// * `accountId` - The account id to get the pretargeting configs for.
pub fn list(&self, account_id: i64) -> PretargetingConfigListCall<'a, S> {
PretargetingConfigListCall {
hub: self.hub,
_account_id: account_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an existing pretargeting config. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - The account id to update the pretargeting config for.
/// * `configId` - The specific id of the configuration to update.
pub fn patch(&self, request: PretargetingConfig, account_id: i64, config_id: i64) -> PretargetingConfigPatchCall<'a, S> {
PretargetingConfigPatchCall {
hub: self.hub,
_request: request,
_account_id: account_id,
_config_id: config_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an existing pretargeting config.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - The account id to update the pretargeting config for.
/// * `configId` - The specific id of the configuration to update.
pub fn update(&self, request: PretargetingConfig, account_id: i64, config_id: i64) -> PretargetingConfigUpdateCall<'a, S> {
PretargetingConfigUpdateCall {
hub: self.hub,
_request: request,
_account_id: account_id,
_config_id: config_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,989 @@
use super::*;
/// Configuration data for an Ad Exchange buyer account.
///
/// # 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 accounts](AccountGetCall) (response)
/// * [list accounts](AccountListCall) (none)
/// * [patch accounts](AccountPatchCall) (request|response)
/// * [update accounts](AccountUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Account {
/// Your bidder locations that have distinct URLs.
#[serde(rename="bidderLocation")]
pub bidder_location: Option<Vec<AccountBidderLocation>>,
/// The nid parameter value used in cookie match requests. Please contact your technical account manager if you need to change this.
#[serde(rename="cookieMatchingNid")]
pub cookie_matching_nid: Option<String>,
/// The base URL used in cookie match requests.
#[serde(rename="cookieMatchingUrl")]
pub cookie_matching_url: Option<String>,
/// Account id.
pub id: Option<i32>,
/// Resource type.
pub kind: Option<String>,
/// The maximum number of active creatives that an account can have, where a creative is active if it was inserted or bid with in the last 30 days. Please contact your technical account manager if you need to change this.
#[serde(rename="maximumActiveCreatives")]
pub maximum_active_creatives: Option<i32>,
/// The sum of all bidderLocation.maximumQps values cannot exceed this. Please contact your technical account manager if you need to change this.
#[serde(rename="maximumTotalQps")]
pub maximum_total_qps: Option<i32>,
/// The number of creatives that this account inserted or bid with in the last 30 days.
#[serde(rename="numberActiveCreatives")]
pub number_active_creatives: Option<i32>,
}
impl client::RequestValue for Account {}
impl client::Resource for Account {}
impl client::ResponseResult for Account {}
/// An account feed lists Ad Exchange buyer accounts that the user has access to. Each entry in the feed corresponds to a single buyer account.
///
/// # 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 accounts](AccountListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AccountsList {
/// A list of accounts.
pub items: Option<Vec<Account>>,
/// Resource type.
pub kind: Option<String>,
}
impl client::ResponseResult for AccountsList {}
/// The configuration data for an Ad Exchange billing info.
///
/// # 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 billing info](BillingInfoGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BillingInfo {
/// Account id.
#[serde(rename="accountId")]
pub account_id: Option<i32>,
/// Account name.
#[serde(rename="accountName")]
pub account_name: Option<String>,
/// A list of adgroup IDs associated with this particular account. These IDs may show up as part of a realtime bidding BidRequest, which indicates a bid request for this account.
#[serde(rename="billingId")]
pub billing_id: Option<Vec<String>>,
/// Resource type.
pub kind: Option<String>,
}
impl client::ResponseResult for BillingInfo {}
/// A billing info feed lists Billing Info the Ad Exchange buyer account has access to. Each entry in the feed corresponds to a single billing info.
///
/// # 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 billing info](BillingInfoListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BillingInfoList {
/// A list of billing info relevant for your account.
pub items: Option<Vec<BillingInfo>>,
/// Resource type.
pub kind: Option<String>,
}
impl client::ResponseResult for BillingInfoList {}
/// The configuration data for Ad Exchange RTB - Budget API.
///
/// # 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 budget](BudgetGetCall) (response)
/// * [patch budget](BudgetPatchCall) (request|response)
/// * [update budget](BudgetUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Budget {
/// The id of the account. This is required for get and update requests.
#[serde(rename="accountId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub account_id: Option<i64>,
/// The billing id to determine which adgroup to provide budget information for. This is required for get and update requests.
#[serde(rename="billingId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub billing_id: Option<i64>,
/// The daily budget amount in unit amount of the account currency to apply for the billingId provided. This is required for update requests.
#[serde(rename="budgetAmount")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub budget_amount: Option<i64>,
/// The currency code for the buyer. This cannot be altered here.
#[serde(rename="currencyCode")]
pub currency_code: Option<String>,
/// The unique id that describes this item.
pub id: Option<String>,
/// The kind of the resource, i.e. "adexchangebuyer#budget".
pub kind: Option<String>,
}
impl client::RequestValue for Budget {}
impl client::ResponseResult for Budget {}
/// A creative and its classification data.
///
/// # 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 creatives](CreativeGetCall) (response)
/// * [insert creatives](CreativeInsertCall) (request|response)
/// * [list creatives](CreativeListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Creative {
/// The HTML snippet that displays the ad when inserted in the web page. If set, videoURL should not be set.
#[serde(rename="HTMLSnippet")]
pub html_snippet: Option<String>,
/// Account id.
#[serde(rename="accountId")]
pub account_id: Option<i32>,
/// no description provided
#[serde(rename="adTechnologyProviders")]
pub ad_technology_providers: Option<CreativeAdTechnologyProviders>,
/// Detected advertiser id, if any. Read-only. This field should not be set in requests.
#[serde(rename="advertiserId")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub advertiser_id: Option<Vec<i64>>,
/// The name of the company being advertised in the creative.
#[serde(rename="advertiserName")]
pub advertiser_name: Option<String>,
/// The agency id for this creative.
#[serde(rename="agencyId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub agency_id: Option<i64>,
/// The last upload timestamp of this creative if it was uploaded via API. Read-only. The value of this field is generated, and will be ignored for uploads. (formatted RFC 3339 timestamp).
#[serde(rename="apiUploadTimestamp")]
pub api_upload_timestamp: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// All attributes for the ads that may be shown from this snippet.
pub attribute: Option<Vec<i32>>,
/// A buyer-specific id identifying the creative in this ad.
#[serde(rename="buyerCreativeId")]
pub buyer_creative_id: Option<String>,
/// The set of destination urls for the snippet.
#[serde(rename="clickThroughUrl")]
pub click_through_url: Option<Vec<String>>,
/// Shows any corrections that were applied to this creative. Read-only. This field should not be set in requests.
pub corrections: Option<Vec<CreativeCorrections>>,
/// The reasons for disapproval, if any. Note that not all disapproval reasons may be categorized, so it is possible for the creative to have a status of DISAPPROVED with an empty list for disapproval_reasons. In this case, please reach out to your TAM to help debug the issue. Read-only. This field should not be set in requests.
#[serde(rename="disapprovalReasons")]
pub disapproval_reasons: Option<Vec<CreativeDisapprovalReasons>>,
/// The filtering reasons for the creative. Read-only. This field should not be set in requests.
#[serde(rename="filteringReasons")]
pub filtering_reasons: Option<CreativeFilteringReasons>,
/// Ad height.
pub height: Option<i32>,
/// The set of urls to be called to record an impression.
#[serde(rename="impressionTrackingUrl")]
pub impression_tracking_url: Option<Vec<String>>,
/// Resource type.
pub kind: Option<String>,
/// If nativeAd is set, HTMLSnippet and videoURL should not be set.
#[serde(rename="nativeAd")]
pub native_ad: Option<CreativeNativeAd>,
/// Detected product categories, if any. Read-only. This field should not be set in requests.
#[serde(rename="productCategories")]
pub product_categories: Option<Vec<i32>>,
/// All restricted categories for the ads that may be shown from this snippet.
#[serde(rename="restrictedCategories")]
pub restricted_categories: Option<Vec<i32>>,
/// Detected sensitive categories, if any. Read-only. This field should not be set in requests.
#[serde(rename="sensitiveCategories")]
pub sensitive_categories: Option<Vec<i32>>,
/// Creative serving status. Read-only. This field should not be set in requests.
pub status: Option<String>,
/// All vendor types for the ads that may be shown from this snippet.
#[serde(rename="vendorType")]
pub vendor_type: Option<Vec<i32>>,
/// The version for this creative. Read-only. This field should not be set in requests.
pub version: Option<i32>,
/// The URL to fetch a video ad. If set, HTMLSnippet and the nativeAd should not be set.
#[serde(rename="videoURL")]
pub video_url: Option<String>,
/// Ad width.
pub width: Option<i32>,
}
impl client::RequestValue for Creative {}
impl client::Resource for Creative {}
impl client::ResponseResult for Creative {}
/// The creatives feed lists the active creatives for the Ad Exchange buyer accounts that the user has access to. Each entry in the feed corresponds to a single creative.
///
/// # 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 creatives](CreativeListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CreativesList {
/// A list of creatives.
pub items: Option<Vec<Creative>>,
/// Resource type.
pub kind: Option<String>,
/// Continuation token used to page through creatives. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for CreativesList {}
/// The configuration data for an Ad Exchange direct deal.
///
/// # 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 direct deals](DirectDealGetCall) (response)
/// * [list direct deals](DirectDealListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DirectDeal {
/// The account id of the buyer this deal is for.
#[serde(rename="accountId")]
pub account_id: Option<i32>,
/// The name of the advertiser this deal is for.
pub advertiser: Option<String>,
/// Whether the publisher for this deal is eligible for alcohol ads.
#[serde(rename="allowsAlcohol")]
pub allows_alcohol: Option<bool>,
/// The account id that this deal was negotiated for. It is either the buyer or the client that this deal was negotiated on behalf of.
#[serde(rename="buyerAccountId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub buyer_account_id: Option<i64>,
/// The currency code that applies to the fixed_cpm value. If not set then assumed to be USD.
#[serde(rename="currencyCode")]
pub currency_code: Option<String>,
/// The deal type such as programmatic reservation or fixed price and so on.
#[serde(rename="dealTier")]
pub deal_tier: Option<String>,
/// End time for when this deal stops being active. If not set then this deal is valid until manually disabled by the publisher. In seconds since the epoch.
#[serde(rename="endTime")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub end_time: Option<i64>,
/// The fixed price for this direct deal. In cpm micros of currency according to currency_code. If set, then this deal is eligible for the fixed price tier of buying (highest priority, pay exactly the configured fixed price).
#[serde(rename="fixedCpm")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub fixed_cpm: Option<i64>,
/// Deal id.
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub id: Option<i64>,
/// Resource type.
pub kind: Option<String>,
/// Deal name.
pub name: Option<String>,
/// The minimum price for this direct deal. In cpm micros of currency according to currency_code. If set, then this deal is eligible for the private exchange tier of buying (below fixed price priority, run as a second price auction).
#[serde(rename="privateExchangeMinCpm")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub private_exchange_min_cpm: Option<i64>,
/// If true, the publisher has opted to have their blocks ignored when a creative is bid with for this deal.
#[serde(rename="publisherBlocksOverriden")]
pub publisher_blocks_overriden: Option<bool>,
/// The name of the publisher offering this direct deal.
#[serde(rename="sellerNetwork")]
pub seller_network: Option<String>,
/// Start time for when this deal becomes active. If not set then this deal is active immediately upon creation. In seconds since the epoch.
#[serde(rename="startTime")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub start_time: Option<i64>,
}
impl client::Resource for DirectDeal {}
impl client::ResponseResult for DirectDeal {}
/// A direct deals feed lists Direct Deals the Ad Exchange buyer account has access to. This includes direct deals set up for the buyer account as well as its merged stream seats.
///
/// # 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 direct deals](DirectDealListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct DirectDealsList {
/// A list of direct deals relevant for your account.
#[serde(rename="directDeals")]
pub direct_deals: Option<Vec<DirectDeal>>,
/// Resource type.
pub kind: Option<String>,
}
impl client::ResponseResult for DirectDealsList {}
/// The configuration data for an Ad Exchange performance report list.
///
/// 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 PerformanceReport {
/// The number of bid responses with an ad.
#[serde(rename="bidRate")]
pub bid_rate: Option<f64>,
/// The number of bid requests sent to your bidder.
#[serde(rename="bidRequestRate")]
pub bid_request_rate: Option<f64>,
/// Rate of various prefiltering statuses per match. Please refer to the callout-status-codes.txt file for different statuses.
#[serde(rename="calloutStatusRate")]
pub callout_status_rate: Option<Vec<json::Value>>,
/// Average QPS for cookie matcher operations.
#[serde(rename="cookieMatcherStatusRate")]
pub cookie_matcher_status_rate: Option<Vec<json::Value>>,
/// Rate of ads with a given status. Please refer to the creative-status-codes.txt file for different statuses.
#[serde(rename="creativeStatusRate")]
pub creative_status_rate: Option<Vec<json::Value>>,
/// The number of bid responses that were filtered due to a policy violation or other errors.
#[serde(rename="filteredBidRate")]
pub filtered_bid_rate: Option<f64>,
/// Average QPS for hosted match operations.
#[serde(rename="hostedMatchStatusRate")]
pub hosted_match_status_rate: Option<Vec<json::Value>>,
/// The number of potential queries based on your pretargeting settings.
#[serde(rename="inventoryMatchRate")]
pub inventory_match_rate: Option<f64>,
/// Resource type.
pub kind: Option<String>,
/// The 50th percentile round trip latency(ms) as perceived from Google servers for the duration period covered by the report.
#[serde(rename="latency50thPercentile")]
pub latency50th_percentile: Option<f64>,
/// The 85th percentile round trip latency(ms) as perceived from Google servers for the duration period covered by the report.
#[serde(rename="latency85thPercentile")]
pub latency85th_percentile: Option<f64>,
/// The 95th percentile round trip latency(ms) as perceived from Google servers for the duration period covered by the report.
#[serde(rename="latency95thPercentile")]
pub latency95th_percentile: Option<f64>,
/// Rate of various quota account statuses per quota check.
#[serde(rename="noQuotaInRegion")]
pub no_quota_in_region: Option<f64>,
/// Rate of various quota account statuses per quota check.
#[serde(rename="outOfQuota")]
pub out_of_quota: Option<f64>,
/// Average QPS for pixel match requests from clients.
#[serde(rename="pixelMatchRequests")]
pub pixel_match_requests: Option<f64>,
/// Average QPS for pixel match responses from clients.
#[serde(rename="pixelMatchResponses")]
pub pixel_match_responses: Option<f64>,
/// The configured quota limits for this account.
#[serde(rename="quotaConfiguredLimit")]
pub quota_configured_limit: Option<f64>,
/// The throttled quota limits for this account.
#[serde(rename="quotaThrottledLimit")]
pub quota_throttled_limit: Option<f64>,
/// The trading location of this data.
pub region: Option<String>,
/// The number of properly formed bid responses received by our servers within the deadline.
#[serde(rename="successfulRequestRate")]
pub successful_request_rate: Option<f64>,
/// The unix timestamp of the starting time of this performance data.
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub timestamp: Option<i64>,
/// The number of bid responses that were unsuccessful due to timeouts, incorrect formatting, etc.
#[serde(rename="unsuccessfulRequestRate")]
pub unsuccessful_request_rate: Option<f64>,
}
impl client::Part for PerformanceReport {}
/// The configuration data for an Ad Exchange performance report list.
///
/// # 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 performance report](PerformanceReportListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PerformanceReportList {
/// Resource type.
pub kind: Option<String>,
/// A list of performance reports relevant for the account.
#[serde(rename="performanceReport")]
pub performance_report: Option<Vec<PerformanceReport>>,
}
impl client::ResponseResult for PerformanceReportList {}
/// There is no detailed description.
///
/// # 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 pretargeting config](PretargetingConfigGetCall) (response)
/// * [insert pretargeting config](PretargetingConfigInsertCall) (request|response)
/// * [patch pretargeting config](PretargetingConfigPatchCall) (request|response)
/// * [update pretargeting config](PretargetingConfigUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PretargetingConfig {
/// The id for billing purposes, provided for reference. Leave this field blank for insert requests; the id will be generated automatically.
#[serde(rename="billingId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub billing_id: Option<i64>,
/// The config id; generated automatically. Leave this field blank for insert requests.
#[serde(rename="configId")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub config_id: Option<i64>,
/// The name of the config. Must be unique. Required for all requests.
#[serde(rename="configName")]
pub config_name: Option<String>,
/// List must contain exactly one of PRETARGETING_CREATIVE_TYPE_HTML or PRETARGETING_CREATIVE_TYPE_VIDEO.
#[serde(rename="creativeType")]
pub creative_type: Option<Vec<String>>,
/// Requests which allow one of these (width, height) pairs will match. All pairs must be supported ad dimensions.
pub dimensions: Option<Vec<PretargetingConfigDimensions>>,
/// Requests with any of these content labels will not match. Values are from content-labels.txt in the downloadable files section.
#[serde(rename="excludedContentLabels")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub excluded_content_labels: Option<Vec<i64>>,
/// Requests containing any of these geo criteria ids will not match.
#[serde(rename="excludedGeoCriteriaIds")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub excluded_geo_criteria_ids: Option<Vec<i64>>,
/// Requests containing any of these placements will not match.
#[serde(rename="excludedPlacements")]
pub excluded_placements: Option<Vec<PretargetingConfigExcludedPlacements>>,
/// Requests containing any of these users list ids will not match.
#[serde(rename="excludedUserLists")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub excluded_user_lists: Option<Vec<i64>>,
/// Requests containing any of these vertical ids will not match. Values are from the publisher-verticals.txt file in the downloadable files section.
#[serde(rename="excludedVerticals")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub excluded_verticals: Option<Vec<i64>>,
/// Requests containing any of these geo criteria ids will match.
#[serde(rename="geoCriteriaIds")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub geo_criteria_ids: Option<Vec<i64>>,
/// Whether this config is active. Required for all requests.
#[serde(rename="isActive")]
pub is_active: Option<bool>,
/// The kind of the resource, i.e. "adexchangebuyer#pretargetingConfig".
pub kind: Option<String>,
/// Request containing any of these language codes will match.
pub languages: Option<Vec<String>>,
/// The maximum QPS allocated to this pretargeting configuration, used for pretargeting-level QPS limits. By default, this is not set, which indicates that there is no QPS limit at the configuration level (a global or account-level limit may still be imposed).
#[serde(rename="maximumQps")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub maximum_qps: Option<i64>,
/// Requests containing any of these mobile carrier ids will match. Values are from mobile-carriers.csv in the downloadable files section.
#[serde(rename="mobileCarriers")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub mobile_carriers: Option<Vec<i64>>,
/// Requests containing any of these mobile device ids will match. Values are from mobile-devices.csv in the downloadable files section.
#[serde(rename="mobileDevices")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub mobile_devices: Option<Vec<i64>>,
/// Requests containing any of these mobile operating system version ids will match. Values are from mobile-os.csv in the downloadable files section.
#[serde(rename="mobileOperatingSystemVersions")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub mobile_operating_system_versions: Option<Vec<i64>>,
/// Requests containing any of these placements will match.
pub placements: Option<Vec<PretargetingConfigPlacements>>,
/// Requests matching any of these platforms will match. Possible values are PRETARGETING_PLATFORM_MOBILE, PRETARGETING_PLATFORM_DESKTOP, and PRETARGETING_PLATFORM_TABLET.
pub platforms: Option<Vec<String>>,
/// Creative attributes should be declared here if all creatives corresponding to this pretargeting configuration have that creative attribute. Values are from pretargetable-creative-attributes.txt in the downloadable files section.
#[serde(rename="supportedCreativeAttributes")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub supported_creative_attributes: Option<Vec<i64>>,
/// Requests containing any of these user list ids will match.
#[serde(rename="userLists")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub user_lists: Option<Vec<i64>>,
/// Requests that allow any of these vendor ids will match. Values are from vendors.txt in the downloadable files section.
#[serde(rename="vendorTypes")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub vendor_types: Option<Vec<i64>>,
/// Requests containing any of these vertical ids will match.
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub verticals: Option<Vec<i64>>,
}
impl client::RequestValue for PretargetingConfig {}
impl client::ResponseResult for PretargetingConfig {}
/// There is no detailed description.
///
/// # 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 pretargeting config](PretargetingConfigListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PretargetingConfigList {
/// A list of pretargeting configs
pub items: Option<Vec<PretargetingConfig>>,
/// Resource type.
pub kind: Option<String>,
}
impl client::ResponseResult for PretargetingConfigList {}
/// Your bidder locations that have distinct URLs.
///
/// 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 AccountBidderLocation {
/// The maximum queries per second the Ad Exchange will send.
#[serde(rename="maximumQps")]
pub maximum_qps: Option<i32>,
/// The geographical region the Ad Exchange should send requests from. Only used by some quota systems, but always setting the value is recommended. Allowed values:
/// - ASIA
/// - EUROPE
/// - US_EAST
/// - US_WEST
pub region: Option<String>,
/// The URL to which the Ad Exchange will send bid requests.
pub url: Option<String>,
}
impl client::NestedType for AccountBidderLocation {}
impl client::Part for AccountBidderLocation {}
/// There is no detailed description.
///
/// 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 CreativeAdTechnologyProviders {
/// The detected ad technology provider IDs for this creative. See https://storage.googleapis.com/adx-rtb-dictionaries/providers.csv for mapping of provider ID to provided name, a privacy policy URL, and a list of domains which can be attributed to the provider. If this creative contains provider IDs that are outside of those listed in the `BidRequest.adslot.consented_providers_settings.consented_providers` field on the Authorized Buyers Real-Time Bidding protocol or the `BidRequest.user.ext.consented_providers_settings.consented_providers` field on the OpenRTB protocol, a bid submitted for a European Economic Area (EEA) user with this creative is not compliant with the GDPR policies as mentioned in the "Third-party Ad Technology Vendors" section of Authorized Buyers Program Guidelines.
#[serde(rename="detectedProviderIds")]
#[serde_as(as = "Option<Vec<::client::serde_with::DisplayFromStr>>")]
pub detected_provider_ids: Option<Vec<i64>>,
/// Whether the creative contains an unidentified ad technology provider. If true, a bid submitted for a European Economic Area (EEA) user with this creative is not compliant with the GDPR policies as mentioned in the "Third-party Ad Technology Vendors" section of Authorized Buyers Program Guidelines.
#[serde(rename="hasUnidentifiedProvider")]
pub has_unidentified_provider: Option<bool>,
}
impl client::NestedType for CreativeAdTechnologyProviders {}
impl client::Part for CreativeAdTechnologyProviders {}
/// Shows any corrections that were applied to this creative. Read-only. This field should not be set in requests.
///
/// 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 CreativeCorrections {
/// Additional details about the correction.
pub details: Option<Vec<String>>,
/// The type of correction that was applied to the creative.
pub reason: Option<String>,
}
impl client::NestedType for CreativeCorrections {}
impl client::Part for CreativeCorrections {}
/// The reasons for disapproval, if any. Note that not all disapproval reasons may be categorized, so it is possible for the creative to have a status of DISAPPROVED with an empty list for disapproval_reasons. In this case, please reach out to your TAM to help debug the issue. Read-only. This field should not be set in requests.
///
/// 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 CreativeDisapprovalReasons {
/// Additional details about the reason for disapproval.
pub details: Option<Vec<String>>,
/// The categorized reason for disapproval.
pub reason: Option<String>,
}
impl client::NestedType for CreativeDisapprovalReasons {}
impl client::Part for CreativeDisapprovalReasons {}
/// The filtering reasons for the creative. Read-only. This field should not be set in requests.
///
/// 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 CreativeFilteringReasons {
/// The date in ISO 8601 format for the data. The data is collected from 00:00:00 to 23:59:59 in PST.
pub date: Option<String>,
/// The filtering reasons.
pub reasons: Option<Vec<CreativeFilteringReasonsReasons>>,
}
impl client::NestedType for CreativeFilteringReasons {}
impl client::Part for CreativeFilteringReasons {}
/// The filtering reasons.
///
/// 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 CreativeFilteringReasonsReasons {
/// The number of times the creative was filtered for the status. The count is aggregated across all publishers on the exchange.
#[serde(rename="filteringCount")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub filtering_count: Option<i64>,
/// The filtering status code. Please refer to the creative-status-codes.txt file for different statuses.
#[serde(rename="filteringStatus")]
pub filtering_status: Option<i32>,
}
impl client::NestedType for CreativeFilteringReasonsReasons {}
impl client::Part for CreativeFilteringReasonsReasons {}
/// If nativeAd is set, HTMLSnippet and videoURL should not be set.
///
/// 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 CreativeNativeAd {
/// no description provided
pub advertiser: Option<String>,
/// The app icon, for app download ads.
#[serde(rename="appIcon")]
pub app_icon: Option<CreativeNativeAdAppIcon>,
/// A long description of the ad.
pub body: Option<String>,
/// A label for the button that the user is supposed to click.
#[serde(rename="callToAction")]
pub call_to_action: Option<String>,
/// The URL to use for click tracking.
#[serde(rename="clickTrackingUrl")]
pub click_tracking_url: Option<String>,
/// A short title for the ad.
pub headline: Option<String>,
/// A large image.
pub image: Option<CreativeNativeAdImage>,
/// The URLs are called when the impression is rendered.
#[serde(rename="impressionTrackingUrl")]
pub impression_tracking_url: Option<Vec<String>>,
/// A smaller image, for the advertiser logo.
pub logo: Option<CreativeNativeAdLogo>,
/// The price of the promoted app including the currency info.
pub price: Option<String>,
/// The app rating in the app store. Must be in the range [0-5].
#[serde(rename="starRating")]
pub star_rating: Option<f64>,
}
impl client::NestedType for CreativeNativeAd {}
impl client::Part for CreativeNativeAd {}
/// The app icon, for app download ads.
///
/// 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 CreativeNativeAdAppIcon {
/// no description provided
pub height: Option<i32>,
/// no description provided
pub url: Option<String>,
/// no description provided
pub width: Option<i32>,
}
impl client::NestedType for CreativeNativeAdAppIcon {}
impl client::Part for CreativeNativeAdAppIcon {}
/// A large image.
///
/// 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 CreativeNativeAdImage {
/// no description provided
pub height: Option<i32>,
/// no description provided
pub url: Option<String>,
/// no description provided
pub width: Option<i32>,
}
impl client::NestedType for CreativeNativeAdImage {}
impl client::Part for CreativeNativeAdImage {}
/// A smaller image, for the advertiser logo.
///
/// 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 CreativeNativeAdLogo {
/// no description provided
pub height: Option<i32>,
/// no description provided
pub url: Option<String>,
/// no description provided
pub width: Option<i32>,
}
impl client::NestedType for CreativeNativeAdLogo {}
impl client::Part for CreativeNativeAdLogo {}
/// Requests which allow one of these (width, height) pairs will match. All pairs must be supported ad dimensions.
///
/// 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 PretargetingConfigDimensions {
/// Height in pixels.
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub height: Option<i64>,
/// Width in pixels.
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub width: Option<i64>,
}
impl client::NestedType for PretargetingConfigDimensions {}
impl client::Part for PretargetingConfigDimensions {}
/// Requests containing any of these placements will not match.
///
/// 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 PretargetingConfigExcludedPlacements {
/// The value of the placement. Interpretation depends on the placement type, e.g. URL for a site placement, channel name for a channel placement, app id for a mobile app placement.
pub token: Option<String>,
/// The type of the placement.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for PretargetingConfigExcludedPlacements {}
impl client::Part for PretargetingConfigExcludedPlacements {}
/// Requests containing any of these placements will match.
///
/// 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 PretargetingConfigPlacements {
/// The value of the placement. Interpretation depends on the placement type, e.g. URL for a site placement, channel name for a channel placement, app id for a mobile app placement.
pub token: Option<String>,
/// The type of the placement.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for PretargetingConfigPlacements {}
impl client::Part for PretargetingConfigPlacements {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// Manage your Ad Exchange buyer account configuration
AdexchangeBuyer,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AdexchangeBuyer => "https://www.googleapis.com/auth/adexchange.buyer",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AdexchangeBuyer
}
}

View File

@@ -0,0 +1,145 @@
use super::*;
/// Central instance to access all AdExchangeBuyer related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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("ipsum")
/// .open_auction_status_filter("gubergren")
/// .max_results(50)
/// .deals_status_filter("gubergren")
/// .add_buyer_creative_id("eos")
/// .add_account_id(-4)
/// .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 AdExchangeBuyer<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdExchangeBuyer<S> {}
impl<'a, S> AdExchangeBuyer<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdExchangeBuyer<S> {
AdExchangeBuyer {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://www.googleapis.com/adexchangebuyer/v1.4/".to_string(),
_root_url: "https://www.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { hub: &self }
}
pub fn billing_info(&'a self) -> BillingInfoMethods<'a, S> {
BillingInfoMethods { hub: &self }
}
pub fn budget(&'a self) -> BudgetMethods<'a, S> {
BudgetMethods { hub: &self }
}
pub fn creatives(&'a self) -> CreativeMethods<'a, S> {
CreativeMethods { hub: &self }
}
pub fn marketplacedeals(&'a self) -> MarketplacedealMethods<'a, S> {
MarketplacedealMethods { hub: &self }
}
pub fn marketplacenotes(&'a self) -> MarketplacenoteMethods<'a, S> {
MarketplacenoteMethods { hub: &self }
}
pub fn marketplaceprivateauction(&'a self) -> MarketplaceprivateauctionMethods<'a, S> {
MarketplaceprivateauctionMethods { hub: &self }
}
pub fn performance_report(&'a self) -> PerformanceReportMethods<'a, S> {
PerformanceReportMethods { hub: &self }
}
pub fn pretargeting_config(&'a self) -> PretargetingConfigMethods<'a, S> {
PretargetingConfigMethods { hub: &self }
}
pub fn products(&'a self) -> ProductMethods<'a, S> {
ProductMethods { hub: &self }
}
pub fn proposals(&'a self) -> ProposalMethods<'a, S> {
ProposalMethods { hub: &self }
}
pub fn pubprofiles(&'a self) -> PubprofileMethods<'a, S> {
PubprofileMethods { 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.3`.
///
/// 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://www.googleapis.com/adexchangebuyer/v1.4/`.
///
/// 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://www.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)
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// Manage your Ad Exchange buyer account configuration
AdexchangeBuyer,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AdexchangeBuyer => "https://www.googleapis.com/auth/adexchange.buyer",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AdexchangeBuyer
}
}

View File

@@ -0,0 +1,115 @@
use super::*;
/// Central instance to access all AdExchangeBuyerII related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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::api::PauseProposalDealsRequest;
/// 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);
/// // 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 = PauseProposalDealsRequest::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.accounts().finalized_proposals_pause(req, "accountId", "proposalId")
/// .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 AdExchangeBuyerII<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdExchangeBuyerII<S> {}
impl<'a, S> AdExchangeBuyerII<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdExchangeBuyerII<S> {
AdExchangeBuyerII {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://adexchangebuyer.googleapis.com/".to_string(),
_root_url: "https://adexchangebuyer.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { hub: &self }
}
pub fn bidders(&'a self) -> BidderMethods<'a, S> {
BidderMethods { 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.3`.
///
/// 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://adexchangebuyer.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://adexchangebuyer.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)
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// Manage your Ad Exchange buyer account configuration
AdexchangeBuyer,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AdexchangeBuyer => "https://www.googleapis.com/auth/adexchange.buyer",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AdexchangeBuyer
}
}

View File

@@ -0,0 +1,113 @@
use super::*;
/// Central instance to access all AdExchangeSeller related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```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(51)
/// .add_sort("sed")
/// .add_metric("ut")
/// .max_results(89)
/// .locale("rebum.")
/// .add_filter("est")
/// .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),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AdExchangeSeller<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdExchangeSeller<S> {}
impl<'a, S> AdExchangeSeller<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdExchangeSeller<S> {
AdExchangeSeller {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://www.googleapis.com/adexchangeseller/v2.0/".to_string(),
_root_url: "https://www.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { 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.3`.
///
/// 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://www.googleapis.com/adexchangeseller/v2.0/`.
///
/// 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://www.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)
}
}

View File

@@ -0,0 +1,312 @@
use super::*;
/// A builder providing access to all methods supported on *account* resources.
/// It is not used directly, but through the [`AdExchangeSeller`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexchangeseller2 as adexchangeseller2;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexchangeseller2::{AdExchangeSeller, 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 = AdExchangeSeller::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 `adclients_list(...)`, `alerts_list(...)`, `customchannels_get(...)`, `customchannels_list(...)`, `get(...)`, `list(...)`, `metadata_dimensions_list(...)`, `metadata_metrics_list(...)`, `preferreddeals_get(...)`, `preferreddeals_list(...)`, `reports_generate(...)`, `reports_saved_generate(...)`, `reports_saved_list(...)` and `urlchannels_list(...)`
/// // to build up your call.
/// let rb = hub.accounts();
/// # }
/// ```
pub struct AccountMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdExchangeSeller<S>,
}
impl<'a, S> client::MethodsBuilder for AccountMethods<'a, S> {}
impl<'a, S> AccountMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// List all ad clients in this Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account to which the ad client belongs.
pub fn adclients_list(&self, account_id: &str) -> AccountAdclientListCall<'a, S> {
AccountAdclientListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List the alerts for this Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account owning the alerts.
pub fn alerts_list(&self, account_id: &str) -> AccountAlertListCall<'a, S> {
AccountAlertListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_locale: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get the specified custom channel from the specified ad client.
///
/// # Arguments
///
/// * `accountId` - Account to which the ad client belongs.
/// * `adClientId` - Ad client which contains the custom channel.
/// * `customChannelId` - Custom channel to retrieve.
pub fn customchannels_get(&self, account_id: &str, ad_client_id: &str, custom_channel_id: &str) -> AccountCustomchannelGetCall<'a, S> {
AccountCustomchannelGetCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_custom_channel_id: custom_channel_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all custom channels in the specified ad client for this Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account to which the ad client belongs.
/// * `adClientId` - Ad client for which to list custom channels.
pub fn customchannels_list(&self, account_id: &str, ad_client_id: &str) -> AccountCustomchannelListCall<'a, S> {
AccountCustomchannelListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List the metadata for the dimensions available to this AdExchange account.
///
/// # Arguments
///
/// * `accountId` - Account with visibility to the dimensions.
pub fn metadata_dimensions_list(&self, account_id: &str) -> AccountMetadataDimensionListCall<'a, S> {
AccountMetadataDimensionListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List the metadata for the metrics available to this AdExchange account.
///
/// # Arguments
///
/// * `accountId` - Account with visibility to the metrics.
pub fn metadata_metrics_list(&self, account_id: &str) -> AccountMetadataMetricListCall<'a, S> {
AccountMetadataMetricListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get information about the selected Ad Exchange Preferred Deal.
///
/// # Arguments
///
/// * `accountId` - Account owning the deal.
/// * `dealId` - Preferred deal to get information about.
pub fn preferreddeals_get(&self, account_id: &str, deal_id: &str) -> AccountPreferreddealGetCall<'a, S> {
AccountPreferreddealGetCall {
hub: self.hub,
_account_id: account_id.to_string(),
_deal_id: deal_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List the preferred deals for this Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account owning the deals.
pub fn preferreddeals_list(&self, account_id: &str) -> AccountPreferreddealListCall<'a, S> {
AccountPreferreddealListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generate an Ad Exchange report based on the saved report ID sent in the query parameters.
///
/// # Arguments
///
/// * `accountId` - Account owning the saved report.
/// * `savedReportId` - The saved report to retrieve.
pub fn reports_saved_generate(&self, account_id: &str, saved_report_id: &str) -> AccountReportSavedGenerateCall<'a, S> {
AccountReportSavedGenerateCall {
hub: self.hub,
_account_id: account_id.to_string(),
_saved_report_id: saved_report_id.to_string(),
_start_index: Default::default(),
_max_results: Default::default(),
_locale: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all saved reports in this Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account owning the saved reports.
pub fn reports_saved_list(&self, account_id: &str) -> AccountReportSavedListCall<'a, S> {
AccountReportSavedListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generate an Ad Exchange report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
///
/// # Arguments
///
/// * `accountId` - Account which owns the generated report.
/// * `startDate` - Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
/// * `endDate` - End of the date range to report on in "YYYY-MM-DD" format, inclusive.
pub fn reports_generate(&self, account_id: &str, start_date: &str, end_date: &str) -> AccountReportGenerateCall<'a, S> {
AccountReportGenerateCall {
hub: self.hub,
_account_id: account_id.to_string(),
_start_date: start_date.to_string(),
_end_date: end_date.to_string(),
_start_index: Default::default(),
_sort: Default::default(),
_metric: Default::default(),
_max_results: Default::default(),
_locale: Default::default(),
_filter: Default::default(),
_dimension: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all URL channels in the specified ad client for this Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account to which the ad client belongs.
/// * `adClientId` - Ad client for which to list URL channels.
pub fn urlchannels_list(&self, account_id: &str, ad_client_id: &str) -> AccountUrlchannelListCall<'a, S> {
AccountUrlchannelListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get information about the selected Ad Exchange account.
///
/// # Arguments
///
/// * `accountId` - Account to get information about. Tip: 'myaccount' is a valid ID.
pub fn get(&self, account_id: &str) -> AccountGetCall<'a, S> {
AccountGetCall {
hub: self.hub,
_account_id: account_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all accounts available to this Ad Exchange account.
pub fn list(&self) -> AccountListCall<'a, S> {
AccountListCall {
hub: self.hub,
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,563 @@
use super::*;
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients list accounts](AccountAdclientListCall) (none)
/// * [alerts list accounts](AccountAlertListCall) (none)
/// * [customchannels get accounts](AccountCustomchannelGetCall) (none)
/// * [customchannels list accounts](AccountCustomchannelListCall) (none)
/// * [metadata dimensions list accounts](AccountMetadataDimensionListCall) (none)
/// * [metadata metrics list accounts](AccountMetadataMetricListCall) (none)
/// * [preferreddeals get accounts](AccountPreferreddealGetCall) (none)
/// * [preferreddeals list accounts](AccountPreferreddealListCall) (none)
/// * [reports saved generate accounts](AccountReportSavedGenerateCall) (none)
/// * [reports saved list accounts](AccountReportSavedListCall) (none)
/// * [reports generate accounts](AccountReportGenerateCall) (none)
/// * [urlchannels list accounts](AccountUrlchannelListCall) (none)
/// * [get accounts](AccountGetCall) (response)
/// * [list accounts](AccountListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Account {
/// Unique identifier of this account.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#account.
pub kind: Option<String>,
/// Name of this account.
pub name: Option<String>,
}
impl client::Resource for Account {}
impl client::ResponseResult for Account {}
/// There is no detailed description.
///
/// # 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 accounts](AccountListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Accounts {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The accounts returned in this list response.
pub items: Option<Vec<Account>>,
/// Kind of list this is, in this case adexchangeseller#accounts.
pub kind: Option<String>,
/// Continuation token used to page through accounts. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for Accounts {}
/// There is no detailed description.
///
/// 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 AdClient {
/// Whether this ad client is opted in to ARC.
#[serde(rename="arcOptIn")]
pub arc_opt_in: Option<bool>,
/// Unique identifier of this ad client.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#adClient.
pub kind: Option<String>,
/// This ad client's product code, which corresponds to the PRODUCT_CODE report dimension.
#[serde(rename="productCode")]
pub product_code: Option<String>,
/// Whether this ad client supports being reported on.
#[serde(rename="supportsReporting")]
pub supports_reporting: Option<bool>,
}
impl client::Part for AdClient {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients list accounts](AccountAdclientListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdClients {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The ad clients returned in this list response.
pub items: Option<Vec<AdClient>>,
/// Kind of list this is, in this case adexchangeseller#adClients.
pub kind: Option<String>,
/// Continuation token used to page through ad clients. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for AdClients {}
/// There is no detailed description.
///
/// 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 Alert {
/// Unique identifier of this alert. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#alert.
pub kind: Option<String>,
/// The localized alert message.
pub message: Option<String>,
/// Severity of this alert. Possible values: INFO, WARNING, SEVERE.
pub severity: Option<String>,
/// Type of this alert. Possible values: SELF_HOLD, MIGRATED_TO_BILLING3, ADDRESS_PIN_VERIFICATION, PHONE_PIN_VERIFICATION, CORPORATE_ENTITY, GRAYLISTED_PUBLISHER, API_HOLD.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for Alert {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [alerts list accounts](AccountAlertListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Alerts {
/// The alerts returned in this list response.
pub items: Option<Vec<Alert>>,
/// Kind of list this is, in this case adexchangeseller#alerts.
pub kind: Option<String>,
}
impl client::ResponseResult for Alerts {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [customchannels get accounts](AccountCustomchannelGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannel {
/// Code of this custom channel, not necessarily unique across ad clients.
pub code: Option<String>,
/// Unique identifier of this custom channel. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#customChannel.
pub kind: Option<String>,
/// Name of this custom channel.
pub name: Option<String>,
/// The targeting information of this custom channel, if activated.
#[serde(rename="targetingInfo")]
pub targeting_info: Option<CustomChannelTargetingInfo>,
}
impl client::ResponseResult for CustomChannel {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [customchannels list accounts](AccountCustomchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannels {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The custom channels returned in this list response.
pub items: Option<Vec<CustomChannel>>,
/// Kind of list this is, in this case adexchangeseller#customChannels.
pub kind: Option<String>,
/// Continuation token used to page through custom channels. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for CustomChannels {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [metadata dimensions list accounts](AccountMetadataDimensionListCall) (response)
/// * [metadata metrics list accounts](AccountMetadataMetricListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Metadata {
/// no description provided
pub items: Option<Vec<ReportingMetadataEntry>>,
/// Kind of list this is, in this case adexchangeseller#metadata.
pub kind: Option<String>,
}
impl client::ResponseResult for Metadata {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [preferreddeals get accounts](AccountPreferreddealGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PreferredDeal {
/// The name of the advertiser this deal is for.
#[serde(rename="advertiserName")]
pub advertiser_name: Option<String>,
/// The name of the buyer network this deal is for.
#[serde(rename="buyerNetworkName")]
pub buyer_network_name: Option<String>,
/// The currency code that applies to the fixed_cpm value. If not set then assumed to be USD.
#[serde(rename="currencyCode")]
pub currency_code: Option<String>,
/// Time when this deal stops being active in seconds since the epoch (GMT). If not set then this deal is valid until manually disabled by the publisher.
#[serde(rename="endTime")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub end_time: Option<u64>,
/// The fixed price for this preferred deal. In cpm micros of currency according to currencyCode. If set, then this preferred deal is eligible for the fixed price tier of buying (highest priority, pay exactly the configured fixed price).
#[serde(rename="fixedCpm")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub fixed_cpm: Option<i64>,
/// Unique identifier of this preferred deal.
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub id: Option<i64>,
/// Kind of resource this is, in this case adexchangeseller#preferredDeal.
pub kind: Option<String>,
/// Time when this deal becomes active in seconds since the epoch (GMT). If not set then this deal is active immediately upon creation.
#[serde(rename="startTime")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub start_time: Option<u64>,
}
impl client::ResponseResult for PreferredDeal {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [preferreddeals list accounts](AccountPreferreddealListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PreferredDeals {
/// The preferred deals returned in this list response.
pub items: Option<Vec<PreferredDeal>>,
/// Kind of list this is, in this case adexchangeseller#preferredDeals.
pub kind: Option<String>,
}
impl client::ResponseResult for PreferredDeals {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [reports saved generate accounts](AccountReportSavedGenerateCall) (response)
/// * [reports generate accounts](AccountReportGenerateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Report {
/// The averages of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub averages: Option<Vec<String>>,
/// The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
pub headers: Option<Vec<ReportHeaders>>,
/// Kind this is, in this case adexchangeseller#report.
pub kind: Option<String>,
/// The output rows of the report. Each row is a list of cells; one for each dimension in the request, followed by one for each metric in the request. The dimension cells contain strings, and the metric cells contain numbers.
pub rows: Option<Vec<Vec<String>>>,
/// The total number of rows matched by the report request. Fewer rows may be returned in the response due to being limited by the row count requested or the report row limit.
#[serde(rename="totalMatchedRows")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub total_matched_rows: Option<i64>,
/// The totals of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub totals: Option<Vec<String>>,
/// Any warnings associated with generation of the report.
pub warnings: Option<Vec<String>>,
}
impl client::ResponseResult for Report {}
/// There is no detailed description.
///
/// 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 ReportingMetadataEntry {
/// For metrics this is a list of dimension IDs which the metric is compatible with, for dimensions it is a list of compatibility groups the dimension belongs to.
#[serde(rename="compatibleDimensions")]
pub compatible_dimensions: Option<Vec<String>>,
/// The names of the metrics the dimension or metric this reporting metadata entry describes is compatible with.
#[serde(rename="compatibleMetrics")]
pub compatible_metrics: Option<Vec<String>>,
/// Unique identifier of this reporting metadata entry, corresponding to the name of the appropriate dimension or metric.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#reportingMetadataEntry.
pub kind: Option<String>,
/// The names of the dimensions which the dimension or metric this reporting metadata entry describes requires to also be present in order for the report to be valid. Omitting these will not cause an error or warning, but may result in data which cannot be correctly interpreted.
#[serde(rename="requiredDimensions")]
pub required_dimensions: Option<Vec<String>>,
/// The names of the metrics which the dimension or metric this reporting metadata entry describes requires to also be present in order for the report to be valid. Omitting these will not cause an error or warning, but may result in data which cannot be correctly interpreted.
#[serde(rename="requiredMetrics")]
pub required_metrics: Option<Vec<String>>,
/// The codes of the projects supported by the dimension or metric this reporting metadata entry describes.
#[serde(rename="supportedProducts")]
pub supported_products: Option<Vec<String>>,
}
impl client::Part for ReportingMetadataEntry {}
/// There is no detailed description.
///
/// 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 SavedReport {
/// Unique identifier of this saved report.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#savedReport.
pub kind: Option<String>,
/// This saved report's name.
pub name: Option<String>,
}
impl client::Part for SavedReport {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [reports saved list accounts](AccountReportSavedListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SavedReports {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The saved reports returned in this list response.
pub items: Option<Vec<SavedReport>>,
/// Kind of list this is, in this case adexchangeseller#savedReports.
pub kind: Option<String>,
/// Continuation token used to page through saved reports. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for SavedReports {}
/// There is no detailed description.
///
/// 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 UrlChannel {
/// Unique identifier of this URL channel. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adexchangeseller#urlChannel.
pub kind: Option<String>,
/// URL Pattern of this URL channel. Does not include "http://" or "https://". Example: www.example.com/home
#[serde(rename="urlPattern")]
pub url_pattern: Option<String>,
}
impl client::Part for UrlChannel {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [urlchannels list accounts](AccountUrlchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UrlChannels {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The URL channels returned in this list response.
pub items: Option<Vec<UrlChannel>>,
/// Kind of list this is, in this case adexchangeseller#urlChannels.
pub kind: Option<String>,
/// Continuation token used to page through URL channels. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for UrlChannels {}
/// The targeting information of this custom channel, if activated.
///
/// 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 CustomChannelTargetingInfo {
/// The name used to describe this channel externally.
#[serde(rename="adsAppearOn")]
pub ads_appear_on: Option<String>,
/// The external description of the channel.
pub description: Option<String>,
/// The locations in which ads appear. (Only valid for content and mobile content ads). Acceptable values for content ads are: TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, MULTIPLE_LOCATIONS. Acceptable values for mobile content ads are: TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS.
pub location: Option<String>,
/// The language of the sites ads will be displayed on.
#[serde(rename="siteLanguage")]
pub site_language: Option<String>,
}
impl client::NestedType for CustomChannelTargetingInfo {}
impl client::Part for CustomChannelTargetingInfo {}
/// The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
///
/// 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 ReportHeaders {
/// The currency of this column. Only present if the header type is METRIC_CURRENCY.
pub currency: Option<String>,
/// The name of the header.
pub name: Option<String>,
/// The type of the header; one of DIMENSION, METRIC_TALLY, METRIC_RATIO, or METRIC_CURRENCY.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for ReportHeaders {}
impl client::Part for ReportHeaders {}

View File

@@ -0,0 +1,28 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage your Ad Exchange data
AdexchangeSeller,
/// View your Ad Exchange data
AdexchangeSellerReadonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AdexchangeSeller => "https://www.googleapis.com/auth/adexchange.seller",
Scope::AdexchangeSellerReadonly => "https://www.googleapis.com/auth/adexchange.seller.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AdexchangeSellerReadonly
}
}

View File

@@ -1,351 +1,4 @@
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 AdExperienceReport related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexperiencereport1 as adexperiencereport1;
/// use adexperiencereport1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use adexperiencereport1::{AdExperienceReport, 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 = AdExperienceReport::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 AdExperienceReport<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 AdExperienceReport<S> {}
impl<'a, S> AdExperienceReport<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdExperienceReport<S> {
AdExperienceReport {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://adexperiencereport.googleapis.com/".to_string(),
_root_url: "https://adexperiencereport.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.3`.
///
/// 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://adexperiencereport.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://adexperiencereport.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 ###
// ##########
/// A site's Ad Experience Report summary on a single platform.
///
/// 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 PlatformSummary {
/// The site's Ad Experience Report status on this platform.
#[serde(rename="betterAdsStatus")]
pub better_ads_status: Option<String>,
/// The time at which [enforcement](https://support.google.com/webtools/answer/7308033) against the site began or will begin on this platform. 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/7308033) on this platform.
#[serde(rename="filterStatus")]
pub filter_status: Option<String>,
/// The time at which the site's status last changed on this platform.
#[serde(rename="lastChangeTime")]
pub last_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The site's regions on this platform. No longer populated, because there is no longer any semantic difference between sites in different regions.
pub region: Option<Vec<String>>,
/// A link to the full Ad Experience Report for the site on this platform.. 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>,
/// Whether the site is currently under review on this platform.
#[serde(rename="underReview")]
pub under_review: Option<bool>,
}
impl client::Part for PlatformSummary {}
/// 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 Ad Experience Report summary on desktop.
#[serde(rename="desktopSummary")]
pub desktop_summary: Option<PlatformSummary>,
/// The site's Ad Experience Report summary on mobile.
#[serde(rename="mobileSummary")]
pub mobile_summary: Option<PlatformSummary>,
/// The name of the reviewed site, e.g. `google.com`.
#[serde(rename="reviewedSite")]
pub reviewed_site: Option<String>,
}
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 [`AdExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexperiencereport1 as adexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexperiencereport1::{AdExperienceReport, 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 = AdExperienceReport::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 AdExperienceReport<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 Ad 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 [`AdExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexperiencereport1 as adexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexperiencereport1::{AdExperienceReport, 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 = AdExperienceReport::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 AdExperienceReport<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 Ad Experience Report on at least one platform.
pub fn list(&self) -> ViolatingSiteListCall<'a, S> {
ViolatingSiteListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
use super::*;
/// Gets a site's Ad Experience Report summary.
///
/// A builder for the *get* method supported by a *site* resource.
@@ -379,10 +32,10 @@ impl<'a, S> ViolatingSiteMethods<'a, S> {
pub struct SiteGetCall<'a, S>
where S: 'a {
hub: &'a AdExperienceReport<S>,
_name: String,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
pub(super) hub: &'a AdExperienceReport<S>,
pub(super) _name: String,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for SiteGetCall<'a, S> {}
@@ -596,9 +249,9 @@ where
pub struct ViolatingSiteListCall<'a, S>
where S: 'a {
hub: &'a AdExperienceReport<S>,
_delegate: Option<&'a mut dyn client::Delegate>,
_additional_params: HashMap<String, String>,
pub(super) hub: &'a AdExperienceReport<S>,
pub(super) _delegate: Option<&'a mut dyn client::Delegate>,
pub(super) _additional_params: HashMap<String, String>,
}
impl<'a, S> client::CallBuilder for ViolatingSiteListCall<'a, S> {}

View File

@@ -0,0 +1,109 @@
use super::*;
/// Central instance to access all AdExperienceReport related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexperiencereport1 as adexperiencereport1;
/// use adexperiencereport1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use adexperiencereport1::{AdExperienceReport, 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 = AdExperienceReport::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 AdExperienceReport<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdExperienceReport<S> {}
impl<'a, S> AdExperienceReport<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdExperienceReport<S> {
AdExperienceReport {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://adexperiencereport.googleapis.com/".to_string(),
_root_url: "https://adexperiencereport.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.3`.
///
/// 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://adexperiencereport.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://adexperiencereport.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)
}
}

View File

@@ -0,0 +1,110 @@
use super::*;
/// A builder providing access to all methods supported on *site* resources.
/// It is not used directly, but through the [`AdExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexperiencereport1 as adexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexperiencereport1::{AdExperienceReport, 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 = AdExperienceReport::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 {
pub(super) hub: &'a AdExperienceReport<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 Ad 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 [`AdExperienceReport`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adexperiencereport1 as adexperiencereport1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adexperiencereport1::{AdExperienceReport, 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 = AdExperienceReport::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 {
pub(super) hub: &'a AdExperienceReport<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 Ad Experience Report on at least one platform.
pub fn list(&self) -> ViolatingSiteListCall<'a, S> {
ViolatingSiteListCall {
hub: self.hub,
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,88 @@
use super::*;
/// A site's Ad Experience Report summary on a single platform.
///
/// 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 PlatformSummary {
/// The site's Ad Experience Report status on this platform.
#[serde(rename="betterAdsStatus")]
pub better_ads_status: Option<String>,
/// The time at which [enforcement](https://support.google.com/webtools/answer/7308033) against the site began or will begin on this platform. 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/7308033) on this platform.
#[serde(rename="filterStatus")]
pub filter_status: Option<String>,
/// The time at which the site's status last changed on this platform.
#[serde(rename="lastChangeTime")]
pub last_change_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// The site's regions on this platform. No longer populated, because there is no longer any semantic difference between sites in different regions.
pub region: Option<Vec<String>>,
/// A link to the full Ad Experience Report for the site on this platform.. 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>,
/// Whether the site is currently under review on this platform.
#[serde(rename="underReview")]
pub under_review: Option<bool>,
}
impl client::Part for PlatformSummary {}
/// 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 Ad Experience Report summary on desktop.
#[serde(rename="desktopSummary")]
pub desktop_summary: Option<PlatformSummary>,
/// The site's Ad Experience Report summary on mobile.
#[serde(rename="mobileSummary")]
pub mobile_summary: Option<PlatformSummary>,
/// The name of the reviewed site, e.g. `google.com`.
#[serde(rename="reviewedSite")]
pub reviewed_site: Option<String>,
}
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 {}

View File

@@ -0,0 +1,2 @@
use super::*;

File diff suppressed because it is too large Load Diff

106
gen/admob1/src/api/hub.rs Normal file
View File

@@ -0,0 +1,106 @@
use super::*;
/// Central instance to access all AdMob related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_admob1 as admob1;
/// use admob1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use admob1::{AdMob, 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 = AdMob::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().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 AdMob<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdMob<S> {}
impl<'a, S> AdMob<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdMob<S> {
AdMob {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://admob.googleapis.com/".to_string(),
_root_url: "https://admob.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { 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.3`.
///
/// 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://admob.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://admob.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)
}
}

View File

@@ -0,0 +1,149 @@
use super::*;
/// A builder providing access to all methods supported on *account* resources.
/// It is not used directly, but through the [`AdMob`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_admob1 as admob1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use admob1::{AdMob, 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 = AdMob::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 `ad_units_list(...)`, `apps_list(...)`, `get(...)`, `list(...)`, `mediation_report_generate(...)` and `network_report_generate(...)`
/// // to build up your call.
/// let rb = hub.accounts();
/// # }
/// ```
pub struct AccountMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdMob<S>,
}
impl<'a, S> client::MethodsBuilder for AccountMethods<'a, S> {}
impl<'a, S> AccountMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// List the ad units under the specified AdMob account.
///
/// # Arguments
///
/// * `parent` - Required. Resource name of the account to list ad units for. Example: accounts/pub-9876543210987654
pub fn ad_units_list(&self, parent: &str) -> AccountAdUnitListCall<'a, S> {
AccountAdUnitListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List the apps under the specified AdMob account.
///
/// # Arguments
///
/// * `parent` - Required. Resource name of the account to list apps for. Example: accounts/pub-9876543210987654
pub fn apps_list(&self, parent: &str) -> AccountAppListCall<'a, S> {
AccountAppListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generates an AdMob mediation report based on the provided report specification. Returns result of a server-side streaming RPC. The result is returned in a sequence of responses.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Resource name of the account to generate the report for. Example: accounts/pub-9876543210987654
pub fn mediation_report_generate(&self, request: GenerateMediationReportRequest, parent: &str) -> AccountMediationReportGenerateCall<'a, S> {
AccountMediationReportGenerateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generates an AdMob Network report based on the provided report specification. Returns result of a server-side streaming RPC. The result is returned in a sequence of responses.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Resource name of the account to generate the report for. Example: accounts/pub-9876543210987654
pub fn network_report_generate(&self, request: GenerateNetworkReportRequest, parent: &str) -> AccountNetworkReportGenerateCall<'a, S> {
AccountNetworkReportGenerateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets information about the specified AdMob publisher account.
///
/// # Arguments
///
/// * `name` - Resource name of the publisher account to retrieve. Example: accounts/pub-9876543210987654
pub fn get(&self, name: &str) -> AccountGetCall<'a, S> {
AccountGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists the AdMob publisher account that was most recently signed in to from the AdMob UI. For more information, see https://support.google.com/admob/answer/10243672.
pub fn list(&self) -> AccountListCall<'a, S> {
AccountListCall {
hub: self.hub,
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

32
gen/admob1/src/api/mod.rs Normal file
View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,665 @@
use super::*;
/// Describes an AdMob ad unit.
///
/// 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 AdUnit {
/// AdFormat of the ad unit. Possible values are as follows: "APP_OPEN" - App Open ad format. "BANNER" - Banner ad format. "BANNER_INTERSTITIAL" - Legacy format that can be used as either banner or interstitial. This format can no longer be created but can be targeted by mediation groups. "INTERSTITIAL" - A full screen ad. Supported ad types are "RICH_MEDIA" and "VIDEO". "NATIVE" - Native ad format. "REWARDED" - An ad that, once viewed, gets a callback verifying the view so that a reward can be given to the user. Supported ad types are "RICH_MEDIA" (interactive) and video where video can not be excluded. "REWARDED_INTERSTITIAL" - Rewarded Interstitial ad format. Only supports video ad type. See https://support.google.com/admob/answer/9884467.
#[serde(rename="adFormat")]
pub ad_format: Option<String>,
/// Ad media type supported by this ad unit. Possible values as follows: "RICH_MEDIA" - Text, image, and other non-video media. "VIDEO" - Video media.
#[serde(rename="adTypes")]
pub ad_types: Option<Vec<String>>,
/// The externally visible ID of the ad unit which can be used to integrate with the AdMob SDK. This is a read only property. Example: ca-app-pub-9876543210987654/0123456789
#[serde(rename="adUnitId")]
pub ad_unit_id: Option<String>,
/// The externally visible ID of the app this ad unit is associated with. Example: ca-app-pub-9876543210987654~0123456789
#[serde(rename="appId")]
pub app_id: Option<String>,
/// The display name of the ad unit as shown in the AdMob UI, which is provided by the user. The maximum length allowed is 80 characters.
#[serde(rename="displayName")]
pub display_name: Option<String>,
/// Resource name for this ad unit. Format is accounts/{publisher_id}/adUnits/{ad_unit_id_fragment} Example: accounts/pub-9876543210987654/adUnits/0123456789
pub name: Option<String>,
}
impl client::Part for AdUnit {}
/// Describes an AdMob app for a specific platform (For example: Android or iOS).
///
/// 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 App {
/// Output only. The approval state for the app.
#[serde(rename="appApprovalState")]
pub app_approval_state: Option<String>,
/// The externally visible ID of the app which can be used to integrate with the AdMob SDK. This is a read only property. Example: ca-app-pub-9876543210987654~0123456789
#[serde(rename="appId")]
pub app_id: Option<String>,
/// Immutable. The information for an app that is linked to an app store. This field is present if and only if the app is linked to an app store.
#[serde(rename="linkedAppInfo")]
pub linked_app_info: Option<AppLinkedAppInfo>,
/// The information for an app that is not linked to any app store. After an app is linked, this information is still retrivable. If no name is provided for the app upon creation, a placeholder name will be used.
#[serde(rename="manualAppInfo")]
pub manual_app_info: Option<AppManualAppInfo>,
/// Resource name for this app. Format is accounts/{publisher_id}/apps/{app_id_fragment} Example: accounts/pub-9876543210987654/apps/0123456789
pub name: Option<String>,
/// Describes the platform of the app. Limited to "IOS" and "ANDROID".
pub platform: Option<String>,
}
impl client::Part for App {}
/// Information from the app store if the app is linked to an app store.
///
/// 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 AppLinkedAppInfo {
/// The app store ID of the app; present if and only if the app is linked to an app store. If the app is added to the Google Play store, it will be the application ID of the app. For example: "com.example.myapp". See https://developer.android.com/studio/build/application-id. If the app is added to the Apple App Store, it will be app store ID. For example "105169111". Note that setting the app store id is considered an irreversible action. Once an app is linked, it cannot be unlinked.
#[serde(rename="appStoreId")]
pub app_store_id: Option<String>,
/// Output only. Display name of the app as it appears in the app store. This is an output-only field, and may be empty if the app cannot be found in the store.
#[serde(rename="displayName")]
pub display_name: Option<String>,
}
impl client::Part for AppLinkedAppInfo {}
/// Information provided for manual apps which are not linked to an application store (Example: Google Play, App Store).
///
/// 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 AppManualAppInfo {
/// The display name of the app as shown in the AdMob UI, which is provided by the user. The maximum length allowed is 80 characters.
#[serde(rename="displayName")]
pub display_name: Option<String>,
}
impl client::Part for AppManualAppInfo {}
/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
///
/// 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 Date {
/// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
pub day: Option<i32>,
/// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
pub month: Option<i32>,
/// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
pub year: Option<i32>,
}
impl client::Part for Date {}
/// Specification of a single date range. Both dates are inclusive.
///
/// 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 DateRange {
/// End date of the date range, inclusive. Must be greater than or equal to the start date.
#[serde(rename="endDate")]
pub end_date: Option<Date>,
/// Start date of the date range, inclusive. Must be less than or equal to the end date.
#[serde(rename="startDate")]
pub start_date: Option<Date>,
}
impl client::Part for DateRange {}
/// Request to generate an AdMob mediation report.
///
/// # 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*).
///
/// * [mediation report generate accounts](AccountMediationReportGenerateCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GenerateMediationReportRequest {
/// Network report specification.
#[serde(rename="reportSpec")]
pub report_spec: Option<MediationReportSpec>,
}
impl client::RequestValue for GenerateMediationReportRequest {}
/// The streaming response for the AdMob mediation report where the first response contains the report header, then a stream of row responses, and finally a footer as the last response message. For example: \[{ “header”: { “date_range”: { “start_date”: {“year”: 2018, “month”: 9, “day”: 1}, “end_date”: {“year”: 2018, “month”: 9, “day”: 1} }, “localization_settings”: { “currency_code”: “USD”, “language_code”: “en-US” } } }, { “row”: { “dimension_values”: { “DATE”: {“value”: “20180918”}, “APP”: { “value”: “ca-app-pub-8123415297019784~1001342552”, “display_label”: “My app name!” } }, “metric_values”: { “ESTIMATED_EARNINGS”: {“decimal_value”: “1324746”} } } }, { “footer”: {“matching_row_count”: 1} }\]
///
/// # 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*).
///
/// * [mediation report generate accounts](AccountMediationReportGenerateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GenerateMediationReportResponse {
/// Additional information about the generated report, such as warnings about the data.
pub footer: Option<ReportFooter>,
/// Report generation settings that describes the report contents, such as the report date range and localization settings.
pub header: Option<ReportHeader>,
/// Actual report data.
pub row: Option<ReportRow>,
}
impl client::ResponseResult for GenerateMediationReportResponse {}
/// Request to generate an AdMob Network report.
///
/// # 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*).
///
/// * [network report generate accounts](AccountNetworkReportGenerateCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GenerateNetworkReportRequest {
/// Network report specification.
#[serde(rename="reportSpec")]
pub report_spec: Option<NetworkReportSpec>,
}
impl client::RequestValue for GenerateNetworkReportRequest {}
/// The streaming response for the AdMob Network report where the first response contains the report header, then a stream of row responses, and finally a footer as the last response message. For example: \[{ “header”: { “dateRange”: { “startDate”: {“year”: 2018, “month”: 9, “day”: 1}, “endDate”: {“year”: 2018, “month”: 9, “day”: 1} }, “localizationSettings”: { “currencyCode”: “USD”, “languageCode”: “en-US” } } }, { “row”: { “dimensionValues”: { “DATE”: {“value”: “20180918”}, “APP”: { “value”: “ca-app-pub-8123415297019784~1001342552”, displayLabel: “My app name!” } }, “metricValues”: { “ESTIMATED_EARNINGS”: {“microsValue”: 6500000} } } }, { “footer”: {“matchingRowCount”: 1} }\]
///
/// # 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*).
///
/// * [network report generate accounts](AccountNetworkReportGenerateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GenerateNetworkReportResponse {
/// Additional information about the generated report, such as warnings about the data.
pub footer: Option<ReportFooter>,
/// Report generation settings that describes the report contents, such as the report date range and localization settings.
pub header: Option<ReportHeader>,
/// Actual report data.
pub row: Option<ReportRow>,
}
impl client::ResponseResult for GenerateNetworkReportResponse {}
/// Response for the ad units list request.
///
/// # 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*).
///
/// * [ad units list accounts](AccountAdUnitListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAdUnitsResponse {
/// The resulting ad units for the requested account.
#[serde(rename="adUnits")]
pub ad_units: Option<Vec<AdUnit>>,
/// If not empty, indicates that there may be more ad units for the request; this value should be passed in a new `ListAdUnitsRequest`.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAdUnitsResponse {}
/// Response for the apps list request.
///
/// # 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*).
///
/// * [apps list accounts](AccountAppListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAppsResponse {
/// The resulting apps for the requested account.
pub apps: Option<Vec<App>>,
/// If not empty, indicates that there may be more apps for the request; this value should be passed in a new `ListAppsRequest`.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAppsResponse {}
/// Response for the publisher account list request.
///
/// # 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 accounts](AccountListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListPublisherAccountsResponse {
/// Publisher that the client credentials can access.
pub account: Option<Vec<PublisherAccount>>,
/// If not empty, indicates that there might be more accounts for the request; you must pass this value in a new `ListPublisherAccountsRequest`.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListPublisherAccountsResponse {}
/// Localization settings for reports, such as currency and language. It affects how metrics are calculated.
///
/// 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 LocalizationSettings {
/// Currency code of the earning related metrics, which is the 3-letter code defined in ISO 4217. The daily average rate is used for the currency conversion. Defaults to the account currency code if unspecified.
#[serde(rename="currencyCode")]
pub currency_code: Option<String>,
/// Language used for any localized text, such as some dimension value display labels. The language tag defined in the IETF BCP47. Defaults to 'en-US' if unspecified.
#[serde(rename="languageCode")]
pub language_code: Option<String>,
}
impl client::Part for LocalizationSettings {}
/// The specification for generating an AdMob Mediation report. For example, the specification to get observed ECPM sliced by ad source and app for the 'US' and 'CN' countries can look like the following example: { "date_range": { "start_date": {"year": 2021, "month": 9, "day": 1}, "end_date": {"year": 2021, "month": 9, "day": 30} }, "dimensions": ["AD_SOURCE", "APP", "COUNTRY"], "metrics": ["OBSERVED_ECPM"], "dimension_filters": [ { "dimension": "COUNTRY", "matches_any": {"values": [{"value": "US", "value": "CN"}]} } ], "sort_conditions": [ {"dimension":"APP", order: "ASCENDING"} ], "localization_settings": { "currency_code": "USD", "language_code": "en-US" } } For a better understanding, you can treat the preceding specification like the following pseudo SQL: SELECT AD_SOURCE, APP, COUNTRY, OBSERVED_ECPM FROM MEDIATION_REPORT WHERE DATE >= '2021-09-01' AND DATE <= '2021-09-30' AND COUNTRY IN ('US', 'CN') GROUP BY AD_SOURCE, APP, COUNTRY ORDER BY APP ASC;
///
/// 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 MediationReportSpec {
/// The date range for which the report is generated.
#[serde(rename="dateRange")]
pub date_range: Option<DateRange>,
/// Describes which report rows to match based on their dimension values.
#[serde(rename="dimensionFilters")]
pub dimension_filters: Option<Vec<MediationReportSpecDimensionFilter>>,
/// List of dimensions of the report. The value combination of these dimensions determines the row of the report. If no dimensions are specified, the report returns a single row of requested metrics for the entire account.
pub dimensions: Option<Vec<String>>,
/// Localization settings of the report.
#[serde(rename="localizationSettings")]
pub localization_settings: Option<LocalizationSettings>,
/// Maximum number of report data rows to return. If the value is not set, the API returns as many rows as possible, up to 100000. Acceptable values are 1-100000, inclusive. Values larger than 100000 return an error.
#[serde(rename="maxReportRows")]
pub max_report_rows: Option<i32>,
/// List of metrics of the report. A report must specify at least one metric.
pub metrics: Option<Vec<String>>,
/// Describes the sorting of report rows. The order of the condition in the list defines its precedence; the earlier the condition, the higher its precedence. If no sort conditions are specified, the row ordering is undefined.
#[serde(rename="sortConditions")]
pub sort_conditions: Option<Vec<MediationReportSpecSortCondition>>,
/// A report time zone. Accepts an IANA TZ name values, such as "America/Los_Angeles." If no time zone is defined, the account default takes effect. Check default value by the get account action. **Warning:** The "America/Los_Angeles" is the only supported value at the moment.
#[serde(rename="timeZone")]
pub time_zone: Option<String>,
}
impl client::Part for MediationReportSpec {}
/// Describes which report rows to match based on their dimension values.
///
/// 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 MediationReportSpecDimensionFilter {
/// Applies the filter criterion to the specified dimension.
pub dimension: Option<String>,
/// Matches a row if its value for the specified dimension is in one of the values specified in this condition.
#[serde(rename="matchesAny")]
pub matches_any: Option<StringList>,
}
impl client::Part for MediationReportSpecDimensionFilter {}
/// Sorting direction to be applied on a dimension or a metric.
///
/// 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 MediationReportSpecSortCondition {
/// Sort by the specified dimension.
pub dimension: Option<String>,
/// Sort by the specified metric.
pub metric: Option<String>,
/// Sorting order of the dimension or metric.
pub order: Option<String>,
}
impl client::Part for MediationReportSpecSortCondition {}
/// The specification for generating an AdMob Network report. For example, the specification to get clicks and estimated earnings for only the 'US' and 'CN' countries can look like the following example: { 'date_range': { 'start_date': {'year': 2021, 'month': 9, 'day': 1}, 'end_date': {'year': 2021, 'month': 9, 'day': 30} }, 'dimensions': ['DATE', 'APP', 'COUNTRY'], 'metrics': ['CLICKS', 'ESTIMATED_EARNINGS'], 'dimension_filters': [ { 'dimension': 'COUNTRY', 'matches_any': {'values': [{'value': 'US', 'value': 'CN'}]} } ], 'sort_conditions': [ {'dimension':'APP', order: 'ASCENDING'}, {'metric':'CLICKS', order: 'DESCENDING'} ], 'localization_settings': { 'currency_code': 'USD', 'language_code': 'en-US' } } For a better understanding, you can treat the preceding specification like the following pseudo SQL: SELECT DATE, APP, COUNTRY, CLICKS, ESTIMATED_EARNINGS FROM NETWORK_REPORT WHERE DATE >= '2021-09-01' AND DATE <= '2021-09-30' AND COUNTRY IN ('US', 'CN') GROUP BY DATE, APP, COUNTRY ORDER BY APP ASC, CLICKS DESC;
///
/// 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 NetworkReportSpec {
/// The date range for which the report is generated.
#[serde(rename="dateRange")]
pub date_range: Option<DateRange>,
/// Describes which report rows to match based on their dimension values.
#[serde(rename="dimensionFilters")]
pub dimension_filters: Option<Vec<NetworkReportSpecDimensionFilter>>,
/// List of dimensions of the report. The value combination of these dimensions determines the row of the report. If no dimensions are specified, the report returns a single row of requested metrics for the entire account.
pub dimensions: Option<Vec<String>>,
/// Localization settings of the report.
#[serde(rename="localizationSettings")]
pub localization_settings: Option<LocalizationSettings>,
/// Maximum number of report data rows to return. If the value is not set, the API returns as many rows as possible, up to 100000. Acceptable values are 1-100000, inclusive. Values larger than 100000 return an error.
#[serde(rename="maxReportRows")]
pub max_report_rows: Option<i32>,
/// List of metrics of the report. A report must specify at least one metric.
pub metrics: Option<Vec<String>>,
/// Describes the sorting of report rows. The order of the condition in the list defines its precedence; the earlier the condition, the higher its precedence. If no sort conditions are specified, the row ordering is undefined.
#[serde(rename="sortConditions")]
pub sort_conditions: Option<Vec<NetworkReportSpecSortCondition>>,
/// A report time zone. Accepts an IANA TZ name values, such as "America/Los_Angeles." If no time zone is defined, the account default takes effect. Check default value by the get account action. **Warning:** The "America/Los_Angeles" is the only supported value at the moment.
#[serde(rename="timeZone")]
pub time_zone: Option<String>,
}
impl client::Part for NetworkReportSpec {}
/// Describes which report rows to match based on their dimension values.
///
/// 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 NetworkReportSpecDimensionFilter {
/// Applies the filter criterion to the specified dimension.
pub dimension: Option<String>,
/// Matches a row if its value for the specified dimension is in one of the values specified in this condition.
#[serde(rename="matchesAny")]
pub matches_any: Option<StringList>,
}
impl client::Part for NetworkReportSpecDimensionFilter {}
/// Sorting direction to be applied on a dimension or a metric.
///
/// 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 NetworkReportSpecSortCondition {
/// Sort by the specified dimension.
pub dimension: Option<String>,
/// Sort by the specified metric.
pub metric: Option<String>,
/// Sorting order of the dimension or metric.
pub order: Option<String>,
}
impl client::Part for NetworkReportSpecSortCondition {}
/// A publisher account contains information relevant to the use of this API, such as the time zone used for the reports.
///
/// # 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 accounts](AccountGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PublisherAccount {
/// Currency code of the earning-related metrics, which is the 3-letter code defined in ISO 4217. The daily average rate is used for the currency conversion.
#[serde(rename="currencyCode")]
pub currency_code: Option<String>,
/// Resource name of this account. Format is accounts/{publisher_id}.
pub name: Option<String>,
/// The unique ID by which this publisher account can be identified in the API requests (for example, pub-1234567890).
#[serde(rename="publisherId")]
pub publisher_id: Option<String>,
/// The time zone that is used in reports that are generated for this account. The value is a time-zone ID as specified by the CLDR project, for example, "America/Los_Angeles".
#[serde(rename="reportingTimeZone")]
pub reporting_time_zone: Option<String>,
}
impl client::ResponseResult for PublisherAccount {}
/// Groups data available after report generation, for example, warnings and row counts. Always sent as the last message in the stream response.
///
/// 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 ReportFooter {
/// Total number of rows that matched the request. Warning: This count does NOT always match the number of rows in the response. Do not make that assumption when processing the response.
#[serde(rename="matchingRowCount")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub matching_row_count: Option<i64>,
/// Warnings associated with generation of the report.
pub warnings: Option<Vec<ReportWarning>>,
}
impl client::Part for ReportFooter {}
/// Groups data helps to treat the generated report. Always sent as a first message in the stream response.
///
/// 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 ReportHeader {
/// The date range for which the report is generated. This is identical to the range specified in the report request.
#[serde(rename="dateRange")]
pub date_range: Option<DateRange>,
/// Localization settings of the report. This is identical to the settings in the report request.
#[serde(rename="localizationSettings")]
pub localization_settings: Option<LocalizationSettings>,
/// The report time zone. The value is a time-zone ID as specified by the CLDR project, for example, "America/Los_Angeles".
#[serde(rename="reportingTimeZone")]
pub reporting_time_zone: Option<String>,
}
impl client::Part for ReportHeader {}
/// A row of the returning report.
///
/// 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 ReportRow {
/// Map of dimension values in a row, with keys as enum name of the dimensions.
#[serde(rename="dimensionValues")]
pub dimension_values: Option<HashMap<String, ReportRowDimensionValue>>,
/// Map of metric values in a row, with keys as enum name of the metrics. If a metric being requested has no value returned, the map will not include it.
#[serde(rename="metricValues")]
pub metric_values: Option<HashMap<String, ReportRowMetricValue>>,
}
impl client::Part for ReportRow {}
/// Representation of a dimension value.
///
/// 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 ReportRowDimensionValue {
/// The localized string representation of the value. If unspecified, the display label should be derived from the value.
#[serde(rename="displayLabel")]
pub display_label: Option<String>,
/// Dimension value in the format specified in the report's spec Dimension enum.
pub value: Option<String>,
}
impl client::Part for ReportRowDimensionValue {}
/// Representation of a metric value.
///
/// 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 ReportRowMetricValue {
/// Double precision (approximate) decimal values. Rates are from 0 to 1.
#[serde(rename="doubleValue")]
pub double_value: Option<f64>,
/// Metric integer value.
#[serde(rename="integerValue")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub integer_value: Option<i64>,
/// Amount in micros. One million is equivalent to one unit. Currency value is in the unit (USD, EUR or other) specified by the request. For example, $6.50 whould be represented as 6500000 micros.
#[serde(rename="microsValue")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub micros_value: Option<i64>,
}
impl client::Part for ReportRowMetricValue {}
/// Warnings associated with generation of the report.
///
/// 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 ReportWarning {
/// Describes the details of the warning message, in English.
pub description: Option<String>,
/// Type of the warning.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for ReportWarning {}
/// List of string values.
///
/// 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 StringList {
/// The string values.
pub values: Option<Vec<String>>,
}
impl client::Part for StringList {}

View File

@@ -0,0 +1,28 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See your AdMob data
Readonly,
/// See your AdMob data
Report,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::Readonly => "https://www.googleapis.com/auth/admob.readonly",
Scope::Report => "https://www.googleapis.com/auth/admob.report",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::Readonly
}
}

View File

@@ -0,0 +1,142 @@
use super::*;
/// Central instance to access all AdSense related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsense1d4 as adsense1d4;
/// use adsense1d4::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use adsense1d4::{AdSense, 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 = AdSense::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")
/// .use_timezone_reporting(true)
/// .start_index(-50)
/// .add_sort("ipsum")
/// .add_metric("est")
/// .max_results(-62)
/// .locale("ea")
/// .add_filter("dolor")
/// .add_dimension("Lorem")
/// .currency("eos")
/// .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 AdSense<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdSense<S> {}
impl<'a, S> AdSense<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdSense<S> {
AdSense {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://www.googleapis.com/adsense/v1.4/".to_string(),
_root_url: "https://www.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { hub: &self }
}
pub fn adclients(&'a self) -> AdclientMethods<'a, S> {
AdclientMethods { hub: &self }
}
pub fn adunits(&'a self) -> AdunitMethods<'a, S> {
AdunitMethods { hub: &self }
}
pub fn alerts(&'a self) -> AlertMethods<'a, S> {
AlertMethods { hub: &self }
}
pub fn customchannels(&'a self) -> CustomchannelMethods<'a, S> {
CustomchannelMethods { hub: &self }
}
pub fn metadata(&'a self) -> MetadataMethods<'a, S> {
MetadataMethods { hub: &self }
}
pub fn payments(&'a self) -> PaymentMethods<'a, S> {
PaymentMethods { hub: &self }
}
pub fn reports(&'a self) -> ReportMethods<'a, S> {
ReportMethods { hub: &self }
}
pub fn savedadstyles(&'a self) -> SavedadstyleMethods<'a, S> {
SavedadstyleMethods { hub: &self }
}
pub fn urlchannels(&'a self) -> UrlchannelMethods<'a, S> {
UrlchannelMethods { 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.3`.
///
/// 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://www.googleapis.com/adsense/v1.4/`.
///
/// 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://www.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)
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,954 @@
use super::*;
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients get ad code accounts](AccountAdclientGetAdCodeCall) (none)
/// * [adclients list accounts](AccountAdclientListCall) (none)
/// * [adunits customchannels list accounts](AccountAdunitCustomchannelListCall) (none)
/// * [adunits get accounts](AccountAdunitGetCall) (none)
/// * [adunits get ad code accounts](AccountAdunitGetAdCodeCall) (none)
/// * [adunits list accounts](AccountAdunitListCall) (none)
/// * [alerts delete accounts](AccountAlertDeleteCall) (none)
/// * [alerts list accounts](AccountAlertListCall) (none)
/// * [customchannels adunits list accounts](AccountCustomchannelAdunitListCall) (none)
/// * [customchannels get accounts](AccountCustomchannelGetCall) (none)
/// * [customchannels list accounts](AccountCustomchannelListCall) (none)
/// * [payments list accounts](AccountPaymentListCall) (none)
/// * [reports saved generate accounts](AccountReportSavedGenerateCall) (none)
/// * [reports saved list accounts](AccountReportSavedListCall) (none)
/// * [reports generate accounts](AccountReportGenerateCall) (none)
/// * [savedadstyles get accounts](AccountSavedadstyleGetCall) (none)
/// * [savedadstyles list accounts](AccountSavedadstyleListCall) (none)
/// * [urlchannels list accounts](AccountUrlchannelListCall) (none)
/// * [get accounts](AccountGetCall) (response)
/// * [list accounts](AccountListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Account {
/// no description provided
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub creation_time: Option<i64>,
/// Unique identifier of this account.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#account.
pub kind: Option<String>,
/// Name of this account.
pub name: Option<String>,
/// Whether this account is premium.
pub premium: Option<bool>,
/// Sub accounts of the this account.
#[serde(rename="subAccounts")]
pub sub_accounts: Option<Vec<Account>>,
/// AdSense timezone of this account.
pub timezone: Option<String>,
}
impl client::Resource for Account {}
impl client::ResponseResult for Account {}
/// There is no detailed description.
///
/// # 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 accounts](AccountListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Accounts {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The accounts returned in this list response.
pub items: Option<Vec<Account>>,
/// Kind of list this is, in this case adsense#accounts.
pub kind: Option<String>,
/// Continuation token used to page through accounts. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for Accounts {}
/// There is no detailed description.
///
/// 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 AdClient {
/// Whether this ad client is opted in to ARC.
#[serde(rename="arcOptIn")]
pub arc_opt_in: Option<bool>,
/// Unique identifier of this ad client.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#adClient.
pub kind: Option<String>,
/// This ad client's product code, which corresponds to the PRODUCT_CODE report dimension.
#[serde(rename="productCode")]
pub product_code: Option<String>,
/// Whether this ad client supports being reported on.
#[serde(rename="supportsReporting")]
pub supports_reporting: Option<bool>,
}
impl client::Part for AdClient {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients list accounts](AccountAdclientListCall) (response)
/// * [list adclients](AdclientListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdClients {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The ad clients returned in this list response.
pub items: Option<Vec<AdClient>>,
/// Kind of list this is, in this case adsense#adClients.
pub kind: Option<String>,
/// Continuation token used to page through ad clients. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for AdClients {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients get ad code accounts](AccountAdclientGetAdCodeCall) (response)
/// * [adunits get ad code accounts](AccountAdunitGetAdCodeCall) (response)
/// * [get ad code adunits](AdunitGetAdCodeCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdCode {
/// The Auto ad code snippet. The ad code snippet.
#[serde(rename="adCode")]
pub ad_code: Option<String>,
/// The AMP Auto ad code snippet that goes in the body of an AMP page.
#[serde(rename="ampBody")]
pub amp_body: Option<String>,
/// The AMP Auto ad code snippet that goes in the head of an AMP page.
#[serde(rename="ampHead")]
pub amp_head: Option<String>,
/// Kind this is, in this case adsense#adCode.
pub kind: Option<String>,
}
impl client::ResponseResult for AdCode {}
/// There is no detailed description.
///
/// 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 AdStyle {
/// The colors which are included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
pub colors: Option<AdStyleColors>,
/// The style of the corners in the ad (deprecated: never populated, ignored).
pub corners: Option<String>,
/// The font which is included in the style.
pub font: Option<AdStyleFont>,
/// Kind this is, in this case adsense#adStyle.
pub kind: Option<String>,
}
impl client::Part for AdStyle {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adunits get accounts](AccountAdunitGetCall) (response)
/// * [get adunits](AdunitGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdUnit {
/// Identity code of this ad unit, not necessarily unique across ad clients.
pub code: Option<String>,
/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated).
#[serde(rename="contentAdsSettings")]
pub content_ads_settings: Option<AdUnitContentAdsSettings>,
/// Custom style information specific to this ad unit.
#[serde(rename="customStyle")]
pub custom_style: Option<AdStyle>,
/// Settings specific to feed ads (AFF) - deprecated.
#[serde(rename="feedAdsSettings")]
pub feed_ads_settings: Option<AdUnitFeedAdsSettings>,
/// Unique identifier of this ad unit. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#adUnit.
pub kind: Option<String>,
/// Settings specific to WAP mobile content ads (AFMC) - deprecated.
#[serde(rename="mobileContentAdsSettings")]
pub mobile_content_ads_settings: Option<AdUnitMobileContentAdsSettings>,
/// Name of this ad unit.
pub name: Option<String>,
/// ID of the saved ad style which holds this ad unit's style information.
#[serde(rename="savedStyleId")]
pub saved_style_id: Option<String>,
/// Status of this ad unit. Possible values are:
/// NEW: Indicates that the ad unit was created within the last seven days and does not yet have any activity associated with it.
///
/// ACTIVE: Indicates that there has been activity on this ad unit in the last seven days.
///
/// INACTIVE: Indicates that there has been no activity on this ad unit in the last seven days.
pub status: Option<String>,
}
impl client::Resource for AdUnit {}
impl client::ResponseResult for AdUnit {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adunits list accounts](AccountAdunitListCall) (response)
/// * [customchannels adunits list accounts](AccountCustomchannelAdunitListCall) (response)
/// * [list adunits](AdunitListCall) (response)
/// * [adunits list customchannels](CustomchannelAdunitListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdUnits {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The ad units returned in this list response.
pub items: Option<Vec<AdUnit>>,
/// Kind of list this is, in this case adsense#adUnits.
pub kind: Option<String>,
/// Continuation token used to page through ad units. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for AdUnits {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [reports saved generate accounts](AccountReportSavedGenerateCall) (response)
/// * [reports generate accounts](AccountReportGenerateCall) (response)
/// * [saved generate reports](ReportSavedGenerateCall) (response)
/// * [generate reports](ReportGenerateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdsenseReportsGenerateResponse {
/// The averages of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub averages: Option<Vec<String>>,
/// The requested end date in yyyy-mm-dd format.
#[serde(rename="endDate")]
pub end_date: Option<String>,
/// The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
pub headers: Option<Vec<AdsenseReportsGenerateResponseHeaders>>,
/// Kind this is, in this case adsense#report.
pub kind: Option<String>,
/// The output rows of the report. Each row is a list of cells; one for each dimension in the request, followed by one for each metric in the request. The dimension cells contain strings, and the metric cells contain numbers.
pub rows: Option<Vec<Vec<String>>>,
/// The requested start date in yyyy-mm-dd format.
#[serde(rename="startDate")]
pub start_date: Option<String>,
/// The total number of rows matched by the report request. Fewer rows may be returned in the response due to being limited by the row count requested or the report row limit.
#[serde(rename="totalMatchedRows")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub total_matched_rows: Option<i64>,
/// The totals of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub totals: Option<Vec<String>>,
/// Any warnings associated with generation of the report.
pub warnings: Option<Vec<String>>,
}
impl client::ResponseResult for AdsenseReportsGenerateResponse {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [delete alerts](AlertDeleteCall) (none)
/// * [list alerts](AlertListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Alert {
/// Unique identifier of this alert. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Whether this alert can be dismissed.
#[serde(rename="isDismissible")]
pub is_dismissible: Option<bool>,
/// Kind of resource this is, in this case adsense#alert.
pub kind: Option<String>,
/// The localized alert message.
pub message: Option<String>,
/// Severity of this alert. Possible values: INFO, WARNING, SEVERE.
pub severity: Option<String>,
/// Type of this alert. Possible values: SELF_HOLD, MIGRATED_TO_BILLING3, ADDRESS_PIN_VERIFICATION, PHONE_PIN_VERIFICATION, CORPORATE_ENTITY, GRAYLISTED_PUBLISHER, API_HOLD.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Resource for Alert {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [alerts list accounts](AccountAlertListCall) (response)
/// * [list alerts](AlertListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Alerts {
/// The alerts returned in this list response.
pub items: Option<Vec<Alert>>,
/// Kind of list this is, in this case adsense#alerts.
pub kind: Option<String>,
}
impl client::ResponseResult for Alerts {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [customchannels get accounts](AccountCustomchannelGetCall) (response)
/// * [get customchannels](CustomchannelGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannel {
/// Code of this custom channel, not necessarily unique across ad clients.
pub code: Option<String>,
/// Unique identifier of this custom channel. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#customChannel.
pub kind: Option<String>,
/// Name of this custom channel.
pub name: Option<String>,
/// The targeting information of this custom channel, if activated.
#[serde(rename="targetingInfo")]
pub targeting_info: Option<CustomChannelTargetingInfo>,
}
impl client::Resource for CustomChannel {}
impl client::ResponseResult for CustomChannel {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adunits customchannels list accounts](AccountAdunitCustomchannelListCall) (response)
/// * [customchannels list accounts](AccountCustomchannelListCall) (response)
/// * [customchannels list adunits](AdunitCustomchannelListCall) (response)
/// * [list customchannels](CustomchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannels {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The custom channels returned in this list response.
pub items: Option<Vec<CustomChannel>>,
/// Kind of list this is, in this case adsense#customChannels.
pub kind: Option<String>,
/// Continuation token used to page through custom channels. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for CustomChannels {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [dimensions list metadata](MetadataDimensionListCall) (response)
/// * [metrics list metadata](MetadataMetricListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Metadata {
/// no description provided
pub items: Option<Vec<ReportingMetadataEntry>>,
/// Kind of list this is, in this case adsense#metadata.
pub kind: Option<String>,
}
impl client::ResponseResult for Metadata {}
/// There is no detailed description.
///
/// # 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 payments](PaymentListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Payment {
/// Unique identifier of this Payment.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#payment.
pub kind: Option<String>,
/// The amount to be paid.
#[serde(rename="paymentAmount")]
pub payment_amount: Option<String>,
/// The currency code for the amount to be paid.
#[serde(rename="paymentAmountCurrencyCode")]
pub payment_amount_currency_code: Option<String>,
/// The date this payment was/will be credited to the user, or none if the payment threshold has not been met.
#[serde(rename="paymentDate")]
pub payment_date: Option<String>,
}
impl client::Resource for Payment {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [payments list accounts](AccountPaymentListCall) (response)
/// * [list payments](PaymentListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Payments {
/// The list of Payments for the account. One or both of a) the account's most recent payment; and b) the account's upcoming payment.
pub items: Option<Vec<Payment>>,
/// Kind of list this is, in this case adsense#payments.
pub kind: Option<String>,
}
impl client::ResponseResult for Payments {}
/// There is no detailed description.
///
/// 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 ReportingMetadataEntry {
/// For metrics this is a list of dimension IDs which the metric is compatible with, for dimensions it is a list of compatibility groups the dimension belongs to.
#[serde(rename="compatibleDimensions")]
pub compatible_dimensions: Option<Vec<String>>,
/// The names of the metrics the dimension or metric this reporting metadata entry describes is compatible with.
#[serde(rename="compatibleMetrics")]
pub compatible_metrics: Option<Vec<String>>,
/// Unique identifier of this reporting metadata entry, corresponding to the name of the appropriate dimension or metric.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#reportingMetadataEntry.
pub kind: Option<String>,
/// The names of the dimensions which the dimension or metric this reporting metadata entry describes requires to also be present in order for the report to be valid. Omitting these will not cause an error or warning, but may result in data which cannot be correctly interpreted.
#[serde(rename="requiredDimensions")]
pub required_dimensions: Option<Vec<String>>,
/// The names of the metrics which the dimension or metric this reporting metadata entry describes requires to also be present in order for the report to be valid. Omitting these will not cause an error or warning, but may result in data which cannot be correctly interpreted.
#[serde(rename="requiredMetrics")]
pub required_metrics: Option<Vec<String>>,
/// The codes of the projects supported by the dimension or metric this reporting metadata entry describes.
#[serde(rename="supportedProducts")]
pub supported_products: Option<Vec<String>>,
}
impl client::Part for ReportingMetadataEntry {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [savedadstyles get accounts](AccountSavedadstyleGetCall) (response)
/// * [get savedadstyles](SavedadstyleGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SavedAdStyle {
/// The AdStyle itself.
#[serde(rename="adStyle")]
pub ad_style: Option<AdStyle>,
/// Unique identifier of this saved ad style. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#savedAdStyle.
pub kind: Option<String>,
/// The user selected name of this SavedAdStyle.
pub name: Option<String>,
}
impl client::Resource for SavedAdStyle {}
impl client::ResponseResult for SavedAdStyle {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [savedadstyles list accounts](AccountSavedadstyleListCall) (response)
/// * [list savedadstyles](SavedadstyleListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SavedAdStyles {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The saved ad styles returned in this list response.
pub items: Option<Vec<SavedAdStyle>>,
/// Kind of list this is, in this case adsense#savedAdStyles.
pub kind: Option<String>,
/// Continuation token used to page through ad units. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for SavedAdStyles {}
/// There is no detailed description.
///
/// 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 SavedReport {
/// Unique identifier of this saved report.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#savedReport.
pub kind: Option<String>,
/// This saved report's name.
pub name: Option<String>,
}
impl client::Part for SavedReport {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [reports saved list accounts](AccountReportSavedListCall) (response)
/// * [saved list reports](ReportSavedListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SavedReports {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The saved reports returned in this list response.
pub items: Option<Vec<SavedReport>>,
/// Kind of list this is, in this case adsense#savedReports.
pub kind: Option<String>,
/// Continuation token used to page through saved reports. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for SavedReports {}
/// There is no detailed description.
///
/// 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 UrlChannel {
/// Unique identifier of this URL channel. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsense#urlChannel.
pub kind: Option<String>,
/// URL Pattern of this URL channel. Does not include "http://" or "https://". Example: www.example.com/home
#[serde(rename="urlPattern")]
pub url_pattern: Option<String>,
}
impl client::Part for UrlChannel {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [urlchannels list accounts](AccountUrlchannelListCall) (response)
/// * [list urlchannels](UrlchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UrlChannels {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The URL channels returned in this list response.
pub items: Option<Vec<UrlChannel>>,
/// Kind of list this is, in this case adsense#urlChannels.
pub kind: Option<String>,
/// Continuation token used to page through URL channels. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for UrlChannels {}
/// The colors which are included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
///
/// 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 AdStyleColors {
/// The color of the ad background.
pub background: Option<String>,
/// The color of the ad border.
pub border: Option<String>,
/// The color of the ad text.
pub text: Option<String>,
/// The color of the ad title.
pub title: Option<String>,
/// The color of the ad url.
pub url: Option<String>,
}
impl client::NestedType for AdStyleColors {}
impl client::Part for AdStyleColors {}
/// The font which is included in the style.
///
/// 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 AdStyleFont {
/// The family of the font.
pub family: Option<String>,
/// The size of the font.
pub size: Option<String>,
}
impl client::NestedType for AdStyleFont {}
impl client::Part for AdStyleFont {}
/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated).
///
/// 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 AdUnitContentAdsSettings {
/// The backup option to be used in instances where no ad is available.
#[serde(rename="backupOption")]
pub backup_option: Option<AdUnitContentAdsSettingsBackupOption>,
/// Size of this ad unit.
pub size: Option<String>,
/// Type of this ad unit.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for AdUnitContentAdsSettings {}
impl client::Part for AdUnitContentAdsSettings {}
/// The backup option to be used in instances where no ad is available.
///
/// 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 AdUnitContentAdsSettingsBackupOption {
/// Color to use when type is set to COLOR.
pub color: Option<String>,
/// Type of the backup option. Possible values are BLANK, COLOR and URL.
#[serde(rename="type")]
pub type_: Option<String>,
/// URL to use when type is set to URL.
pub url: Option<String>,
}
impl client::NestedType for AdUnitContentAdsSettingsBackupOption {}
impl client::Part for AdUnitContentAdsSettingsBackupOption {}
/// Settings specific to feed ads (AFF) - deprecated.
///
/// 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 AdUnitFeedAdsSettings {
/// The position of the ads relative to the feed entries.
#[serde(rename="adPosition")]
pub ad_position: Option<String>,
/// The frequency at which ads should appear in the feed (i.e. every N entries).
pub frequency: Option<i32>,
/// The minimum length an entry should be in order to have attached ads.
#[serde(rename="minimumWordCount")]
pub minimum_word_count: Option<i32>,
/// The type of ads which should appear.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for AdUnitFeedAdsSettings {}
impl client::Part for AdUnitFeedAdsSettings {}
/// Settings specific to WAP mobile content ads (AFMC) - deprecated.
///
/// 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 AdUnitMobileContentAdsSettings {
/// The markup language to use for this ad unit.
#[serde(rename="markupLanguage")]
pub markup_language: Option<String>,
/// The scripting language to use for this ad unit.
#[serde(rename="scriptingLanguage")]
pub scripting_language: Option<String>,
/// Size of this ad unit.
pub size: Option<String>,
/// Type of this ad unit.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for AdUnitMobileContentAdsSettings {}
impl client::Part for AdUnitMobileContentAdsSettings {}
/// The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
///
/// 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 AdsenseReportsGenerateResponseHeaders {
/// The currency of this column. Only present if the header type is METRIC_CURRENCY.
pub currency: Option<String>,
/// The name of the header.
pub name: Option<String>,
/// The type of the header; one of DIMENSION, METRIC_TALLY, METRIC_RATIO, or METRIC_CURRENCY.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for AdsenseReportsGenerateResponseHeaders {}
impl client::Part for AdsenseReportsGenerateResponseHeaders {}
/// The targeting information of this custom channel, if activated.
///
/// 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 CustomChannelTargetingInfo {
/// The name used to describe this channel externally.
#[serde(rename="adsAppearOn")]
pub ads_appear_on: Option<String>,
/// The external description of the channel.
pub description: Option<String>,
/// The locations in which ads appear. (Only valid for content and mobile content ads (deprecated)). Acceptable values for content ads are: TOP_LEFT, TOP_CENTER, TOP_RIGHT, MIDDLE_LEFT, MIDDLE_CENTER, MIDDLE_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, MULTIPLE_LOCATIONS. Acceptable values for mobile content ads (deprecated) are: TOP, MIDDLE, BOTTOM, MULTIPLE_LOCATIONS.
pub location: Option<String>,
/// The language of the sites ads will be displayed on.
#[serde(rename="siteLanguage")]
pub site_language: Option<String>,
}
impl client::NestedType for CustomChannelTargetingInfo {}
impl client::Part for CustomChannelTargetingInfo {}

View File

@@ -0,0 +1,28 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage your AdSense data
Full,
/// View your AdSense data
Readonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::Full => "https://www.googleapis.com/auth/adsense",
Scope::Readonly => "https://www.googleapis.com/auth/adsense.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::Readonly
}
}

121
gen/adsense2/src/api/hub.rs Normal file
View File

@@ -0,0 +1,121 @@
use super::*;
/// Central instance to access all Adsense related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsense2 as adsense2;
/// use adsense2::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use adsense2::{Adsense, 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 = Adsense::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("account")
/// .start_date_year(-17)
/// .start_date_month(-99)
/// .start_date_day(-56)
/// .reporting_time_zone("eos")
/// .add_order_by("labore")
/// .add_metrics("sed")
/// .limit(-70)
/// .language_code("sed")
/// .add_filters("no")
/// .end_date_year(-15)
/// .end_date_month(-13)
/// .end_date_day(-24)
/// .add_dimensions("sed")
/// .date_range("et")
/// .currency_code("et")
/// .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 Adsense<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for Adsense<S> {}
impl<'a, S> Adsense<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Adsense<S> {
Adsense {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://adsense.googleapis.com/".to_string(),
_root_url: "https://adsense.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { 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.3`.
///
/// 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://adsense.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://adsense.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)
}
}

View File

@@ -0,0 +1,645 @@
use super::*;
/// A builder providing access to all methods supported on *account* resources.
/// It is not used directly, but through the [`Adsense`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsense2 as adsense2;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsense2::{Adsense, 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 = Adsense::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 `adclients_adunits_create(...)`, `adclients_adunits_get(...)`, `adclients_adunits_get_adcode(...)`, `adclients_adunits_list(...)`, `adclients_adunits_list_linked_custom_channels(...)`, `adclients_adunits_patch(...)`, `adclients_customchannels_create(...)`, `adclients_customchannels_delete(...)`, `adclients_customchannels_get(...)`, `adclients_customchannels_list(...)`, `adclients_customchannels_list_linked_ad_units(...)`, `adclients_customchannels_patch(...)`, `adclients_get(...)`, `adclients_get_adcode(...)`, `adclients_list(...)`, `adclients_urlchannels_get(...)`, `adclients_urlchannels_list(...)`, `alerts_list(...)`, `get(...)`, `get_ad_blocking_recovery_tag(...)`, `list(...)`, `list_child_accounts(...)`, `payments_list(...)`, `reports_generate(...)`, `reports_generate_csv(...)`, `reports_get_saved(...)`, `reports_saved_generate(...)`, `reports_saved_generate_csv(...)`, `reports_saved_list(...)`, `sites_get(...)` and `sites_list(...)`
/// // to build up your call.
/// let rb = hub.accounts();
/// # }
/// ```
pub struct AccountMethods<'a, S>
where S: 'a {
pub(super) hub: &'a Adsense<S>,
}
impl<'a, S> client::MethodsBuilder for AccountMethods<'a, S> {}
impl<'a, S> AccountMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Creates an ad unit. This method can only be used by projects enabled for the [AdSense for Platforms](https://developers.google.com/adsense/platforms/) product. Note that ad units can only be created for ad clients with an “AFC” product code. For more info see the [AdClient resource](https://developers.google.com/adsense/management/reference/rest/v2/accounts.adclients). For now, this method can only be used to create `DISPLAY` ad units. See: https://support.google.com/adsense/answer/9183566
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. Ad client to create an ad unit under. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_adunits_create(&self, request: AdUnit, parent: &str) -> AccountAdclientAdunitCreateCall<'a, S> {
AccountAdclientAdunitCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets an ad unit from a specified account and ad client.
///
/// # Arguments
///
/// * `name` - Required. AdUnit to get information about. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
pub fn adclients_adunits_get(&self, name: &str) -> AccountAdclientAdunitGetCall<'a, S> {
AccountAdclientAdunitGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the ad unit code for a given ad unit. For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634) and [Where to place the ad code in your HTML](https://support.google.com/adsense/answer/9190028).
///
/// # Arguments
///
/// * `name` - Required. Name of the adunit for which to get the adcode. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
pub fn adclients_adunits_get_adcode(&self, name: &str) -> AccountAdclientAdunitGetAdcodeCall<'a, S> {
AccountAdclientAdunitGetAdcodeCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all ad units under a specified account and ad client.
///
/// # Arguments
///
/// * `parent` - Required. The ad client which owns the collection of ad units. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_adunits_list(&self, parent: &str) -> AccountAdclientAdunitListCall<'a, S> {
AccountAdclientAdunitListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the custom channels available for an ad unit.
///
/// # Arguments
///
/// * `parent` - Required. The ad unit which owns the collection of custom channels. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
pub fn adclients_adunits_list_linked_custom_channels(&self, parent: &str) -> AccountAdclientAdunitListLinkedCustomChannelCall<'a, S> {
AccountAdclientAdunitListLinkedCustomChannelCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates an ad unit. This method can only be used by projects enabled for the [AdSense for Platforms](https://developers.google.com/adsense/platforms/) product. For now, this method can only be used to update `DISPLAY` ad units. See: https://support.google.com/adsense/answer/9183566
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Output only. Resource name of the ad unit. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
pub fn adclients_adunits_patch(&self, request: AdUnit, name: &str) -> AccountAdclientAdunitPatchCall<'a, S> {
AccountAdclientAdunitPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a custom channel. This method can only be used by projects enabled for the [AdSense for Platforms](https://developers.google.com/adsense/platforms/) product.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - Required. The ad client to create a custom channel under. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_customchannels_create(&self, request: CustomChannel, parent: &str) -> AccountAdclientCustomchannelCreateCall<'a, S> {
AccountAdclientCustomchannelCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a custom channel. This method can only be used by projects enabled for the [AdSense for Platforms](https://developers.google.com/adsense/platforms/) product.
///
/// # Arguments
///
/// * `name` - Required. Name of the custom channel to delete. Format: accounts/{account}/adclients/{adclient}/customchannels/{customchannel}
pub fn adclients_customchannels_delete(&self, name: &str) -> AccountAdclientCustomchannelDeleteCall<'a, S> {
AccountAdclientCustomchannelDeleteCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets information about the selected custom channel.
///
/// # Arguments
///
/// * `name` - Required. Name of the custom channel. Format: accounts/{account}/adclients/{adclient}/customchannels/{customchannel}
pub fn adclients_customchannels_get(&self, name: &str) -> AccountAdclientCustomchannelGetCall<'a, S> {
AccountAdclientCustomchannelGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the custom channels available in an ad client.
///
/// # Arguments
///
/// * `parent` - Required. The ad client which owns the collection of custom channels. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_customchannels_list(&self, parent: &str) -> AccountAdclientCustomchannelListCall<'a, S> {
AccountAdclientCustomchannelListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the ad units available for a custom channel.
///
/// # Arguments
///
/// * `parent` - Required. The custom channel which owns the collection of ad units. Format: accounts/{account}/adclients/{adclient}/customchannels/{customchannel}
pub fn adclients_customchannels_list_linked_ad_units(&self, parent: &str) -> AccountAdclientCustomchannelListLinkedAdUnitCall<'a, S> {
AccountAdclientCustomchannelListLinkedAdUnitCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates a custom channel. This method can only be used by projects enabled for the [AdSense for Platforms](https://developers.google.com/adsense/platforms/) product.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - Output only. Resource name of the custom channel. Format: accounts/{account}/adclients/{adclient}/customchannels/{customchannel}
pub fn adclients_customchannels_patch(&self, request: CustomChannel, name: &str) -> AccountAdclientCustomchannelPatchCall<'a, S> {
AccountAdclientCustomchannelPatchCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_update_mask: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets information about the selected url channel.
///
/// # Arguments
///
/// * `name` - Required. The name of the url channel to retrieve. Format: accounts/{account}/adclients/{adclient}/urlchannels/{urlchannel}
pub fn adclients_urlchannels_get(&self, name: &str) -> AccountAdclientUrlchannelGetCall<'a, S> {
AccountAdclientUrlchannelGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists active url channels.
///
/// # Arguments
///
/// * `parent` - Required. The ad client which owns the collection of url channels. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_urlchannels_list(&self, parent: &str) -> AccountAdclientUrlchannelListCall<'a, S> {
AccountAdclientUrlchannelListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the ad client from the given resource name.
///
/// # Arguments
///
/// * `name` - Required. The name of the ad client to retrieve. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_get(&self, name: &str) -> AccountAdclientGetCall<'a, S> {
AccountAdclientGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the AdSense code for a given ad client. This returns what was previously known as the 'auto ad code'. This is only supported for ad clients with a product_code of AFC. For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634).
///
/// # Arguments
///
/// * `name` - Required. Name of the ad client for which to get the adcode. Format: accounts/{account}/adclients/{adclient}
pub fn adclients_get_adcode(&self, name: &str) -> AccountAdclientGetAdcodeCall<'a, S> {
AccountAdclientGetAdcodeCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the ad clients available in an account.
///
/// # Arguments
///
/// * `parent` - Required. The account which owns the collection of ad clients. Format: accounts/{account}
pub fn adclients_list(&self, parent: &str) -> AccountAdclientListCall<'a, S> {
AccountAdclientListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the alerts available in an account.
///
/// # Arguments
///
/// * `parent` - Required. The account which owns the collection of alerts. Format: accounts/{account}
pub fn alerts_list(&self, parent: &str) -> AccountAlertListCall<'a, S> {
AccountAlertListCall {
hub: self.hub,
_parent: parent.to_string(),
_language_code: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the payments available for an account.
///
/// # Arguments
///
/// * `parent` - Required. The account which owns the collection of payments. Format: accounts/{account}
pub fn payments_list(&self, parent: &str) -> AccountPaymentListCall<'a, S> {
AccountPaymentListCall {
hub: self.hub,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generates a saved report.
///
/// # Arguments
///
/// * `name` - Required. Name of the saved report. Format: accounts/{account}/reports/{report}
pub fn reports_saved_generate(&self, name: &str) -> AccountReportSavedGenerateCall<'a, S> {
AccountReportSavedGenerateCall {
hub: self.hub,
_name: name.to_string(),
_start_date_year: Default::default(),
_start_date_month: Default::default(),
_start_date_day: Default::default(),
_reporting_time_zone: Default::default(),
_language_code: Default::default(),
_end_date_year: Default::default(),
_end_date_month: Default::default(),
_end_date_day: Default::default(),
_date_range: Default::default(),
_currency_code: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generates a csv formatted saved report.
///
/// # Arguments
///
/// * `name` - Required. Name of the saved report. Format: accounts/{account}/reports/{report}
pub fn reports_saved_generate_csv(&self, name: &str) -> AccountReportSavedGenerateCsvCall<'a, S> {
AccountReportSavedGenerateCsvCall {
hub: self.hub,
_name: name.to_string(),
_start_date_year: Default::default(),
_start_date_month: Default::default(),
_start_date_day: Default::default(),
_reporting_time_zone: Default::default(),
_language_code: Default::default(),
_end_date_year: Default::default(),
_end_date_month: Default::default(),
_end_date_day: Default::default(),
_date_range: Default::default(),
_currency_code: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists saved reports.
///
/// # Arguments
///
/// * `parent` - Required. The account which owns the collection of reports. Format: accounts/{account}
pub fn reports_saved_list(&self, parent: &str) -> AccountReportSavedListCall<'a, S> {
AccountReportSavedListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generates an ad hoc report.
///
/// # Arguments
///
/// * `account` - Required. The account which owns the collection of reports. Format: accounts/{account}
pub fn reports_generate(&self, account: &str) -> AccountReportGenerateCall<'a, S> {
AccountReportGenerateCall {
hub: self.hub,
_account: account.to_string(),
_start_date_year: Default::default(),
_start_date_month: Default::default(),
_start_date_day: Default::default(),
_reporting_time_zone: Default::default(),
_order_by: Default::default(),
_metrics: Default::default(),
_limit: Default::default(),
_language_code: Default::default(),
_filters: Default::default(),
_end_date_year: Default::default(),
_end_date_month: Default::default(),
_end_date_day: Default::default(),
_dimensions: Default::default(),
_date_range: Default::default(),
_currency_code: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generates a csv formatted ad hoc report.
///
/// # Arguments
///
/// * `account` - Required. The account which owns the collection of reports. Format: accounts/{account}
pub fn reports_generate_csv(&self, account: &str) -> AccountReportGenerateCsvCall<'a, S> {
AccountReportGenerateCsvCall {
hub: self.hub,
_account: account.to_string(),
_start_date_year: Default::default(),
_start_date_month: Default::default(),
_start_date_day: Default::default(),
_reporting_time_zone: Default::default(),
_order_by: Default::default(),
_metrics: Default::default(),
_limit: Default::default(),
_language_code: Default::default(),
_filters: Default::default(),
_end_date_year: Default::default(),
_end_date_month: Default::default(),
_end_date_day: Default::default(),
_dimensions: Default::default(),
_date_range: Default::default(),
_currency_code: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the saved report from the given resource name.
///
/// # Arguments
///
/// * `name` - Required. The name of the saved report to retrieve. Format: accounts/{account}/reports/{report}
pub fn reports_get_saved(&self, name: &str) -> AccountReportGetSavedCall<'a, S> {
AccountReportGetSavedCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets information about the selected site.
///
/// # Arguments
///
/// * `name` - Required. Name of the site. Format: accounts/{account}/sites/{site}
pub fn sites_get(&self, name: &str) -> AccountSiteGetCall<'a, S> {
AccountSiteGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the sites available in an account.
///
/// # Arguments
///
/// * `parent` - Required. The account which owns the collection of sites. Format: accounts/{account}
pub fn sites_list(&self, parent: &str) -> AccountSiteListCall<'a, S> {
AccountSiteListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets information about the selected AdSense account.
///
/// # Arguments
///
/// * `name` - Required. Account to get information about. Format: accounts/{account}
pub fn get(&self, name: &str) -> AccountGetCall<'a, S> {
AccountGetCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the ad blocking recovery tag of an account.
///
/// # Arguments
///
/// * `name` - Required. The name of the account to get the tag for. Format: accounts/{account}
pub fn get_ad_blocking_recovery_tag(&self, name: &str) -> AccountGetAdBlockingRecoveryTagCall<'a, S> {
AccountGetAdBlockingRecoveryTagCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all accounts available to this user.
pub fn list(&self) -> AccountListCall<'a, S> {
AccountListCall {
hub: self.hub,
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all accounts directly managed by the given AdSense account.
///
/// # Arguments
///
/// * `parent` - Required. The parent account, which owns the child accounts. Format: accounts/{account}
pub fn list_child_accounts(&self, parent: &str) -> AccountListChildAccountCall<'a, S> {
AccountListChildAccountCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,846 @@
use super::*;
/// Representation of an account.
///
/// # 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*).
///
/// * [adclients adunits create accounts](AccountAdclientAdunitCreateCall) (none)
/// * [adclients adunits get accounts](AccountAdclientAdunitGetCall) (none)
/// * [adclients adunits get adcode accounts](AccountAdclientAdunitGetAdcodeCall) (none)
/// * [adclients adunits list accounts](AccountAdclientAdunitListCall) (none)
/// * [adclients adunits list linked custom channels accounts](AccountAdclientAdunitListLinkedCustomChannelCall) (none)
/// * [adclients adunits patch accounts](AccountAdclientAdunitPatchCall) (none)
/// * [adclients customchannels create accounts](AccountAdclientCustomchannelCreateCall) (none)
/// * [adclients customchannels delete accounts](AccountAdclientCustomchannelDeleteCall) (none)
/// * [adclients customchannels get accounts](AccountAdclientCustomchannelGetCall) (none)
/// * [adclients customchannels list accounts](AccountAdclientCustomchannelListCall) (none)
/// * [adclients customchannels list linked ad units accounts](AccountAdclientCustomchannelListLinkedAdUnitCall) (none)
/// * [adclients customchannels patch accounts](AccountAdclientCustomchannelPatchCall) (none)
/// * [adclients urlchannels get accounts](AccountAdclientUrlchannelGetCall) (none)
/// * [adclients urlchannels list accounts](AccountAdclientUrlchannelListCall) (none)
/// * [adclients get accounts](AccountAdclientGetCall) (none)
/// * [adclients get adcode accounts](AccountAdclientGetAdcodeCall) (none)
/// * [adclients list accounts](AccountAdclientListCall) (none)
/// * [alerts list accounts](AccountAlertListCall) (none)
/// * [payments list accounts](AccountPaymentListCall) (none)
/// * [reports saved generate accounts](AccountReportSavedGenerateCall) (none)
/// * [reports saved generate csv accounts](AccountReportSavedGenerateCsvCall) (none)
/// * [reports saved list accounts](AccountReportSavedListCall) (none)
/// * [reports generate accounts](AccountReportGenerateCall) (none)
/// * [reports generate csv accounts](AccountReportGenerateCsvCall) (none)
/// * [reports get saved accounts](AccountReportGetSavedCall) (none)
/// * [sites get accounts](AccountSiteGetCall) (none)
/// * [sites list accounts](AccountSiteListCall) (none)
/// * [get accounts](AccountGetCall) (response)
/// * [get ad blocking recovery tag accounts](AccountGetAdBlockingRecoveryTagCall) (none)
/// * [list accounts](AccountListCall) (none)
/// * [list child accounts accounts](AccountListChildAccountCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Account {
/// Output only. Creation time of the account.
#[serde(rename="createTime")]
pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Output only. Display name of this account.
#[serde(rename="displayName")]
pub display_name: Option<String>,
/// Output only. Resource name of the account. Format: accounts/pub-[0-9]+
pub name: Option<String>,
/// Output only. Outstanding tasks that need to be completed as part of the sign-up process for a new account. e.g. "billing-profile-creation", "phone-pin-verification".
#[serde(rename="pendingTasks")]
pub pending_tasks: Option<Vec<String>>,
/// Output only. Whether this account is premium.
pub premium: Option<bool>,
/// Output only. State of the account.
pub state: Option<String>,
/// The account time zone, as used by reporting. For more information, see [changing the time zone of your reports](https://support.google.com/adsense/answer/9830725).
#[serde(rename="timeZone")]
pub time_zone: Option<TimeZone>,
}
impl client::Resource for Account {}
impl client::ResponseResult for Account {}
/// Representation of an ad blocking recovery tag. See https://support.google.com/adsense/answer/11575177.
///
/// # 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 ad blocking recovery tag accounts](AccountGetAdBlockingRecoveryTagCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdBlockingRecoveryTag {
/// Error protection code that can be used in conjunction with the tag. It'll display a message to users if an [ad blocking extension blocks their access to your site](https://support.google.com/adsense/answer/11575480).
#[serde(rename="errorProtectionCode")]
pub error_protection_code: Option<String>,
/// The ad blocking recovery tag. Note that the message generated by the tag can be blocked by an ad blocking extension. If this is not your desired outcome, then you'll need to use it in conjunction with the error protection code.
pub tag: Option<String>,
}
impl client::ResponseResult for AdBlockingRecoveryTag {}
/// Representation of an ad client. An ad client represents a users subscription with a specific AdSense product.
///
/// # 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*).
///
/// * [adclients get accounts](AccountAdclientGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdClient {
/// Output only. Resource name of the ad client. Format: accounts/{account}/adclients/{adclient}
pub name: Option<String>,
/// Output only. Reporting product code of the ad client. For example, "AFC" for AdSense for Content. Corresponds to the `PRODUCT_CODE` dimension, and present only if the ad client supports reporting.
#[serde(rename="productCode")]
pub product_code: Option<String>,
/// Output only. Unique ID of the ad client as used in the `AD_CLIENT_ID` reporting dimension. Present only if the ad client supports reporting.
#[serde(rename="reportingDimensionId")]
pub reporting_dimension_id: Option<String>,
/// Output only. State of the ad client.
pub state: Option<String>,
}
impl client::ResponseResult for AdClient {}
/// Representation of the AdSense code for a given ad client. For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634).
///
/// # 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*).
///
/// * [adclients get adcode accounts](AccountAdclientGetAdcodeCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdClientAdCode {
/// Output only. The AdSense code snippet to add to the head of an HTML page.
#[serde(rename="adCode")]
pub ad_code: Option<String>,
/// Output only. The AdSense code snippet to add to the body of an AMP page.
#[serde(rename="ampBody")]
pub amp_body: Option<String>,
/// Output only. The AdSense code snippet to add to the head of an AMP page.
#[serde(rename="ampHead")]
pub amp_head: Option<String>,
}
impl client::ResponseResult for AdClientAdCode {}
/// Representation of an ad unit. An ad unit represents a saved ad unit with a specific set of ad settings that have been customized within an account.
///
/// # 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*).
///
/// * [adclients adunits create accounts](AccountAdclientAdunitCreateCall) (request|response)
/// * [adclients adunits get accounts](AccountAdclientAdunitGetCall) (response)
/// * [adclients adunits patch accounts](AccountAdclientAdunitPatchCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdUnit {
/// Required. Settings specific to content ads (AFC).
#[serde(rename="contentAdsSettings")]
pub content_ads_settings: Option<ContentAdsSettings>,
/// Required. Display name of the ad unit, as provided when the ad unit was created.
#[serde(rename="displayName")]
pub display_name: Option<String>,
/// Output only. Resource name of the ad unit. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
pub name: Option<String>,
/// Output only. Unique ID of the ad unit as used in the `AD_UNIT_ID` reporting dimension.
#[serde(rename="reportingDimensionId")]
pub reporting_dimension_id: Option<String>,
/// State of the ad unit.
pub state: Option<String>,
}
impl client::RequestValue for AdUnit {}
impl client::ResponseResult for AdUnit {}
/// Representation of the ad unit code for a given ad unit. For more information, see [About the AdSense code](https://support.google.com/adsense/answer/9274634) and [Where to place the ad code in your HTML](https://support.google.com/adsense/answer/9190028).
///
/// # 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*).
///
/// * [adclients adunits get adcode accounts](AccountAdclientAdunitGetAdcodeCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdUnitAdCode {
/// Output only. The code snippet to add to the body of an HTML page.
#[serde(rename="adCode")]
pub ad_code: Option<String>,
}
impl client::ResponseResult for AdUnitAdCode {}
/// Representation of an alert.
///
/// 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 Alert {
/// Output only. The localized alert message. This may contain HTML markup, such as phrase elements or links.
pub message: Option<String>,
/// Output only. Resource name of the alert. Format: accounts/{account}/alerts/{alert}
pub name: Option<String>,
/// Output only. Severity of this alert.
pub severity: Option<String>,
/// Output only. Type of alert. This identifies the broad type of this alert, and provides a stable machine-readable identifier that will not be translated. For example, "payment-hold".
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for Alert {}
/// Cell representation.
///
/// 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 Cell {
/// Value in the cell. The dimension cells contain strings, and the metric cells contain numbers.
pub value: Option<String>,
}
impl client::Part for Cell {}
/// Settings specific to content ads (AFC).
///
/// 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 ContentAdsSettings {
/// Required. Size of the ad unit. e.g. "728x90", "1x3" (for responsive ad units).
pub size: Option<String>,
/// Required. Type of the ad unit.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for ContentAdsSettings {}
/// Representation of a custom channel.
///
/// # 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*).
///
/// * [adclients customchannels create accounts](AccountAdclientCustomchannelCreateCall) (request|response)
/// * [adclients customchannels get accounts](AccountAdclientCustomchannelGetCall) (response)
/// * [adclients customchannels patch accounts](AccountAdclientCustomchannelPatchCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannel {
/// Whether the custom channel is active and collecting data. See https://support.google.com/adsense/answer/10077192.
pub active: Option<bool>,
/// Required. Display name of the custom channel.
#[serde(rename="displayName")]
pub display_name: Option<String>,
/// Output only. Resource name of the custom channel. Format: accounts/{account}/adclients/{adclient}/customchannels/{customchannel}
pub name: Option<String>,
/// Output only. Unique ID of the custom channel as used in the `CUSTOM_CHANNEL_ID` reporting dimension.
#[serde(rename="reportingDimensionId")]
pub reporting_dimension_id: Option<String>,
}
impl client::RequestValue for CustomChannel {}
impl client::ResponseResult for CustomChannel {}
/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
///
/// 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 Date {
/// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
pub day: Option<i32>,
/// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
pub month: Option<i32>,
/// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
pub year: Option<i32>,
}
impl client::Part for Date {}
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
///
/// # 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*).
///
/// * [adclients customchannels delete accounts](AccountAdclientCustomchannelDeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// The header information of the columns requested in the report.
///
/// 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 Header {
/// The [ISO-4217 currency code](https://en.wikipedia.org/wiki/ISO_4217) of this column. Only present if the header type is METRIC_CURRENCY.
#[serde(rename="currencyCode")]
pub currency_code: Option<String>,
/// Required. Name of the header.
pub name: Option<String>,
/// Required. Type of the header.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::Part for Header {}
/// Message that represents an arbitrary HTTP body. It should only be used for payload formats that cant be represented as JSON, such as raw binary or an HTML page. This message can be used both in streaming and non-streaming API methods in the request as well as the response. It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body. Example: message GetResourceRequest { // A unique request id. string request_id = 1; // The raw HTTP body is bound to this field. google.api.HttpBody http_body = 2; } service ResourceService { rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); rpc UpdateResource(google.api.HttpBody) returns (google.protobuf.Empty); } Example with streaming methods: service CaldavService { rpc GetCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); rpc UpdateCalendar(stream google.api.HttpBody) returns (stream google.api.HttpBody); } Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.
///
/// # 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*).
///
/// * [reports saved generate csv accounts](AccountReportSavedGenerateCsvCall) (response)
/// * [reports generate csv accounts](AccountReportGenerateCsvCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct HttpBody {
/// The HTTP Content-Type header value specifying the content type of the body.
#[serde(rename="contentType")]
pub content_type: Option<String>,
/// The HTTP request/response body as raw binary.
#[serde_as(as = "Option<::client::serde::urlsafe_base64::Wrapper>")]
pub data: Option<Vec<u8>>,
/// Application specific response metadata. Must be set in the first response for streaming APIs.
pub extensions: Option<Vec<HashMap<String, json::Value>>>,
}
impl client::ResponseResult for HttpBody {}
/// Response definition for the account list rpc.
///
/// # 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 accounts](AccountListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAccountsResponse {
/// The accounts returned in this list response.
pub accounts: Option<Vec<Account>>,
/// Continuation token used to page through accounts. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAccountsResponse {}
/// Response definition for the ad client list rpc.
///
/// # 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*).
///
/// * [adclients list accounts](AccountAdclientListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAdClientsResponse {
/// The ad clients returned in this list response.
#[serde(rename="adClients")]
pub ad_clients: Option<Vec<AdClient>>,
/// Continuation token used to page through ad clients. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAdClientsResponse {}
/// Response definition for the adunit list rpc.
///
/// # 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*).
///
/// * [adclients adunits list accounts](AccountAdclientAdunitListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAdUnitsResponse {
/// The ad units returned in the list response.
#[serde(rename="adUnits")]
pub ad_units: Option<Vec<AdUnit>>,
/// Continuation token used to page through ad units. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAdUnitsResponse {}
/// Response definition for the alerts list rpc.
///
/// # 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*).
///
/// * [alerts list accounts](AccountAlertListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAlertsResponse {
/// The alerts returned in this list response.
pub alerts: Option<Vec<Alert>>,
}
impl client::ResponseResult for ListAlertsResponse {}
/// Response definition for the child account list rpc.
///
/// # 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 child accounts accounts](AccountListChildAccountCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListChildAccountsResponse {
/// The accounts returned in this list response.
pub accounts: Option<Vec<Account>>,
/// Continuation token used to page through accounts. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListChildAccountsResponse {}
/// Response definition for the custom channel list rpc.
///
/// # 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*).
///
/// * [adclients customchannels list accounts](AccountAdclientCustomchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListCustomChannelsResponse {
/// The custom channels returned in this list response.
#[serde(rename="customChannels")]
pub custom_channels: Option<Vec<CustomChannel>>,
/// Continuation token used to page through alerts. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListCustomChannelsResponse {}
/// Response definition for the ad units linked to a custom channel list rpc.
///
/// # 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*).
///
/// * [adclients customchannels list linked ad units accounts](AccountAdclientCustomchannelListLinkedAdUnitCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListLinkedAdUnitsResponse {
/// The ad units returned in the list response.
#[serde(rename="adUnits")]
pub ad_units: Option<Vec<AdUnit>>,
/// Continuation token used to page through ad units. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListLinkedAdUnitsResponse {}
/// Response definition for the custom channels linked to an adunit list rpc.
///
/// # 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*).
///
/// * [adclients adunits list linked custom channels accounts](AccountAdclientAdunitListLinkedCustomChannelCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListLinkedCustomChannelsResponse {
/// The custom channels returned in this list response.
#[serde(rename="customChannels")]
pub custom_channels: Option<Vec<CustomChannel>>,
/// Continuation token used to page through alerts. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListLinkedCustomChannelsResponse {}
/// Response definition for the payments list rpc.
///
/// # 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*).
///
/// * [payments list accounts](AccountPaymentListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListPaymentsResponse {
/// The payments returned in this list response.
pub payments: Option<Vec<Payment>>,
}
impl client::ResponseResult for ListPaymentsResponse {}
/// Response definition for the saved reports list rpc.
///
/// # 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*).
///
/// * [reports saved list accounts](AccountReportSavedListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListSavedReportsResponse {
/// Continuation token used to page through reports. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// The reports returned in this list response.
#[serde(rename="savedReports")]
pub saved_reports: Option<Vec<SavedReport>>,
}
impl client::ResponseResult for ListSavedReportsResponse {}
/// Response definition for the sites list rpc.
///
/// # 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*).
///
/// * [sites list accounts](AccountSiteListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListSitesResponse {
/// Continuation token used to page through sites. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// The sites returned in this list response.
pub sites: Option<Vec<Site>>,
}
impl client::ResponseResult for ListSitesResponse {}
/// Response definition for the url channels list rpc.
///
/// # 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*).
///
/// * [adclients urlchannels list accounts](AccountAdclientUrlchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListUrlChannelsResponse {
/// Continuation token used to page through url channels. To retrieve the next page of the results, set the next request's "page_token" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// The url channels returned in this list response.
#[serde(rename="urlChannels")]
pub url_channels: Option<Vec<UrlChannel>>,
}
impl client::ResponseResult for ListUrlChannelsResponse {}
/// Representation of an unpaid or paid payment. See [Payment timelines for AdSense](https://support.google.com/adsense/answer/7164703) for more information about payments and the [YouTube homepage and payments account](https://support.google.com/adsense/answer/11622510) article for information about dedicated payments accounts for YouTube.
///
/// 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 Payment {
/// Output only. The amount of unpaid or paid earnings, as a formatted string, including the currency. E.g. "¥1,235 JPY", "$1,234.57", "£87.65".
pub amount: Option<String>,
/// Output only. For paid earnings, the date that the payment was credited. For unpaid earnings, this field is empty. Payment dates are always returned in the billing timezone (America/Los_Angeles).
pub date: Option<Date>,
/// Output only. Resource name of the payment. Format: - accounts/{account}/payments/unpaid for unpaid (current) AdSense earnings. - accounts/{account}/payments/youtube-unpaid for unpaid (current) YouTube earnings. - accounts/{account}/payments/yyyy-MM-dd for paid AdSense earnings. - accounts/{account}/payments/youtube-yyyy-MM-dd for paid YouTube earnings.
pub name: Option<String>,
}
impl client::Part for Payment {}
/// Result of a generated report.
///
/// # 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*).
///
/// * [reports saved generate accounts](AccountReportSavedGenerateCall) (response)
/// * [reports generate accounts](AccountReportGenerateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ReportResult {
/// The averages of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub averages: Option<Row>,
/// Required. End date of the range (inclusive).
#[serde(rename="endDate")]
pub end_date: Option<Date>,
/// The header information; one for each dimension in the request, followed by one for each metric in the request.
pub headers: Option<Vec<Header>>,
/// The output rows of the report. Each row is a list of cells; one for each dimension in the request, followed by one for each metric in the request.
pub rows: Option<Vec<Row>>,
/// Required. Start date of the range (inclusive).
#[serde(rename="startDate")]
pub start_date: Option<Date>,
/// The total number of rows matched by the report request.
#[serde(rename="totalMatchedRows")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub total_matched_rows: Option<i64>,
/// The totals of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub totals: Option<Row>,
/// Any warnings associated with generation of the report. These warnings are always returned in English.
pub warnings: Option<Vec<String>>,
}
impl client::ResponseResult for ReportResult {}
/// Row representation.
///
/// 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 Row {
/// Cells in the row.
pub cells: Option<Vec<Cell>>,
}
impl client::Part for Row {}
/// Representation of a saved report.
///
/// # 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*).
///
/// * [reports get saved accounts](AccountReportGetSavedCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct SavedReport {
/// Output only. Resource name of the report. Format: accounts/{account}/reports/{report}
pub name: Option<String>,
/// Report title as specified by publisher.
pub title: Option<String>,
}
impl client::ResponseResult for SavedReport {}
/// Representation of a Site.
///
/// # 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*).
///
/// * [sites get accounts](AccountSiteGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Site {
/// Whether auto ads is turned on for the site.
#[serde(rename="autoAdsEnabled")]
pub auto_ads_enabled: Option<bool>,
/// Domain (or subdomain) of the site, e.g. "example.com" or "www.example.com". This is used in the `OWNED_SITE_DOMAIN_NAME` reporting dimension.
pub domain: Option<String>,
/// Output only. Resource name of a site. Format: accounts/{account}/sites/{site}
pub name: Option<String>,
/// Output only. Unique ID of the site as used in the `OWNED_SITE_ID` reporting dimension.
#[serde(rename="reportingDimensionId")]
pub reporting_dimension_id: Option<String>,
/// Output only. State of a site.
pub state: Option<String>,
}
impl client::ResponseResult for Site {}
/// Represents a time zone from the [IANA Time Zone Database](https://www.iana.org/time-zones).
///
/// 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 TimeZone {
/// IANA Time Zone Database time zone, e.g. "America/New_York".
pub id: Option<String>,
/// Optional. IANA Time Zone Database version number, e.g. "2019a".
pub version: Option<String>,
}
impl client::Part for TimeZone {}
/// Representation of a URL channel. URL channels allow you to track the performance of particular pages in your site; see [URL channels](https://support.google.com/adsense/answer/2923836) for more information.
///
/// # 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*).
///
/// * [adclients urlchannels get accounts](AccountAdclientUrlchannelGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UrlChannel {
/// Output only. Resource name of the URL channel. Format: accounts/{account}/adclients/{adclient}/urlchannels/{urlchannel}
pub name: Option<String>,
/// Output only. Unique ID of the custom channel as used in the `URL_CHANNEL_ID` reporting dimension.
#[serde(rename="reportingDimensionId")]
pub reporting_dimension_id: Option<String>,
/// URI pattern of the channel. Does not include "http://" or "https://". Example: www.example.com/home
#[serde(rename="uriPattern")]
pub uri_pattern: Option<String>,
}
impl client::ResponseResult for UrlChannel {}

View File

@@ -0,0 +1,28 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage your AdSense data
Full,
/// View your AdSense data
Readonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::Full => "https://www.googleapis.com/auth/adsense",
Scope::Readonly => "https://www.googleapis.com/auth/adsense.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::Readonly
}
}

View File

@@ -0,0 +1,128 @@
use super::*;
/// Central instance to access all AdSenseHost related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
/// use adsensehost4d1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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(51)
/// .add_sort("sed")
/// .add_metric("ut")
/// .max_results(89)
/// .locale("rebum.")
/// .add_filter("est")
/// .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),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct AdSenseHost<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AdSenseHost<S> {}
impl<'a, S> AdSenseHost<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AdSenseHost<S> {
AdSenseHost {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://www.googleapis.com/adsensehost/v4.1/".to_string(),
_root_url: "https://www.googleapis.com/".to_string(),
}
}
pub fn accounts(&'a self) -> AccountMethods<'a, S> {
AccountMethods { hub: &self }
}
pub fn adclients(&'a self) -> AdclientMethods<'a, S> {
AdclientMethods { hub: &self }
}
pub fn associationsessions(&'a self) -> AssociationsessionMethods<'a, S> {
AssociationsessionMethods { hub: &self }
}
pub fn customchannels(&'a self) -> CustomchannelMethods<'a, S> {
CustomchannelMethods { hub: &self }
}
pub fn reports(&'a self) -> ReportMethods<'a, S> {
ReportMethods { hub: &self }
}
pub fn urlchannels(&'a self) -> UrlchannelMethods<'a, S> {
UrlchannelMethods { 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.3`.
///
/// 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://www.googleapis.com/adsensehost/v4.1/`.
///
/// 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://www.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)
}
}

View File

@@ -0,0 +1,767 @@
use super::*;
/// A builder providing access to all methods supported on *account* resources.
/// It is not used directly, but through the [`AdSenseHost`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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 `adclients_get(...)`, `adclients_list(...)`, `adunits_delete(...)`, `adunits_get(...)`, `adunits_get_ad_code(...)`, `adunits_insert(...)`, `adunits_list(...)`, `adunits_patch(...)`, `adunits_update(...)`, `get(...)`, `list(...)` and `reports_generate(...)`
/// // to build up your call.
/// let rb = hub.accounts();
/// # }
/// ```
pub struct AccountMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdSenseHost<S>,
}
impl<'a, S> client::MethodsBuilder for AccountMethods<'a, S> {}
impl<'a, S> AccountMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Get information about one of the ad clients in the specified publisher's AdSense account.
///
/// # Arguments
///
/// * `accountId` - Account which contains the ad client.
/// * `adClientId` - Ad client to get.
pub fn adclients_get(&self, account_id: &str, ad_client_id: &str) -> AccountAdclientGetCall<'a, S> {
AccountAdclientGetCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all hosted ad clients in the specified hosted account.
///
/// # Arguments
///
/// * `accountId` - Account for which to list ad clients.
pub fn adclients_list(&self, account_id: &str) -> AccountAdclientListCall<'a, S> {
AccountAdclientListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Delete the specified ad unit from the specified publisher AdSense account.
///
/// # Arguments
///
/// * `accountId` - Account which contains the ad unit.
/// * `adClientId` - Ad client for which to get ad unit.
/// * `adUnitId` - Ad unit to delete.
pub fn adunits_delete(&self, account_id: &str, ad_client_id: &str, ad_unit_id: &str) -> AccountAdunitDeleteCall<'a, S> {
AccountAdunitDeleteCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_ad_unit_id: ad_unit_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get the specified host ad unit in this AdSense account.
///
/// # Arguments
///
/// * `accountId` - Account which contains the ad unit.
/// * `adClientId` - Ad client for which to get ad unit.
/// * `adUnitId` - Ad unit to get.
pub fn adunits_get(&self, account_id: &str, ad_client_id: &str, ad_unit_id: &str) -> AccountAdunitGetCall<'a, S> {
AccountAdunitGetCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_ad_unit_id: ad_unit_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get ad code for the specified ad unit, attaching the specified host custom channels.
///
/// # Arguments
///
/// * `accountId` - Account which contains the ad client.
/// * `adClientId` - Ad client with contains the ad unit.
/// * `adUnitId` - Ad unit to get the code for.
pub fn adunits_get_ad_code(&self, account_id: &str, ad_client_id: &str, ad_unit_id: &str) -> AccountAdunitGetAdCodeCall<'a, S> {
AccountAdunitGetAdCodeCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_ad_unit_id: ad_unit_id.to_string(),
_host_custom_channel_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Insert the supplied ad unit into the specified publisher AdSense account.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - Account which will contain the ad unit.
/// * `adClientId` - Ad client into which to insert the ad unit.
pub fn adunits_insert(&self, request: AdUnit, account_id: &str, ad_client_id: &str) -> AccountAdunitInsertCall<'a, S> {
AccountAdunitInsertCall {
hub: self.hub,
_request: request,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all ad units in the specified publisher's AdSense account.
///
/// # Arguments
///
/// * `accountId` - Account which contains the ad client.
/// * `adClientId` - Ad client for which to list ad units.
pub fn adunits_list(&self, account_id: &str, ad_client_id: &str) -> AccountAdunitListCall<'a, S> {
AccountAdunitListCall {
hub: self.hub,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_include_inactive: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update the supplied ad unit in the specified publisher AdSense account. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - Account which contains the ad client.
/// * `adClientId` - Ad client which contains the ad unit.
/// * `adUnitId` - Ad unit to get.
pub fn adunits_patch(&self, request: AdUnit, account_id: &str, ad_client_id: &str, ad_unit_id: &str) -> AccountAdunitPatchCall<'a, S> {
AccountAdunitPatchCall {
hub: self.hub,
_request: request,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_ad_unit_id: ad_unit_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update the supplied ad unit in the specified publisher AdSense account.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `accountId` - Account which contains the ad client.
/// * `adClientId` - Ad client which contains the ad unit.
pub fn adunits_update(&self, request: AdUnit, account_id: &str, ad_client_id: &str) -> AccountAdunitUpdateCall<'a, S> {
AccountAdunitUpdateCall {
hub: self.hub,
_request: request,
_account_id: account_id.to_string(),
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
///
/// # Arguments
///
/// * `accountId` - Hosted account upon which to report.
/// * `startDate` - Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
/// * `endDate` - End of the date range to report on in "YYYY-MM-DD" format, inclusive.
pub fn reports_generate(&self, account_id: &str, start_date: &str, end_date: &str) -> AccountReportGenerateCall<'a, S> {
AccountReportGenerateCall {
hub: self.hub,
_account_id: account_id.to_string(),
_start_date: start_date.to_string(),
_end_date: end_date.to_string(),
_start_index: Default::default(),
_sort: Default::default(),
_metric: Default::default(),
_max_results: Default::default(),
_locale: Default::default(),
_filter: Default::default(),
_dimension: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get information about the selected associated AdSense account.
///
/// # Arguments
///
/// * `accountId` - Account to get information about.
pub fn get(&self, account_id: &str) -> AccountGetCall<'a, S> {
AccountGetCall {
hub: self.hub,
_account_id: account_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List hosted accounts associated with this AdSense account by ad client id.
///
/// # Arguments
///
/// * `filterAdClientId` - Ad clients to list accounts for.
pub fn list(&self, filter_ad_client_id: &Vec<String>) -> AccountListCall<'a, S> {
AccountListCall {
hub: self.hub,
_filter_ad_client_id: filter_ad_client_id.clone(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *adclient* resources.
/// It is not used directly, but through the [`AdSenseHost`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.adclients();
/// # }
/// ```
pub struct AdclientMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdSenseHost<S>,
}
impl<'a, S> client::MethodsBuilder for AdclientMethods<'a, S> {}
impl<'a, S> AdclientMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Get information about one of the ad clients in the Host AdSense account.
///
/// # Arguments
///
/// * `adClientId` - Ad client to get.
pub fn get(&self, ad_client_id: &str) -> AdclientGetCall<'a, S> {
AdclientGetCall {
hub: self.hub,
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all host ad clients in this AdSense account.
pub fn list(&self) -> AdclientListCall<'a, S> {
AdclientListCall {
hub: self.hub,
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *associationsession* resources.
/// It is not used directly, but through the [`AdSenseHost`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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 `start(...)` and `verify(...)`
/// // to build up your call.
/// let rb = hub.associationsessions();
/// # }
/// ```
pub struct AssociationsessionMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdSenseHost<S>,
}
impl<'a, S> client::MethodsBuilder for AssociationsessionMethods<'a, S> {}
impl<'a, S> AssociationsessionMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Create an association session for initiating an association with an AdSense user.
///
/// # Arguments
///
/// * `productCode` - Products to associate with the user.
/// * `websiteUrl` - The URL of the user's hosted website.
pub fn start(&self, product_code: &Vec<String>, website_url: &str) -> AssociationsessionStartCall<'a, S> {
AssociationsessionStartCall {
hub: self.hub,
_product_code: product_code.clone(),
_website_url: website_url.to_string(),
_website_locale: Default::default(),
_user_locale: Default::default(),
_callback_url: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Verify an association session after the association callback returns from AdSense signup.
///
/// # Arguments
///
/// * `token` - The token returned to the association callback URL.
pub fn verify(&self, token: &str) -> AssociationsessionVerifyCall<'a, S> {
AssociationsessionVerifyCall {
hub: self.hub,
_token: token.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *customchannel* resources.
/// It is not used directly, but through the [`AdSenseHost`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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 `delete(...)`, `get(...)`, `insert(...)`, `list(...)`, `patch(...)` and `update(...)`
/// // to build up your call.
/// let rb = hub.customchannels();
/// # }
/// ```
pub struct CustomchannelMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdSenseHost<S>,
}
impl<'a, S> client::MethodsBuilder for CustomchannelMethods<'a, S> {}
impl<'a, S> CustomchannelMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Delete a specific custom channel from the host AdSense account.
///
/// # Arguments
///
/// * `adClientId` - Ad client from which to delete the custom channel.
/// * `customChannelId` - Custom channel to delete.
pub fn delete(&self, ad_client_id: &str, custom_channel_id: &str) -> CustomchannelDeleteCall<'a, S> {
CustomchannelDeleteCall {
hub: self.hub,
_ad_client_id: ad_client_id.to_string(),
_custom_channel_id: custom_channel_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Get a specific custom channel from the host AdSense account.
///
/// # Arguments
///
/// * `adClientId` - Ad client from which to get the custom channel.
/// * `customChannelId` - Custom channel to get.
pub fn get(&self, ad_client_id: &str, custom_channel_id: &str) -> CustomchannelGetCall<'a, S> {
CustomchannelGetCall {
hub: self.hub,
_ad_client_id: ad_client_id.to_string(),
_custom_channel_id: custom_channel_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Add a new custom channel to the host AdSense account.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `adClientId` - Ad client to which the new custom channel will be added.
pub fn insert(&self, request: CustomChannel, ad_client_id: &str) -> CustomchannelInsertCall<'a, S> {
CustomchannelInsertCall {
hub: self.hub,
_request: request,
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all host custom channels in this AdSense account.
///
/// # Arguments
///
/// * `adClientId` - Ad client for which to list custom channels.
pub fn list(&self, ad_client_id: &str) -> CustomchannelListCall<'a, S> {
CustomchannelListCall {
hub: self.hub,
_ad_client_id: ad_client_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update a custom channel in the host AdSense account. This method supports patch semantics.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `adClientId` - Ad client in which the custom channel will be updated.
/// * `customChannelId` - Custom channel to get.
pub fn patch(&self, request: CustomChannel, ad_client_id: &str, custom_channel_id: &str) -> CustomchannelPatchCall<'a, S> {
CustomchannelPatchCall {
hub: self.hub,
_request: request,
_ad_client_id: ad_client_id.to_string(),
_custom_channel_id: custom_channel_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Update a custom channel in the host AdSense account.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `adClientId` - Ad client in which the custom channel will be updated.
pub fn update(&self, request: CustomChannel, ad_client_id: &str) -> CustomchannelUpdateCall<'a, S> {
CustomchannelUpdateCall {
hub: self.hub,
_request: request,
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *report* resources.
/// It is not used directly, but through the [`AdSenseHost`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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 `generate(...)`
/// // to build up your call.
/// let rb = hub.reports();
/// # }
/// ```
pub struct ReportMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdSenseHost<S>,
}
impl<'a, S> client::MethodsBuilder for ReportMethods<'a, S> {}
impl<'a, S> ReportMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
///
/// # Arguments
///
/// * `startDate` - Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
/// * `endDate` - End of the date range to report on in "YYYY-MM-DD" format, inclusive.
pub fn generate(&self, start_date: &str, end_date: &str) -> ReportGenerateCall<'a, S> {
ReportGenerateCall {
hub: self.hub,
_start_date: start_date.to_string(),
_end_date: end_date.to_string(),
_start_index: Default::default(),
_sort: Default::default(),
_metric: Default::default(),
_max_results: Default::default(),
_locale: Default::default(),
_filter: Default::default(),
_dimension: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all methods supported on *urlchannel* resources.
/// It is not used directly, but through the [`AdSenseHost`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_adsensehost4d1 as adsensehost4d1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use adsensehost4d1::{AdSenseHost, 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 = AdSenseHost::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 `delete(...)`, `insert(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.urlchannels();
/// # }
/// ```
pub struct UrlchannelMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AdSenseHost<S>,
}
impl<'a, S> client::MethodsBuilder for UrlchannelMethods<'a, S> {}
impl<'a, S> UrlchannelMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Delete a URL channel from the host AdSense account.
///
/// # Arguments
///
/// * `adClientId` - Ad client from which to delete the URL channel.
/// * `urlChannelId` - URL channel to delete.
pub fn delete(&self, ad_client_id: &str, url_channel_id: &str) -> UrlchannelDeleteCall<'a, S> {
UrlchannelDeleteCall {
hub: self.hub,
_ad_client_id: ad_client_id.to_string(),
_url_channel_id: url_channel_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Add a new URL channel to the host AdSense account.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `adClientId` - Ad client to which the new URL channel will be added.
pub fn insert(&self, request: UrlChannel, ad_client_id: &str) -> UrlchannelInsertCall<'a, S> {
UrlchannelInsertCall {
hub: self.hub,
_request: request,
_ad_client_id: ad_client_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// List all host URL channels in the host AdSense account.
///
/// # Arguments
///
/// * `adClientId` - Ad client for which to list URL channels.
pub fn list(&self, ad_client_id: &str) -> UrlchannelListCall<'a, S> {
UrlchannelListCall {
hub: self.hub,
_ad_client_id: ad_client_id.to_string(),
_page_token: Default::default(),
_max_results: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,619 @@
use super::*;
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients get accounts](AccountAdclientGetCall) (none)
/// * [adclients list accounts](AccountAdclientListCall) (none)
/// * [adunits delete accounts](AccountAdunitDeleteCall) (none)
/// * [adunits get accounts](AccountAdunitGetCall) (none)
/// * [adunits get ad code accounts](AccountAdunitGetAdCodeCall) (none)
/// * [adunits insert accounts](AccountAdunitInsertCall) (none)
/// * [adunits list accounts](AccountAdunitListCall) (none)
/// * [adunits patch accounts](AccountAdunitPatchCall) (none)
/// * [adunits update accounts](AccountAdunitUpdateCall) (none)
/// * [reports generate accounts](AccountReportGenerateCall) (none)
/// * [get accounts](AccountGetCall) (response)
/// * [list accounts](AccountListCall) (none)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Account {
/// Unique identifier of this account.
pub id: Option<String>,
/// Kind of resource this is, in this case adsensehost#account.
pub kind: Option<String>,
/// Name of this account.
pub name: Option<String>,
/// Approval status of this account. One of: PENDING, APPROVED, DISABLED.
pub status: Option<String>,
}
impl client::Resource for Account {}
impl client::ResponseResult for Account {}
/// There is no detailed description.
///
/// # 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 accounts](AccountListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Accounts {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The accounts returned in this list response.
pub items: Option<Vec<Account>>,
/// Kind of list this is, in this case adsensehost#accounts.
pub kind: Option<String>,
}
impl client::ResponseResult for Accounts {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients get accounts](AccountAdclientGetCall) (response)
/// * [get adclients](AdclientGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdClient {
/// Whether this ad client is opted in to ARC.
#[serde(rename="arcOptIn")]
pub arc_opt_in: Option<bool>,
/// Unique identifier of this ad client.
pub id: Option<String>,
/// Kind of resource this is, in this case adsensehost#adClient.
pub kind: Option<String>,
/// This ad client's product code, which corresponds to the PRODUCT_CODE report dimension.
#[serde(rename="productCode")]
pub product_code: Option<String>,
/// Whether this ad client supports being reported on.
#[serde(rename="supportsReporting")]
pub supports_reporting: Option<bool>,
}
impl client::Resource for AdClient {}
impl client::ResponseResult for AdClient {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adclients list accounts](AccountAdclientListCall) (response)
/// * [list adclients](AdclientListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdClients {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The ad clients returned in this list response.
pub items: Option<Vec<AdClient>>,
/// Kind of list this is, in this case adsensehost#adClients.
pub kind: Option<String>,
/// Continuation token used to page through ad clients. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for AdClients {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adunits get ad code accounts](AccountAdunitGetAdCodeCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdCode {
/// The ad code snippet.
#[serde(rename="adCode")]
pub ad_code: Option<String>,
/// Kind this is, in this case adsensehost#adCode.
pub kind: Option<String>,
}
impl client::ResponseResult for AdCode {}
/// There is no detailed description.
///
/// 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 AdStyle {
/// The colors included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
pub colors: Option<AdStyleColors>,
/// The style of the corners in the ad (deprecated: never populated, ignored).
pub corners: Option<String>,
/// The font which is included in the style.
pub font: Option<AdStyleFont>,
/// Kind this is, in this case adsensehost#adStyle.
pub kind: Option<String>,
}
impl client::Part for AdStyle {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adunits delete accounts](AccountAdunitDeleteCall) (response)
/// * [adunits get accounts](AccountAdunitGetCall) (response)
/// * [adunits insert accounts](AccountAdunitInsertCall) (request|response)
/// * [adunits patch accounts](AccountAdunitPatchCall) (request|response)
/// * [adunits update accounts](AccountAdunitUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdUnit {
/// Identity code of this ad unit, not necessarily unique across ad clients.
pub code: Option<String>,
/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated).
#[serde(rename="contentAdsSettings")]
pub content_ads_settings: Option<AdUnitContentAdsSettings>,
/// Custom style information specific to this ad unit.
#[serde(rename="customStyle")]
pub custom_style: Option<AdStyle>,
/// Unique identifier of this ad unit. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsensehost#adUnit.
pub kind: Option<String>,
/// Settings specific to WAP mobile content ads (AFMC - deprecated).
#[serde(rename="mobileContentAdsSettings")]
pub mobile_content_ads_settings: Option<AdUnitMobileContentAdsSettings>,
/// Name of this ad unit.
pub name: Option<String>,
/// Status of this ad unit. Possible values are:
/// NEW: Indicates that the ad unit was created within the last seven days and does not yet have any activity associated with it.
///
/// ACTIVE: Indicates that there has been activity on this ad unit in the last seven days.
///
/// INACTIVE: Indicates that there has been no activity on this ad unit in the last seven days.
pub status: Option<String>,
}
impl client::RequestValue for AdUnit {}
impl client::ResponseResult for AdUnit {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [adunits list accounts](AccountAdunitListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AdUnits {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The ad units returned in this list response.
pub items: Option<Vec<AdUnit>>,
/// Kind of list this is, in this case adsensehost#adUnits.
pub kind: Option<String>,
/// Continuation token used to page through ad units. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for AdUnits {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [start associationsessions](AssociationsessionStartCall) (response)
/// * [verify associationsessions](AssociationsessionVerifyCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AssociationSession {
/// Hosted account id of the associated publisher after association. Present if status is ACCEPTED.
#[serde(rename="accountId")]
pub account_id: Option<String>,
/// Unique identifier of this association session.
pub id: Option<String>,
/// Kind of resource this is, in this case adsensehost#associationSession.
pub kind: Option<String>,
/// The products to associate with the user. Options: AFC, AFG, AFV, AFS (deprecated), AFMC (deprecated)
#[serde(rename="productCodes")]
pub product_codes: Option<Vec<String>>,
/// Redirect URL of this association session. Used to redirect users into the AdSense association flow.
#[serde(rename="redirectUrl")]
pub redirect_url: Option<String>,
/// Status of the completed association, available once the association callback token has been verified. One of ACCEPTED, REJECTED, or ERROR.
pub status: Option<String>,
/// The preferred locale of the user themselves when going through the AdSense association flow.
#[serde(rename="userLocale")]
pub user_locale: Option<String>,
/// The locale of the user's hosted website.
#[serde(rename="websiteLocale")]
pub website_locale: Option<String>,
/// The URL of the user's hosted website.
#[serde(rename="websiteUrl")]
pub website_url: Option<String>,
}
impl client::Resource for AssociationSession {}
impl client::ResponseResult for AssociationSession {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [delete customchannels](CustomchannelDeleteCall) (response)
/// * [get customchannels](CustomchannelGetCall) (response)
/// * [insert customchannels](CustomchannelInsertCall) (request|response)
/// * [patch customchannels](CustomchannelPatchCall) (request|response)
/// * [update customchannels](CustomchannelUpdateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannel {
/// Code of this custom channel, not necessarily unique across ad clients.
pub code: Option<String>,
/// Unique identifier of this custom channel. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsensehost#customChannel.
pub kind: Option<String>,
/// Name of this custom channel.
pub name: Option<String>,
}
impl client::RequestValue for CustomChannel {}
impl client::Resource for CustomChannel {}
impl client::ResponseResult for CustomChannel {}
/// There is no detailed description.
///
/// # 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 customchannels](CustomchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct CustomChannels {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The custom channels returned in this list response.
pub items: Option<Vec<CustomChannel>>,
/// Kind of list this is, in this case adsensehost#customChannels.
pub kind: Option<String>,
/// Continuation token used to page through custom channels. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for CustomChannels {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [reports generate accounts](AccountReportGenerateCall) (response)
/// * [generate reports](ReportGenerateCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Report {
/// The averages of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub averages: Option<Vec<String>>,
/// The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
pub headers: Option<Vec<ReportHeaders>>,
/// Kind this is, in this case adsensehost#report.
pub kind: Option<String>,
/// The output rows of the report. Each row is a list of cells; one for each dimension in the request, followed by one for each metric in the request. The dimension cells contain strings, and the metric cells contain numbers.
pub rows: Option<Vec<Vec<String>>>,
/// The total number of rows matched by the report request. Fewer rows may be returned in the response due to being limited by the row count requested or the report row limit.
#[serde(rename="totalMatchedRows")]
#[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")]
pub total_matched_rows: Option<i64>,
/// The totals of the report. This is the same length as any other row in the report; cells corresponding to dimension columns are empty.
pub totals: Option<Vec<String>>,
/// Any warnings associated with generation of the report.
pub warnings: Option<Vec<String>>,
}
impl client::Resource for Report {}
impl client::ResponseResult for Report {}
/// There is no detailed description.
///
/// # 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*).
///
/// * [delete urlchannels](UrlchannelDeleteCall) (response)
/// * [insert urlchannels](UrlchannelInsertCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UrlChannel {
/// Unique identifier of this URL channel. This should be considered an opaque identifier; it is not safe to rely on it being in any particular format.
pub id: Option<String>,
/// Kind of resource this is, in this case adsensehost#urlChannel.
pub kind: Option<String>,
/// URL Pattern of this URL channel. Does not include "http://" or "https://". Example: www.example.com/home
#[serde(rename="urlPattern")]
pub url_pattern: Option<String>,
}
impl client::RequestValue for UrlChannel {}
impl client::Resource for UrlChannel {}
impl client::ResponseResult for UrlChannel {}
/// There is no detailed description.
///
/// # 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 urlchannels](UrlchannelListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UrlChannels {
/// ETag of this response for caching purposes.
pub etag: Option<String>,
/// The URL channels returned in this list response.
pub items: Option<Vec<UrlChannel>>,
/// Kind of list this is, in this case adsensehost#urlChannels.
pub kind: Option<String>,
/// Continuation token used to page through URL channels. To retrieve the next page of results, set the next request's "pageToken" value to this.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for UrlChannels {}
/// The colors included in the style. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
///
/// 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 AdStyleColors {
/// The color of the ad background.
pub background: Option<String>,
/// The color of the ad border.
pub border: Option<String>,
/// The color of the ad text.
pub text: Option<String>,
/// The color of the ad title.
pub title: Option<String>,
/// The color of the ad url.
pub url: Option<String>,
}
impl client::NestedType for AdStyleColors {}
impl client::Part for AdStyleColors {}
/// The font which is included in the style.
///
/// 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 AdStyleFont {
/// The family of the font. Possible values are: ACCOUNT_DEFAULT_FAMILY, ADSENSE_DEFAULT_FAMILY, ARIAL, TIMES and VERDANA.
pub family: Option<String>,
/// The size of the font. Possible values are: ACCOUNT_DEFAULT_SIZE, ADSENSE_DEFAULT_SIZE, SMALL, MEDIUM and LARGE.
pub size: Option<String>,
}
impl client::NestedType for AdStyleFont {}
impl client::Part for AdStyleFont {}
/// Settings specific to content ads (AFC) and highend mobile content ads (AFMC - deprecated).
///
/// 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 AdUnitContentAdsSettings {
/// The backup option to be used in instances where no ad is available.
#[serde(rename="backupOption")]
pub backup_option: Option<AdUnitContentAdsSettingsBackupOption>,
/// Size of this ad unit. Size values are in the form SIZE_{width}_{height}.
pub size: Option<String>,
/// Type of this ad unit. Possible values are TEXT, TEXT_IMAGE, IMAGE and LINK.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for AdUnitContentAdsSettings {}
impl client::Part for AdUnitContentAdsSettings {}
/// The backup option to be used in instances where no ad is available.
///
/// 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 AdUnitContentAdsSettingsBackupOption {
/// Color to use when type is set to COLOR. These are represented as six hexadecimal characters, similar to HTML color codes, but without the leading hash.
pub color: Option<String>,
/// Type of the backup option. Possible values are BLANK, COLOR and URL.
#[serde(rename="type")]
pub type_: Option<String>,
/// URL to use when type is set to URL.
pub url: Option<String>,
}
impl client::NestedType for AdUnitContentAdsSettingsBackupOption {}
impl client::Part for AdUnitContentAdsSettingsBackupOption {}
/// Settings specific to WAP mobile content ads (AFMC - deprecated).
///
/// 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 AdUnitMobileContentAdsSettings {
/// The markup language to use for this ad unit.
#[serde(rename="markupLanguage")]
pub markup_language: Option<String>,
/// The scripting language to use for this ad unit.
#[serde(rename="scriptingLanguage")]
pub scripting_language: Option<String>,
/// Size of this ad unit.
pub size: Option<String>,
/// Type of this ad unit.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for AdUnitMobileContentAdsSettings {}
impl client::Part for AdUnitMobileContentAdsSettings {}
/// The header information of the columns requested in the report. This is a list of headers; one for each dimension in the request, followed by one for each metric in the request.
///
/// 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 ReportHeaders {
/// The currency of this column. Only present if the header type is METRIC_CURRENCY.
pub currency: Option<String>,
/// The name of the header.
pub name: Option<String>,
/// The type of the header; one of DIMENSION, METRIC_TALLY, METRIC_RATIO, or METRIC_CURRENCY.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::NestedType for ReportHeaders {}
impl client::Part for ReportHeaders {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// View and manage your AdSense host data and associated accounts
Full,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::Full => "https://www.googleapis.com/auth/adsensehost",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::Full
}
}

View File

@@ -0,0 +1,114 @@
use super::*;
/// Central instance to access all AlertCenter related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_alertcenter1_beta1 as alertcenter1_beta1;
/// use alertcenter1_beta1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use alertcenter1_beta1::{AlertCenter, 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 = AlertCenter::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.alerts().list()
/// .page_token("amet.")
/// .page_size(-20)
/// .order_by("ipsum")
/// .filter("gubergren")
/// .customer_id("Lorem")
/// .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 AlertCenter<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for AlertCenter<S> {}
impl<'a, S> AlertCenter<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> AlertCenter<S> {
AlertCenter {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://alertcenter.googleapis.com/".to_string(),
_root_url: "https://alertcenter.googleapis.com/".to_string(),
}
}
pub fn alerts(&'a self) -> AlertMethods<'a, S> {
AlertMethods { hub: &self }
}
pub fn methods(&'a self) -> MethodMethods<'a, S> {
MethodMethods { 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.3`.
///
/// 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://alertcenter.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://alertcenter.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)
}
}

View File

@@ -0,0 +1,277 @@
use super::*;
/// A builder providing access to all methods supported on *alert* resources.
/// It is not used directly, but through the [`AlertCenter`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_alertcenter1_beta1 as alertcenter1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use alertcenter1_beta1::{AlertCenter, 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 = AlertCenter::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_delete(...)`, `batch_undelete(...)`, `delete(...)`, `feedback_create(...)`, `feedback_list(...)`, `get(...)`, `get_metadata(...)`, `list(...)` and `undelete(...)`
/// // to build up your call.
/// let rb = hub.alerts();
/// # }
/// ```
pub struct AlertMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AlertCenter<S>,
}
impl<'a, S> client::MethodsBuilder for AlertMethods<'a, S> {}
impl<'a, S> AlertMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Creates new feedback for an alert. Attempting to create a feedback for a non-existent alert returns `NOT_FOUND` error. Attempting to create a feedback for an alert that is marked for deletion returns `FAILED_PRECONDITION' error.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `alertId` - Required. The identifier of the alert this feedback belongs to.
pub fn feedback_create(&self, request: AlertFeedback, alert_id: &str) -> AlertFeedbackCreateCall<'a, S> {
AlertFeedbackCreateCall {
hub: self.hub,
_request: request,
_alert_id: alert_id.to_string(),
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all the feedback for an alert. Attempting to list feedbacks for a non-existent alert returns `NOT_FOUND` error.
///
/// # Arguments
///
/// * `alertId` - Required. The alert identifier. The "-" wildcard could be used to represent all alerts.
pub fn feedback_list(&self, alert_id: &str) -> AlertFeedbackListCall<'a, S> {
AlertFeedbackListCall {
hub: self.hub,
_alert_id: alert_id.to_string(),
_filter: Default::default(),
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Performs batch delete operation on alerts.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn batch_delete(&self, request: BatchDeleteAlertsRequest) -> AlertBatchDeleteCall<'a, S> {
AlertBatchDeleteCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Performs batch undelete operation on alerts.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn batch_undelete(&self, request: BatchUndeleteAlertsRequest) -> AlertBatchUndeleteCall<'a, S> {
AlertBatchUndeleteCall {
hub: self.hub,
_request: request,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Marks the specified alert for deletion. An alert that has been marked for deletion is removed from Alert Center after 30 days. Marking an alert for deletion has no effect on an alert which has already been marked for deletion. Attempting to mark a nonexistent alert for deletion results in a `NOT_FOUND` error.
///
/// # Arguments
///
/// * `alertId` - Required. The identifier of the alert to delete.
pub fn delete(&self, alert_id: &str) -> AlertDeleteCall<'a, S> {
AlertDeleteCall {
hub: self.hub,
_alert_id: alert_id.to_string(),
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the specified alert. Attempting to get a nonexistent alert returns `NOT_FOUND` error.
///
/// # Arguments
///
/// * `alertId` - Required. The identifier of the alert to retrieve.
pub fn get(&self, alert_id: &str) -> AlertGetCall<'a, S> {
AlertGetCall {
hub: self.hub,
_alert_id: alert_id.to_string(),
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the metadata of an alert. Attempting to get metadata for a non-existent alert returns `NOT_FOUND` error.
///
/// # Arguments
///
/// * `alertId` - Required. The identifier of the alert this metadata belongs to.
pub fn get_metadata(&self, alert_id: &str) -> AlertGetMetadataCall<'a, S> {
AlertGetMetadataCall {
hub: self.hub,
_alert_id: alert_id.to_string(),
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists the alerts.
pub fn list(&self) -> AlertListCall<'a, S> {
AlertListCall {
hub: self.hub,
_page_token: Default::default(),
_page_size: Default::default(),
_order_by: Default::default(),
_filter: Default::default(),
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Restores, or "undeletes", an alert that was marked for deletion within the past 30 days. Attempting to undelete an alert which was marked for deletion over 30 days ago (which has been removed from the Alert Center database) or a nonexistent alert returns a `NOT_FOUND` error. Attempting to undelete an alert which has not been marked for deletion has no effect.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `alertId` - Required. The identifier of the alert to undelete.
pub fn undelete(&self, request: UndeleteAlertRequest, alert_id: &str) -> AlertUndeleteCall<'a, S> {
AlertUndeleteCall {
hub: self.hub,
_request: request,
_alert_id: alert_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
/// A builder providing access to all free methods, which are not associated with a particular resource.
/// It is not used directly, but through the [`AlertCenter`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_alertcenter1_beta1 as alertcenter1_beta1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use alertcenter1_beta1::{AlertCenter, 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 = AlertCenter::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_settings(...)` and `update_settings(...)`
/// // to build up your call.
/// let rb = hub.methods();
/// # }
/// ```
pub struct MethodMethods<'a, S>
where S: 'a {
pub(super) hub: &'a AlertCenter<S>,
}
impl<'a, S> client::MethodsBuilder for MethodMethods<'a, S> {}
impl<'a, S> MethodMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns customer-level settings.
pub fn get_settings(&self) -> MethodGetSettingCall<'a, S> {
MethodGetSettingCall {
hub: self.hub,
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the customer-level settings.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn update_settings(&self, request: Settings) -> MethodUpdateSettingCall<'a, S> {
MethodUpdateSettingCall {
hub: self.hub,
_request: request,
_customer_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,32 @@
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};
mod utilities;
pub use utilities::*;
mod hub;
pub use hub::*;
mod schemas;
pub use schemas::*;
mod method_builders;
pub use method_builders::*;
mod call_builders;
pub use call_builders::*;

View File

@@ -0,0 +1,404 @@
use super::*;
/// An alert affecting a customer.
///
/// # 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*).
///
/// * [feedback create alerts](AlertFeedbackCreateCall) (none)
/// * [feedback list alerts](AlertFeedbackListCall) (none)
/// * [batch delete alerts](AlertBatchDeleteCall) (none)
/// * [batch undelete alerts](AlertBatchUndeleteCall) (none)
/// * [delete alerts](AlertDeleteCall) (none)
/// * [get alerts](AlertGetCall) (response)
/// * [get metadata alerts](AlertGetMetadataCall) (none)
/// * [list alerts](AlertListCall) (none)
/// * [undelete alerts](AlertUndeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Alert {
/// Output only. The unique identifier for the alert.
#[serde(rename="alertId")]
pub alert_id: Option<String>,
/// Output only. The time this alert was created.
#[serde(rename="createTime")]
pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Output only. The unique identifier of the Google Workspace account of the customer.
#[serde(rename="customerId")]
pub customer_id: Option<String>,
/// Optional. The data associated with this alert, for example google.apps.alertcenter.type.DeviceCompromised.
pub data: Option<HashMap<String, json::Value>>,
/// Output only. `True` if this alert is marked for deletion.
pub deleted: Option<bool>,
/// Optional. The time the event that caused this alert ceased being active. If provided, the end time must not be earlier than the start time. If not provided, it indicates an ongoing alert.
#[serde(rename="endTime")]
pub end_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Optional. `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of an alert from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform alert updates in order to avoid race conditions: An `etag` is returned in the response which contains alerts, and systems are expected to put that etag in the request to update alert to ensure that their change will be applied to the same version of the alert. If no `etag` is provided in the call to update alert, then the existing alert is overwritten blindly.
pub etag: Option<String>,
/// Output only. The metadata associated with this alert.
pub metadata: Option<AlertMetadata>,
/// Output only. An optional [Security Investigation Tool](https://support.google.com/a/answer/7575955) query for this alert.
#[serde(rename="securityInvestigationToolLink")]
pub security_investigation_tool_link: Option<String>,
/// Required. A unique identifier for the system that reported the alert. This is output only after alert is created. Supported sources are any of the following: * Google Operations * Mobile device management * Gmail phishing * Data Loss Prevention * Domain wide takeout * State sponsored attack * Google identity * Apps outage
pub source: Option<String>,
/// Required. The time the event that caused this alert was started or detected.
#[serde(rename="startTime")]
pub start_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Required. The type of the alert. This is output only after alert is created. For a list of available alert types see [Google Workspace Alert types](https://developers.google.com/admin-sdk/alertcenter/reference/alert-types).
#[serde(rename="type")]
pub type_: Option<String>,
/// Output only. The time this alert was last updated.
#[serde(rename="updateTime")]
pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::Resource for Alert {}
impl client::ResponseResult for Alert {}
/// A customer feedback about an alert.
///
/// # 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*).
///
/// * [feedback create alerts](AlertFeedbackCreateCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AlertFeedback {
/// Output only. The alert identifier.
#[serde(rename="alertId")]
pub alert_id: Option<String>,
/// Output only. The time this feedback was created.
#[serde(rename="createTime")]
pub create_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
/// Output only. The unique identifier of the Google Workspace account of the customer.
#[serde(rename="customerId")]
pub customer_id: Option<String>,
/// Output only. The email of the user that provided the feedback.
pub email: Option<String>,
/// Output only. The unique identifier for the feedback.
#[serde(rename="feedbackId")]
pub feedback_id: Option<String>,
/// Required. The type of the feedback.
#[serde(rename="type")]
pub type_: Option<String>,
}
impl client::RequestValue for AlertFeedback {}
impl client::ResponseResult for AlertFeedback {}
/// An alert metadata.
///
/// # 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 metadata alerts](AlertGetMetadataCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct AlertMetadata {
/// Output only. The alert identifier.
#[serde(rename="alertId")]
pub alert_id: Option<String>,
/// The email address of the user assigned to the alert.
pub assignee: Option<String>,
/// Output only. The unique identifier of the Google Workspace account of the customer.
#[serde(rename="customerId")]
pub customer_id: Option<String>,
/// Optional. `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of an alert metadata from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform metadata updates in order to avoid race conditions: An `etag` is returned in the response which contains alert metadata, and systems are expected to put that etag in the request to update alert metadata to ensure that their change will be applied to the same version of the alert metadata. If no `etag` is provided in the call to update alert metadata, then the existing alert metadata is overwritten blindly.
pub etag: Option<String>,
/// The severity value of the alert. Alert Center will set this field at alert creation time, default's to an empty string when it could not be determined. The supported values for update actions on this field are the following: * HIGH * MEDIUM * LOW
pub severity: Option<String>,
/// The current status of the alert. The supported values are the following: * NOT_STARTED * IN_PROGRESS * CLOSED
pub status: Option<String>,
/// Output only. The time this metadata was last updated.
#[serde(rename="updateTime")]
pub update_time: Option<client::chrono::DateTime<client::chrono::offset::Utc>>,
}
impl client::ResponseResult for AlertMetadata {}
/// A request to perform batch delete on alerts.
///
/// # 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 delete alerts](AlertBatchDeleteCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchDeleteAlertsRequest {
/// Required. The list of alert IDs to delete.
#[serde(rename="alertId")]
pub alert_id: Option<Vec<String>>,
/// Optional. The unique identifier of the Google Workspace account of the customer the alerts are associated with. The `customer_id` must have the initial "C" stripped (for example, `046psxkn`). Inferred from the caller identity if not provided. [Find your customer ID](https://support.google.com/cloudidentity/answer/10070793).
#[serde(rename="customerId")]
pub customer_id: Option<String>,
}
impl client::RequestValue for BatchDeleteAlertsRequest {}
/// Response to batch delete operation on alerts.
///
/// # 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 delete alerts](AlertBatchDeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchDeleteAlertsResponse {
/// The status details for each failed `alert_id`.
#[serde(rename="failedAlertStatus")]
pub failed_alert_status: Option<HashMap<String, Status>>,
/// The successful list of alert IDs.
#[serde(rename="successAlertIds")]
pub success_alert_ids: Option<Vec<String>>,
}
impl client::ResponseResult for BatchDeleteAlertsResponse {}
/// A request to perform batch undelete on alerts.
///
/// # 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 undelete alerts](AlertBatchUndeleteCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchUndeleteAlertsRequest {
/// Required. The list of alert IDs to undelete.
#[serde(rename="alertId")]
pub alert_id: Option<Vec<String>>,
/// Optional. The unique identifier of the Google Workspace account of the customer the alerts are associated with. The `customer_id` must have the initial "C" stripped (for example, `046psxkn`). Inferred from the caller identity if not provided. [Find your customer ID](https://support.google.com/cloudidentity/answer/10070793).
#[serde(rename="customerId")]
pub customer_id: Option<String>,
}
impl client::RequestValue for BatchUndeleteAlertsRequest {}
/// Response to batch undelete operation on alerts.
///
/// # 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 undelete alerts](AlertBatchUndeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct BatchUndeleteAlertsResponse {
/// The status details for each failed `alert_id`.
#[serde(rename="failedAlertStatus")]
pub failed_alert_status: Option<HashMap<String, Status>>,
/// The successful list of alert IDs.
#[serde(rename="successAlertIds")]
pub success_alert_ids: Option<Vec<String>>,
}
impl client::ResponseResult for BatchUndeleteAlertsResponse {}
/// A reference to a Cloud Pubsub topic. To register for notifications, the owner of the topic must grant `alerts-api-push-notifications@system.gserviceaccount.com` the `projects.topics.publish` permission.
///
/// 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 CloudPubsubTopic {
/// Optional. The format of the payload that would be sent. If not specified the format will be JSON.
#[serde(rename="payloadFormat")]
pub payload_format: Option<String>,
/// The `name` field of a Cloud Pubsub [Topic] (https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics#Topic).
#[serde(rename="topicName")]
pub topic_name: Option<String>,
}
impl client::Part for CloudPubsubTopic {}
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
///
/// # 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*).
///
/// * [delete alerts](AlertDeleteCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Empty { _never_set: Option<bool> }
impl client::ResponseResult for Empty {}
/// Response message for an alert feedback listing request.
///
/// # 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*).
///
/// * [feedback list alerts](AlertFeedbackListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAlertFeedbackResponse {
/// The list of alert feedback. Feedback entries for each alert are ordered by creation time descending.
pub feedback: Option<Vec<AlertFeedback>>,
}
impl client::ResponseResult for ListAlertFeedbackResponse {}
/// Response message for an alert listing request.
///
/// # 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 alerts](AlertListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct ListAlertsResponse {
/// The list of alerts.
pub alerts: Option<Vec<Alert>>,
/// The token for the next page. If not empty, indicates that there may be more alerts that match the listing request; this value can be used in a subsequent ListAlertsRequest to get alerts continuing from last result of the current list call.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for ListAlertsResponse {}
/// Settings for callback notifications. For more details see [Google Workspace Alert Notification](https://developers.google.com/admin-sdk/alertcenter/guides/notifications).
///
/// 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 Notification {
/// A Google Cloud Pub/sub topic destination.
#[serde(rename="cloudPubsubTopic")]
pub cloud_pubsub_topic: Option<CloudPubsubTopic>,
}
impl client::Part for Notification {}
/// Customer-level settings.
///
/// # 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 settings](MethodGetSettingCall) (response)
/// * [update settings](MethodUpdateSettingCall) (request|response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct Settings {
/// The list of notifications.
pub notifications: Option<Vec<Notification>>,
}
impl client::RequestValue for Settings {}
impl client::ResponseResult for Settings {}
/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
///
/// 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 Status {
/// The status code, which should be an enum value of google.rpc.Code.
pub code: Option<i32>,
/// A list of messages that carry the error details. There is a common set of message types for APIs to use.
pub details: Option<Vec<HashMap<String, json::Value>>>,
/// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
pub message: Option<String>,
}
impl client::Part for Status {}
/// A request to undelete a specific alert that was marked for deletion.
///
/// # 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*).
///
/// * [undelete alerts](AlertUndeleteCall) (request)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct UndeleteAlertRequest {
/// Optional. The unique identifier of the Google Workspace account of the customer the alert is associated with. The `customer_id` must have the initial "C" stripped (for example, `046psxkn`). Inferred from the caller identity if not provided. [Find your customer ID](https://support.google.com/cloudidentity/answer/10070793).
#[serde(rename="customerId")]
pub customer_id: Option<String>,
}
impl client::RequestValue for UndeleteAlertRequest {}

View File

@@ -0,0 +1,24 @@
use super::*;
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Hash, Debug, Clone)]
pub enum Scope {
/// See and delete your domain's G Suite alerts, and send alert feedback
AppAlert,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::AppAlert => "https://www.googleapis.com/auth/apps.alerts",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::AppAlert
}
}

View File

@@ -0,0 +1,124 @@
use super::*;
/// Central instance to access all Analytics related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_analytics3 as analytics3;
/// use analytics3::api::EntityUserLink;
/// use analytics3::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use analytics3::{Analytics, 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 = Analytics::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 = EntityUserLink::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.management().profile_user_links_update(req, "accountId", "webPropertyId", "profileId", "linkId")
/// .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 Analytics<S> {
pub client: hyper::Client<S, hyper::body::Body>,
pub auth: Box<dyn client::GetToken>,
pub(super) _user_agent: String,
pub(super) _base_url: String,
pub(super) _root_url: String,
}
impl<'a, S> client::Hub for Analytics<S> {}
impl<'a, S> Analytics<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Analytics<S> {
Analytics {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://www.googleapis.com/analytics/v3/".to_string(),
_root_url: "https://analytics.googleapis.com/".to_string(),
}
}
pub fn data(&'a self) -> DataMethods<'a, S> {
DataMethods { hub: &self }
}
pub fn management(&'a self) -> ManagementMethods<'a, S> {
ManagementMethods { hub: &self }
}
pub fn metadata(&'a self) -> MetadataMethods<'a, S> {
MetadataMethods { hub: &self }
}
pub fn provisioning(&'a self) -> ProvisioningMethods<'a, S> {
ProvisioningMethods { hub: &self }
}
pub fn user_deletion(&'a self) -> UserDeletionMethods<'a, S> {
UserDeletionMethods { 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.3`.
///
/// 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://www.googleapis.com/analytics/v3/`.
///
/// 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://analytics.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)
}
}

File diff suppressed because it is too large Load Diff

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