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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
use super::*;
/// Central instance to access all Libraryagent related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_libraryagent1 as libraryagent1;
/// use libraryagent1::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use libraryagent1::{Libraryagent, 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 = Libraryagent::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.shelves().books_borrow("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 Libraryagent<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 Libraryagent<S> {}
impl<'a, S> Libraryagent<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Libraryagent<S> {
Libraryagent {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://libraryagent.googleapis.com/".to_string(),
_root_url: "https://libraryagent.googleapis.com/".to_string(),
}
}
pub fn shelves(&'a self) -> ShelfMethods<'a, S> {
ShelfMethods { 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://libraryagent.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://libraryagent.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,143 @@
use super::*;
/// A builder providing access to all methods supported on *shelf* resources.
/// It is not used directly, but through the [`Libraryagent`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_libraryagent1 as libraryagent1;
///
/// # async fn dox() {
/// use std::default::Default;
/// use libraryagent1::{Libraryagent, 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 = Libraryagent::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 `books_borrow(...)`, `books_get(...)`, `books_list(...)`, `books_return(...)`, `get(...)` and `list(...)`
/// // to build up your call.
/// let rb = hub.shelves();
/// # }
/// ```
pub struct ShelfMethods<'a, S>
where S: 'a {
pub(super) hub: &'a Libraryagent<S>,
}
impl<'a, S> client::MethodsBuilder for ShelfMethods<'a, S> {}
impl<'a, S> ShelfMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Borrow a book from the library. Returns the book if it is borrowed successfully. Returns NOT_FOUND if the book does not exist in the library. Returns quota exceeded error if the amount of books borrowed exceeds allocation quota in any dimensions.
///
/// # Arguments
///
/// * `name` - Required. The name of the book to borrow.
pub fn books_borrow(&self, name: &str) -> ShelfBookBorrowCall<'a, S> {
ShelfBookBorrowCall {
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 book. Returns NOT_FOUND if the book does not exist.
///
/// # Arguments
///
/// * `name` - Required. The name of the book to retrieve.
pub fn books_get(&self, name: &str) -> ShelfBookGetCall<'a, S> {
ShelfBookGetCall {
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 books in a shelf. The order is unspecified but deterministic. Newly created books will not necessarily be added to the end of this list. Returns NOT_FOUND if the shelf does not exist.
///
/// # Arguments
///
/// * `parent` - Required. The name of the shelf whose books we'd like to list.
pub fn books_list(&self, parent: &str) -> ShelfBookListCall<'a, S> {
ShelfBookListCall {
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:
///
/// Return a book to the library. Returns the book if it is returned to the library successfully. Returns error if the book does not belong to the library or the users didn't borrow before.
///
/// # Arguments
///
/// * `name` - Required. The name of the book to return.
pub fn books_return(&self, name: &str) -> ShelfBookReturnCall<'a, S> {
ShelfBookReturnCall {
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 shelf. Returns NOT_FOUND if the shelf does not exist.
///
/// # Arguments
///
/// * `name` - Required. The name of the shelf to retrieve.
pub fn get(&self, name: &str) -> ShelfGetCall<'a, S> {
ShelfGetCall {
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 shelves. The order is unspecified but deterministic. Newly created shelves will not necessarily be added to the end of this list.
pub fn list(&self) -> ShelfListCall<'a, S> {
ShelfListCall {
hub: self.hub,
_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,99 @@
use super::*;
/// A single book in the library.
///
/// # 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*).
///
/// * [books borrow shelves](ShelfBookBorrowCall) (response)
/// * [books get shelves](ShelfBookGetCall) (response)
/// * [books return shelves](ShelfBookReturnCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GoogleExampleLibraryagentV1Book {
/// The name of the book author.
pub author: Option<String>,
/// The resource name of the book. Book names have the form `shelves/{shelf_id}/books/{book_id}`. The name is ignored when creating a book.
pub name: Option<String>,
/// Value indicating whether the book has been read.
pub read: Option<bool>,
/// The title of the book.
pub title: Option<String>,
}
impl client::ResponseResult for GoogleExampleLibraryagentV1Book {}
/// Response message for LibraryAgent.ListBooks.
///
/// # 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*).
///
/// * [books list shelves](ShelfBookListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GoogleExampleLibraryagentV1ListBooksResponse {
/// The list of books.
pub books: Option<Vec<GoogleExampleLibraryagentV1Book>>,
/// A token to retrieve next page of results. Pass this value in the ListBooksRequest.page_token field in the subsequent call to `ListBooks` method to retrieve the next page of results.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
}
impl client::ResponseResult for GoogleExampleLibraryagentV1ListBooksResponse {}
/// Response message for LibraryAgent.ListShelves.
///
/// # 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 shelves](ShelfListCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GoogleExampleLibraryagentV1ListShelvesResponse {
/// A token to retrieve next page of results. Pass this value in the ListShelvesRequest.page_token field in the subsequent call to `ListShelves` method to retrieve the next page of results.
#[serde(rename="nextPageToken")]
pub next_page_token: Option<String>,
/// The list of shelves.
pub shelves: Option<Vec<GoogleExampleLibraryagentV1Shelf>>,
}
impl client::ResponseResult for GoogleExampleLibraryagentV1ListShelvesResponse {}
/// A Shelf contains a collection of books with a theme.
///
/// # 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 shelves](ShelfGetCall) (response)
#[serde_with::serde_as(crate = "::client::serde_with")]
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct GoogleExampleLibraryagentV1Shelf {
/// Output only. The resource name of the shelf. Shelf names have the form `shelves/{shelf_id}`. The name is ignored when creating a shelf.
pub name: Option<String>,
/// The theme of the shelf
pub theme: Option<String>,
}
impl client::ResponseResult for GoogleExampleLibraryagentV1Shelf {}

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
}
}