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

117
gen/sheets4/src/api/hub.rs Normal file
View File

@@ -0,0 +1,117 @@
use super::*;
/// Central instance to access all Sheets related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_sheets4 as sheets4;
/// use sheets4::api::ValueRange;
/// use sheets4::{Result, Error};
/// # async fn dox() {
/// use std::default::Default;
/// use sheets4::{Sheets, 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 = Sheets::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 = ValueRange::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.spreadsheets().values_append(req, "spreadsheetId", "range")
/// .value_input_option("dolor")
/// .response_value_render_option("ea")
/// .response_date_time_render_option("ipsum")
/// .insert_data_option("invidunt")
/// .include_values_in_response(true)
/// .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 Sheets<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 Sheets<S> {}
impl<'a, S> Sheets<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Sheets<S> {
Sheets {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.3".to_string(),
_base_url: "https://sheets.googleapis.com/".to_string(),
_root_url: "https://sheets.googleapis.com/".to_string(),
}
}
pub fn spreadsheets(&'a self) -> SpreadsheetMethods<'a, S> {
SpreadsheetMethods { 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://sheets.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://sheets.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,385 @@
use super::*;
/// A builder providing access to all methods supported on *spreadsheet* resources.
/// It is not used directly, but through the [`Sheets`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_sheets4 as sheets4;
///
/// # async fn dox() {
/// use std::default::Default;
/// use sheets4::{Sheets, 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 = Sheets::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_update(...)`, `create(...)`, `developer_metadata_get(...)`, `developer_metadata_search(...)`, `get(...)`, `get_by_data_filter(...)`, `sheets_copy_to(...)`, `values_append(...)`, `values_batch_clear(...)`, `values_batch_clear_by_data_filter(...)`, `values_batch_get(...)`, `values_batch_get_by_data_filter(...)`, `values_batch_update(...)`, `values_batch_update_by_data_filter(...)`, `values_clear(...)`, `values_get(...)` and `values_update(...)`
/// // to build up your call.
/// let rb = hub.spreadsheets();
/// # }
/// ```
pub struct SpreadsheetMethods<'a, S>
where S: 'a {
pub(super) hub: &'a Sheets<S>,
}
impl<'a, S> client::MethodsBuilder for SpreadsheetMethods<'a, S> {}
impl<'a, S> SpreadsheetMethods<'a, S> {
/// Create a builder to help you perform the following task:
///
/// Returns the developer metadata with the specified ID. The caller must specify the spreadsheet ID and the developer metadata's unique metadataId.
///
/// # Arguments
///
/// * `spreadsheetId` - The ID of the spreadsheet to retrieve metadata from.
/// * `metadataId` - The ID of the developer metadata to retrieve.
pub fn developer_metadata_get(&self, spreadsheet_id: &str, metadata_id: i32) -> SpreadsheetDeveloperMetadataGetCall<'a, S> {
SpreadsheetDeveloperMetadataGetCall {
hub: self.hub,
_spreadsheet_id: spreadsheet_id.to_string(),
_metadata_id: metadata_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns all developer metadata matching the specified DataFilter. If the provided DataFilter represents a DeveloperMetadataLookup object, this will return all DeveloperMetadata entries selected by it. If the DataFilter represents a location in a spreadsheet, this will return all developer metadata associated with locations intersecting that region.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to retrieve metadata from.
pub fn developer_metadata_search(&self, request: SearchDeveloperMetadataRequest, spreadsheet_id: &str) -> SpreadsheetDeveloperMetadataSearchCall<'a, S> {
SpreadsheetDeveloperMetadataSearchCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Copies a single sheet from a spreadsheet to another spreadsheet. Returns the properties of the newly created sheet.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet containing the sheet to copy.
/// * `sheetId` - The ID of the sheet to copy.
pub fn sheets_copy_to(&self, request: CopySheetToAnotherSpreadsheetRequest, spreadsheet_id: &str, sheet_id: i32) -> SpreadsheetSheetCopyToCall<'a, S> {
SpreadsheetSheetCopyToCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_sheet_id: sheet_id,
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Appends values to a spreadsheet. The input range is used to search for existing data and find a “table” within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the [guide](https://developers.google.com/sheets/api/guides/values#appending_values) and [sample code](https://developers.google.com/sheets/api/samples/writing#append_values) for specific details of how tables are detected and data is appended. The caller must specify the spreadsheet ID, range, and a valueInputOption. The `valueInputOption` only controls how the input data will be added to the sheet (column-wise or row-wise), it does not influence what cell the data starts being written to.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
/// * `range` - The [A1 notation](https://developers.google.com/sheets/api/guides/concepts#cell) of a range to search for a logical table of data. Values are appended after the last row of the table.
pub fn values_append(&self, request: ValueRange, spreadsheet_id: &str, range: &str) -> SpreadsheetValueAppendCall<'a, S> {
SpreadsheetValueAppendCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_range: range.to_string(),
_value_input_option: Default::default(),
_response_value_render_option: Default::default(),
_response_date_time_render_option: Default::default(),
_insert_data_option: Default::default(),
_include_values_in_response: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges. Only values are cleared -- all other properties of the cell (such as formatting and data validation) are kept.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
pub fn values_batch_clear(&self, request: BatchClearValuesRequest, spreadsheet_id: &str) -> SpreadsheetValueBatchClearCall<'a, S> {
SpreadsheetValueBatchClearCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Clears one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges matching any of the specified data filters will be cleared. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
pub fn values_batch_clear_by_data_filter(&self, request: BatchClearValuesByDataFilterRequest, spreadsheet_id: &str) -> SpreadsheetValueBatchClearByDataFilterCall<'a, S> {
SpreadsheetValueBatchClearByDataFilterCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges.
///
/// # Arguments
///
/// * `spreadsheetId` - The ID of the spreadsheet to retrieve data from.
pub fn values_batch_get(&self, spreadsheet_id: &str) -> SpreadsheetValueBatchGetCall<'a, S> {
SpreadsheetValueBatchGetCall {
hub: self.hub,
_spreadsheet_id: spreadsheet_id.to_string(),
_value_render_option: Default::default(),
_ranges: Default::default(),
_major_dimension: Default::default(),
_date_time_render_option: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns one or more ranges of values that match the specified data filters. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges that match any of the data filters in the request will be returned.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to retrieve data from.
pub fn values_batch_get_by_data_filter(&self, request: BatchGetValuesByDataFilterRequest, spreadsheet_id: &str) -> SpreadsheetValueBatchGetByDataFilterCall<'a, S> {
SpreadsheetValueBatchGetByDataFilterCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
pub fn values_batch_update(&self, request: BatchUpdateValuesRequest, spreadsheet_id: &str) -> SpreadsheetValueBatchUpdateCall<'a, S> {
SpreadsheetValueBatchUpdateCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more DataFilterValueRanges.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
pub fn values_batch_update_by_data_filter(&self, request: BatchUpdateValuesByDataFilterRequest, spreadsheet_id: &str) -> SpreadsheetValueBatchUpdateByDataFilterCall<'a, S> {
SpreadsheetValueBatchUpdateByDataFilterCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Clears values from a spreadsheet. The caller must specify the spreadsheet ID and range. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc..) are kept.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
/// * `range` - The [A1 notation or R1C1 notation](https://developers.google.com/sheets/api/guides/concepts#cell) of the values to clear.
pub fn values_clear(&self, request: ClearValuesRequest, spreadsheet_id: &str, range: &str) -> SpreadsheetValueClearCall<'a, S> {
SpreadsheetValueClearCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_range: range.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns a range of values from a spreadsheet. The caller must specify the spreadsheet ID and a range.
///
/// # Arguments
///
/// * `spreadsheetId` - The ID of the spreadsheet to retrieve data from.
/// * `range` - The [A1 notation or R1C1 notation](https://developers.google.com/sheets/api/guides/concepts#cell) of the range to retrieve values from.
pub fn values_get(&self, spreadsheet_id: &str, range: &str) -> SpreadsheetValueGetCall<'a, S> {
SpreadsheetValueGetCall {
hub: self.hub,
_spreadsheet_id: spreadsheet_id.to_string(),
_range: range.to_string(),
_value_render_option: Default::default(),
_major_dimension: Default::default(),
_date_time_render_option: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a valueInputOption.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The ID of the spreadsheet to update.
/// * `range` - The [A1 notation](https://developers.google.com/sheets/api/guides/concepts#cell) of the values to update.
pub fn values_update(&self, request: ValueRange, spreadsheet_id: &str, range: &str) -> SpreadsheetValueUpdateCall<'a, S> {
SpreadsheetValueUpdateCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_range: range.to_string(),
_value_input_option: Default::default(),
_response_value_render_option: Default::default(),
_response_date_time_render_option: Default::default(),
_include_values_in_response: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Applies one or more updates to the spreadsheet. Each request is validated before being applied. If any request is not valid then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. The replies will mirror the requests. For example, if you applied 4 updates and the 3rd one had a reply, then the response will have 2 empty replies, the actual reply, and another empty reply, in that order. Due to the collaborative nature of spreadsheets, it is not guaranteed that the spreadsheet will reflect exactly your changes after this completes, however it is guaranteed that the updates in the request will be applied together atomically. Your changes may be altered with respect to collaborator changes. If there are no collaborators, the spreadsheet should reflect your changes.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The spreadsheet to apply the updates to.
pub fn batch_update(&self, request: BatchUpdateSpreadsheetRequest, spreadsheet_id: &str) -> SpreadsheetBatchUpdateCall<'a, S> {
SpreadsheetBatchUpdateCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a spreadsheet, returning the newly created spreadsheet.
///
/// # Arguments
///
/// * `request` - No description provided.
pub fn create(&self, request: Spreadsheet) -> SpreadsheetCreateCall<'a, S> {
SpreadsheetCreateCall {
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:
///
/// Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. By default, data within grids is not returned. You can include grid data in one of 2 ways: * Specify a [field mask](https://developers.google.com/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP * Set the includeGridData URL parameter to true. If a field mask is set, the `includeGridData` parameter is ignored For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want. To retrieve only subsets of spreadsheet data, use the ranges URL parameter. Ranges are specified using [A1 notation](https://developers.google.com/sheets/api/guides/concepts#cell). You can define a single cell (for example, `A1`) or multiple cells (for example, `A1:D5`). You can also get cells from other sheets within the same spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once (for example, `?ranges=A1:D5&ranges=Sheet2!A1:C4`). Limiting the range returns only the portions of the spreadsheet that intersect the requested ranges.
///
/// # Arguments
///
/// * `spreadsheetId` - The spreadsheet to request.
pub fn get(&self, spreadsheet_id: &str) -> SpreadsheetGetCall<'a, S> {
SpreadsheetGetCall {
hub: self.hub,
_spreadsheet_id: spreadsheet_id.to_string(),
_ranges: Default::default(),
_include_grid_data: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. This method differs from GetSpreadsheet in that it allows selecting which subsets of spreadsheet data to return by specifying a dataFilters parameter. Multiple DataFilters can be specified. Specifying one or more data filters returns the portions of the spreadsheet that intersect ranges matched by any of the filters. By default, data within grids is not returned. You can include grid data one of 2 ways: * Specify a [field mask](https://developers.google.com/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP * Set the includeGridData parameter to true. If a field mask is set, the `includeGridData` parameter is ignored For large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `spreadsheetId` - The spreadsheet to request.
pub fn get_by_data_filter(&self, request: GetSpreadsheetByDataFilterRequest, spreadsheet_id: &str) -> SpreadsheetGetByDataFilterCall<'a, S> {
SpreadsheetGetByDataFilterCall {
hub: self.hub,
_request: request,
_spreadsheet_id: spreadsheet_id.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::*;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
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, create, and delete all of your Google Drive files
Drive,
/// See, edit, create, and delete only the specific Google Drive files you use with this app
DriveFile,
/// See and download all your Google Drive files
DriveReadonly,
/// See, edit, create, and delete all your Google Sheets spreadsheets
Spreadsheet,
/// See all your Google Sheets spreadsheets
SpreadsheetReadonly,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::Drive => "https://www.googleapis.com/auth/drive",
Scope::DriveFile => "https://www.googleapis.com/auth/drive.file",
Scope::DriveReadonly => "https://www.googleapis.com/auth/drive.readonly",
Scope::Spreadsheet => "https://www.googleapis.com/auth/spreadsheets",
Scope::SpreadsheetReadonly => "https://www.googleapis.com/auth/spreadsheets.readonly",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::DriveReadonly
}
}