make regen-apis

This commit is contained in:
OMGeeky
2024-05-16 21:23:40 +02:00
parent 52d2e89e51
commit ad85cafeef
5108 changed files with 1615625 additions and 992044 deletions

View File

@@ -0,0 +1,625 @@
use super::*;
// region AggregationResultBatchMoreResultsEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The state of the query after the current batch. Only COUNT(*) aggregations are supported in the initial launch. Therefore, expected result type is limited to `NO_MORE_RESULTS`.
pub enum AggregationResultBatchMoreResultsEnum {
/// Unspecified. This value is never used.
///
/// "MORE_RESULTS_TYPE_UNSPECIFIED"
#[serde(rename="MORE_RESULTS_TYPE_UNSPECIFIED")]
MORERESULTSTYPEUNSPECIFIED,
/// There may be additional batches to fetch from this query.
///
/// "NOT_FINISHED"
#[serde(rename="NOT_FINISHED")]
NOTFINISHED,
/// The query is finished, but there may be more results after the limit.
///
/// "MORE_RESULTS_AFTER_LIMIT"
#[serde(rename="MORE_RESULTS_AFTER_LIMIT")]
MORERESULTSAFTERLIMIT,
/// The query is finished, but there may be more results after the end cursor.
///
/// "MORE_RESULTS_AFTER_CURSOR"
#[serde(rename="MORE_RESULTS_AFTER_CURSOR")]
MORERESULTSAFTERCURSOR,
/// The query is finished, and there are no more results.
///
/// "NO_MORE_RESULTS"
#[serde(rename="NO_MORE_RESULTS")]
NOMORERESULTS,
}
impl AsRef<str> for AggregationResultBatchMoreResultsEnum {
fn as_ref(&self) -> &str {
match *self {
AggregationResultBatchMoreResultsEnum::MORERESULTSTYPEUNSPECIFIED => "MORE_RESULTS_TYPE_UNSPECIFIED",
AggregationResultBatchMoreResultsEnum::NOTFINISHED => "NOT_FINISHED",
AggregationResultBatchMoreResultsEnum::MORERESULTSAFTERLIMIT => "MORE_RESULTS_AFTER_LIMIT",
AggregationResultBatchMoreResultsEnum::MORERESULTSAFTERCURSOR => "MORE_RESULTS_AFTER_CURSOR",
AggregationResultBatchMoreResultsEnum::NOMORERESULTS => "NO_MORE_RESULTS",
}
}
}
impl std::convert::TryFrom< &str> for AggregationResultBatchMoreResultsEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"MORE_RESULTS_TYPE_UNSPECIFIED" => Ok(AggregationResultBatchMoreResultsEnum::MORERESULTSTYPEUNSPECIFIED),
"NOT_FINISHED" => Ok(AggregationResultBatchMoreResultsEnum::NOTFINISHED),
"MORE_RESULTS_AFTER_LIMIT" => Ok(AggregationResultBatchMoreResultsEnum::MORERESULTSAFTERLIMIT),
"MORE_RESULTS_AFTER_CURSOR" => Ok(AggregationResultBatchMoreResultsEnum::MORERESULTSAFTERCURSOR),
"NO_MORE_RESULTS" => Ok(AggregationResultBatchMoreResultsEnum::NOMORERESULTS),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a AggregationResultBatchMoreResultsEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region CommitRequestModeEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The type of commit to perform. Defaults to `TRANSACTIONAL`.
pub enum CommitRequestModeEnum {
/// Unspecified. This value must not be used.
///
/// "MODE_UNSPECIFIED"
#[serde(rename="MODE_UNSPECIFIED")]
MODEUNSPECIFIED,
/// Transactional: The mutations are either all applied, or none are applied. Learn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions).
///
/// "TRANSACTIONAL"
#[serde(rename="TRANSACTIONAL")]
TRANSACTIONAL,
/// Non-transactional: The mutations may not apply as all or none.
///
/// "NON_TRANSACTIONAL"
#[serde(rename="NON_TRANSACTIONAL")]
NONTRANSACTIONAL,
}
impl AsRef<str> for CommitRequestModeEnum {
fn as_ref(&self) -> &str {
match *self {
CommitRequestModeEnum::MODEUNSPECIFIED => "MODE_UNSPECIFIED",
CommitRequestModeEnum::TRANSACTIONAL => "TRANSACTIONAL",
CommitRequestModeEnum::NONTRANSACTIONAL => "NON_TRANSACTIONAL",
}
}
}
impl std::convert::TryFrom< &str> for CommitRequestModeEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"MODE_UNSPECIFIED" => Ok(CommitRequestModeEnum::MODEUNSPECIFIED),
"TRANSACTIONAL" => Ok(CommitRequestModeEnum::TRANSACTIONAL),
"NON_TRANSACTIONAL" => Ok(CommitRequestModeEnum::NONTRANSACTIONAL),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a CommitRequestModeEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region CompositeFilterOpEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The operator for combining multiple filters.
pub enum CompositeFilterOpEnum {
/// Unspecified. This value must not be used.
///
/// "OPERATOR_UNSPECIFIED"
#[serde(rename="OPERATOR_UNSPECIFIED")]
OPERATORUNSPECIFIED,
/// The results are required to satisfy each of the combined filters.
///
/// "AND"
#[serde(rename="AND")]
AND,
/// Documents are required to satisfy at least one of the combined filters.
///
/// "OR"
#[serde(rename="OR")]
OR,
}
impl AsRef<str> for CompositeFilterOpEnum {
fn as_ref(&self) -> &str {
match *self {
CompositeFilterOpEnum::OPERATORUNSPECIFIED => "OPERATOR_UNSPECIFIED",
CompositeFilterOpEnum::AND => "AND",
CompositeFilterOpEnum::OR => "OR",
}
}
}
impl std::convert::TryFrom< &str> for CompositeFilterOpEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"OPERATOR_UNSPECIFIED" => Ok(CompositeFilterOpEnum::OPERATORUNSPECIFIED),
"AND" => Ok(CompositeFilterOpEnum::AND),
"OR" => Ok(CompositeFilterOpEnum::OR),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a CompositeFilterOpEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region PropertyFilterOpEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The operator to filter by.
pub enum PropertyFilterOpEnum {
/// Unspecified. This value must not be used.
///
/// "OPERATOR_UNSPECIFIED"
#[serde(rename="OPERATOR_UNSPECIFIED")]
OPERATORUNSPECIFIED,
/// The given `property` is less than the given `value`. Requires: * That `property` comes first in `order_by`.
///
/// "LESS_THAN"
#[serde(rename="LESS_THAN")]
LESSTHAN,
/// The given `property` is less than or equal to the given `value`. Requires: * That `property` comes first in `order_by`.
///
/// "LESS_THAN_OR_EQUAL"
#[serde(rename="LESS_THAN_OR_EQUAL")]
LESSTHANOREQUAL,
/// The given `property` is greater than the given `value`. Requires: * That `property` comes first in `order_by`.
///
/// "GREATER_THAN"
#[serde(rename="GREATER_THAN")]
GREATERTHAN,
/// The given `property` is greater than or equal to the given `value`. Requires: * That `property` comes first in `order_by`.
///
/// "GREATER_THAN_OR_EQUAL"
#[serde(rename="GREATER_THAN_OR_EQUAL")]
GREATERTHANOREQUAL,
/// The given `property` is equal to the given `value`.
///
/// "EQUAL"
#[serde(rename="EQUAL")]
EQUAL,
/// The given `property` is equal to at least one value in the given array. Requires: * That `value` is a non-empty `ArrayValue`, subject to disjunction limits. * No `NOT_IN` is in the same query.
///
/// "IN"
#[serde(rename="IN")]
IN,
/// The given `property` is not equal to the given `value`. Requires: * No other `NOT_EQUAL` or `NOT_IN` is in the same query. * That `property` comes first in the `order_by`.
///
/// "NOT_EQUAL"
#[serde(rename="NOT_EQUAL")]
NOTEQUAL,
/// Limit the result set to the given entity and its descendants. Requires: * That `value` is an entity key. * All evaluated disjunctions must have the same `HAS_ANCESTOR` filter.
///
/// "HAS_ANCESTOR"
#[serde(rename="HAS_ANCESTOR")]
HASANCESTOR,
/// The value of the `property` is not in the given array. Requires: * That `value` is a non-empty `ArrayValue` with at most 10 values. * No other `OR`, `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query. * That `field` comes first in the `order_by`.
///
/// "NOT_IN"
#[serde(rename="NOT_IN")]
NOTIN,
}
impl AsRef<str> for PropertyFilterOpEnum {
fn as_ref(&self) -> &str {
match *self {
PropertyFilterOpEnum::OPERATORUNSPECIFIED => "OPERATOR_UNSPECIFIED",
PropertyFilterOpEnum::LESSTHAN => "LESS_THAN",
PropertyFilterOpEnum::LESSTHANOREQUAL => "LESS_THAN_OR_EQUAL",
PropertyFilterOpEnum::GREATERTHAN => "GREATER_THAN",
PropertyFilterOpEnum::GREATERTHANOREQUAL => "GREATER_THAN_OR_EQUAL",
PropertyFilterOpEnum::EQUAL => "EQUAL",
PropertyFilterOpEnum::IN => "IN",
PropertyFilterOpEnum::NOTEQUAL => "NOT_EQUAL",
PropertyFilterOpEnum::HASANCESTOR => "HAS_ANCESTOR",
PropertyFilterOpEnum::NOTIN => "NOT_IN",
}
}
}
impl std::convert::TryFrom< &str> for PropertyFilterOpEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"OPERATOR_UNSPECIFIED" => Ok(PropertyFilterOpEnum::OPERATORUNSPECIFIED),
"LESS_THAN" => Ok(PropertyFilterOpEnum::LESSTHAN),
"LESS_THAN_OR_EQUAL" => Ok(PropertyFilterOpEnum::LESSTHANOREQUAL),
"GREATER_THAN" => Ok(PropertyFilterOpEnum::GREATERTHAN),
"GREATER_THAN_OR_EQUAL" => Ok(PropertyFilterOpEnum::GREATERTHANOREQUAL),
"EQUAL" => Ok(PropertyFilterOpEnum::EQUAL),
"IN" => Ok(PropertyFilterOpEnum::IN),
"NOT_EQUAL" => Ok(PropertyFilterOpEnum::NOTEQUAL),
"HAS_ANCESTOR" => Ok(PropertyFilterOpEnum::HASANCESTOR),
"NOT_IN" => Ok(PropertyFilterOpEnum::NOTIN),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a PropertyFilterOpEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region PropertyOrderDirectionEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The direction to order by. Defaults to `ASCENDING`.
pub enum PropertyOrderDirectionEnum {
/// Unspecified. This value must not be used.
///
/// "DIRECTION_UNSPECIFIED"
#[serde(rename="DIRECTION_UNSPECIFIED")]
DIRECTIONUNSPECIFIED,
/// Ascending.
///
/// "ASCENDING"
#[serde(rename="ASCENDING")]
ASCENDING,
/// Descending.
///
/// "DESCENDING"
#[serde(rename="DESCENDING")]
DESCENDING,
}
impl AsRef<str> for PropertyOrderDirectionEnum {
fn as_ref(&self) -> &str {
match *self {
PropertyOrderDirectionEnum::DIRECTIONUNSPECIFIED => "DIRECTION_UNSPECIFIED",
PropertyOrderDirectionEnum::ASCENDING => "ASCENDING",
PropertyOrderDirectionEnum::DESCENDING => "DESCENDING",
}
}
}
impl std::convert::TryFrom< &str> for PropertyOrderDirectionEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"DIRECTION_UNSPECIFIED" => Ok(PropertyOrderDirectionEnum::DIRECTIONUNSPECIFIED),
"ASCENDING" => Ok(PropertyOrderDirectionEnum::ASCENDING),
"DESCENDING" => Ok(PropertyOrderDirectionEnum::DESCENDING),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a PropertyOrderDirectionEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region QueryResultBatchEntityResultTypeEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The result type for every entity in `entity_results`.
pub enum QueryResultBatchEntityResultTypeEnum {
/// Unspecified. This value is never used.
///
/// "RESULT_TYPE_UNSPECIFIED"
#[serde(rename="RESULT_TYPE_UNSPECIFIED")]
RESULTTYPEUNSPECIFIED,
/// The key and properties.
///
/// "FULL"
#[serde(rename="FULL")]
FULL,
/// A projected subset of properties. The entity may have no key.
///
/// "PROJECTION"
#[serde(rename="PROJECTION")]
PROJECTION,
/// Only the key.
///
/// "KEY_ONLY"
#[serde(rename="KEY_ONLY")]
KEYONLY,
}
impl AsRef<str> for QueryResultBatchEntityResultTypeEnum {
fn as_ref(&self) -> &str {
match *self {
QueryResultBatchEntityResultTypeEnum::RESULTTYPEUNSPECIFIED => "RESULT_TYPE_UNSPECIFIED",
QueryResultBatchEntityResultTypeEnum::FULL => "FULL",
QueryResultBatchEntityResultTypeEnum::PROJECTION => "PROJECTION",
QueryResultBatchEntityResultTypeEnum::KEYONLY => "KEY_ONLY",
}
}
}
impl std::convert::TryFrom< &str> for QueryResultBatchEntityResultTypeEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"RESULT_TYPE_UNSPECIFIED" => Ok(QueryResultBatchEntityResultTypeEnum::RESULTTYPEUNSPECIFIED),
"FULL" => Ok(QueryResultBatchEntityResultTypeEnum::FULL),
"PROJECTION" => Ok(QueryResultBatchEntityResultTypeEnum::PROJECTION),
"KEY_ONLY" => Ok(QueryResultBatchEntityResultTypeEnum::KEYONLY),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a QueryResultBatchEntityResultTypeEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region QueryResultBatchMoreResultsEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The state of the query after the current batch.
pub enum QueryResultBatchMoreResultsEnum {
/// Unspecified. This value is never used.
///
/// "MORE_RESULTS_TYPE_UNSPECIFIED"
#[serde(rename="MORE_RESULTS_TYPE_UNSPECIFIED")]
MORERESULTSTYPEUNSPECIFIED,
/// There may be additional batches to fetch from this query.
///
/// "NOT_FINISHED"
#[serde(rename="NOT_FINISHED")]
NOTFINISHED,
/// The query is finished, but there may be more results after the limit.
///
/// "MORE_RESULTS_AFTER_LIMIT"
#[serde(rename="MORE_RESULTS_AFTER_LIMIT")]
MORERESULTSAFTERLIMIT,
/// The query is finished, but there may be more results after the end cursor.
///
/// "MORE_RESULTS_AFTER_CURSOR"
#[serde(rename="MORE_RESULTS_AFTER_CURSOR")]
MORERESULTSAFTERCURSOR,
/// The query is finished, and there are no more results.
///
/// "NO_MORE_RESULTS"
#[serde(rename="NO_MORE_RESULTS")]
NOMORERESULTS,
}
impl AsRef<str> for QueryResultBatchMoreResultsEnum {
fn as_ref(&self) -> &str {
match *self {
QueryResultBatchMoreResultsEnum::MORERESULTSTYPEUNSPECIFIED => "MORE_RESULTS_TYPE_UNSPECIFIED",
QueryResultBatchMoreResultsEnum::NOTFINISHED => "NOT_FINISHED",
QueryResultBatchMoreResultsEnum::MORERESULTSAFTERLIMIT => "MORE_RESULTS_AFTER_LIMIT",
QueryResultBatchMoreResultsEnum::MORERESULTSAFTERCURSOR => "MORE_RESULTS_AFTER_CURSOR",
QueryResultBatchMoreResultsEnum::NOMORERESULTS => "NO_MORE_RESULTS",
}
}
}
impl std::convert::TryFrom< &str> for QueryResultBatchMoreResultsEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"MORE_RESULTS_TYPE_UNSPECIFIED" => Ok(QueryResultBatchMoreResultsEnum::MORERESULTSTYPEUNSPECIFIED),
"NOT_FINISHED" => Ok(QueryResultBatchMoreResultsEnum::NOTFINISHED),
"MORE_RESULTS_AFTER_LIMIT" => Ok(QueryResultBatchMoreResultsEnum::MORERESULTSAFTERLIMIT),
"MORE_RESULTS_AFTER_CURSOR" => Ok(QueryResultBatchMoreResultsEnum::MORERESULTSAFTERCURSOR),
"NO_MORE_RESULTS" => Ok(QueryResultBatchMoreResultsEnum::NOMORERESULTS),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a QueryResultBatchMoreResultsEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region ReadOptionReadConsistencyEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// The non-transactional read consistency to use.
pub enum ReadOptionReadConsistencyEnum {
/// Unspecified. This value must not be used.
///
/// "READ_CONSISTENCY_UNSPECIFIED"
#[serde(rename="READ_CONSISTENCY_UNSPECIFIED")]
READCONSISTENCYUNSPECIFIED,
/// Strong consistency.
///
/// "STRONG"
#[serde(rename="STRONG")]
STRONG,
/// Eventual consistency.
///
/// "EVENTUAL"
#[serde(rename="EVENTUAL")]
EVENTUAL,
}
impl AsRef<str> for ReadOptionReadConsistencyEnum {
fn as_ref(&self) -> &str {
match *self {
ReadOptionReadConsistencyEnum::READCONSISTENCYUNSPECIFIED => "READ_CONSISTENCY_UNSPECIFIED",
ReadOptionReadConsistencyEnum::STRONG => "STRONG",
ReadOptionReadConsistencyEnum::EVENTUAL => "EVENTUAL",
}
}
}
impl std::convert::TryFrom< &str> for ReadOptionReadConsistencyEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"READ_CONSISTENCY_UNSPECIFIED" => Ok(ReadOptionReadConsistencyEnum::READCONSISTENCYUNSPECIFIED),
"STRONG" => Ok(ReadOptionReadConsistencyEnum::STRONG),
"EVENTUAL" => Ok(ReadOptionReadConsistencyEnum::EVENTUAL),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a ReadOptionReadConsistencyEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion
// region ValueNullValueEnum
#[derive(Clone, Copy, Eq, Hash, Debug, PartialEq, Serialize, Deserialize)]
/// A null value.
pub enum ValueNullValueEnum {
/// Null value.
///
/// "NULL_VALUE"
#[serde(rename="NULL_VALUE")]
NULLVALUE,
}
impl AsRef<str> for ValueNullValueEnum {
fn as_ref(&self) -> &str {
match *self {
ValueNullValueEnum::NULLVALUE => "NULL_VALUE",
}
}
}
impl std::convert::TryFrom< &str> for ValueNullValueEnum {
type Error = ();
fn try_from(value: &str) -> Result<Self, Self::Error> {
match value {
"NULL_VALUE" => Ok(ValueNullValueEnum::NULLVALUE),
_=> Err(()),
}
}
}
impl<'a> Into<std::borrow::Cow<'a, str>> for &'a ValueNullValueEnum {
fn into(self) -> std::borrow::Cow<'a, str> {
self.as_ref().into()
}
}
// endregion

View File

@@ -0,0 +1,113 @@
use super::*;
/// Central instance to access all Datastore related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_datastore1_beta3 as datastore1_beta3;
/// use datastore1_beta3::api::RunQueryRequest;
/// use datastore1_beta3::{Result, Error};
/// use datastore1_beta3::api::enums::*;
/// # async fn dox() {
/// use std::default::Default;
/// use datastore1_beta3::{Datastore, 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 = Datastore::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().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 = RunQueryRequest::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.projects().run_query(req, "projectId")
/// .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 Datastore<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 Datastore<S> {}
impl<'a, S> Datastore<S> {
pub fn new<A: 'static + client::GetToken>(client: hyper::Client<S, hyper::body::Body>, auth: A) -> Datastore<S> {
Datastore {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/5.0.5".to_string(),
_base_url: "https://datastore.googleapis.com/".to_string(),
_root_url: "https://datastore.googleapis.com/".to_string(),
}
}
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.5`.
///
/// 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://datastore.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://datastore.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,194 @@
use super::*;
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`Datastore`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_datastore1_beta3 as datastore1_beta3;
///
/// # async fn dox() {
/// use std::default::Default;
/// use datastore1_beta3::{Datastore, 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 = Datastore::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().https_or_http().enable_http1().build()), auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // like `allocate_ids(...)`, `begin_transaction(...)`, `commit(...)`, `lookup(...)`, `reserve_ids(...)`, `rollback(...)`, `run_aggregation_query(...)` and `run_query(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, S>
where S: 'a {
pub(super) hub: &'a Datastore<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:
///
/// Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn allocate_ids(&self, request: AllocateIdsRequest, project_id: &str) -> ProjectAllocateIdCall<'a, S> {
ProjectAllocateIdCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Begins a new transaction.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn begin_transaction(&self, request: BeginTransactionRequest, project_id: &str) -> ProjectBeginTransactionCall<'a, S> {
ProjectBeginTransactionCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Commits a transaction, optionally creating, deleting or modifying some entities.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn commit(&self, request: CommitRequest, project_id: &str) -> ProjectCommitCall<'a, S> {
ProjectCommitCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Looks up entities by key.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn lookup(&self, request: LookupRequest, project_id: &str) -> ProjectLookupCall<'a, S> {
ProjectLookupCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn reserve_ids(&self, request: ReserveIdsRequest, project_id: &str) -> ProjectReserveIdCall<'a, S> {
ProjectReserveIdCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Rolls back a transaction.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn rollback(&self, request: RollbackRequest, project_id: &str) -> ProjectRollbackCall<'a, S> {
ProjectRollbackCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Runs an aggregation query.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn run_aggregation_query(&self, request: RunAggregationQueryRequest, project_id: &str) -> ProjectRunAggregationQueryCall<'a, S> {
ProjectRunAggregationQueryCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Queries for entities.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The ID of the project against which to make the request.
pub fn run_query(&self, request: RunQueryRequest, project_id: &str) -> ProjectRunQueryCall<'a, S> {
ProjectRunQueryCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}

View File

@@ -0,0 +1,35 @@
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::*;
pub mod enums;
pub(crate) use enums::*;

File diff suppressed because it is too large Load Diff

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, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
/// View and manage your Google Cloud Datastore data
Full,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
Scope::Full => "https://www.googleapis.com/auth/datastore",
}
}
}
impl Default for Scope {
fn default() -> Scope {
Scope::Full
}
}

View File

@@ -2,14 +2,14 @@
// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako'
// DO NOT EDIT !
//! This documentation was generated from *datastore* crate version *5.0.4+20240226*, where *20240226* is the exact revision of the *datastore:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.4*.
//! This documentation was generated from *datastore* crate version *5.0.5+20240324*, where *20240324* is the exact revision of the *datastore:v1beta3* schema built by the [mako](http://www.makotemplates.org/) code generator *v5.0.5*.
//!
//! Everything else about the *datastore* *v1_beta3* API can be found at the
//! [official documentation site](https://cloud.google.com/datastore/).
//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/datastore1_beta3).
//! # Features
//!
//! Handle the following *Resources* with ease from the central [hub](Datastore) ...
//! Handle the following *Resources* with ease from the central [hub](Datastore) ...
//!
//! * projects
//! * [*allocate ids*](api::ProjectAllocateIdCall), [*begin transaction*](api::ProjectBeginTransactionCall), [*commit*](api::ProjectCommitCall), [*lookup*](api::ProjectLookupCall), [*reserve ids*](api::ProjectReserveIdCall), [*rollback*](api::ProjectRollbackCall), [*run aggregation query*](api::ProjectRunAggregationQueryCall) and [*run query*](api::ProjectRunQueryCall)
@@ -47,11 +47,11 @@
//! Or specifically ...
//!
//! ```ignore
//! let r = hub.projects().lookup(...).doit().await
//! let r = hub.projects().run_query(...).doit().await
//! ```
//!
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
//! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
//! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
//! The `doit()` method performs the actual communication with the server and returns the respective result.
//!
@@ -74,34 +74,35 @@
//! extern crate hyper;
//! extern crate hyper_rustls;
//! extern crate google_datastore1_beta3 as datastore1_beta3;
//! use datastore1_beta3::api::LookupRequest;
//! use datastore1_beta3::api::RunQueryRequest;
//! use datastore1_beta3::{Result, Error};
//! use datastore1_beta3::api::enums::*;
//! # async fn dox() {
//! use std::default::Default;
//! use datastore1_beta3::{Datastore, oauth2, hyper, hyper_rustls, chrono, FieldMask};
//!
//! // Get an ApplicationSecret instance by some means. It contains the `client_id` and
//! // 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,
//! // 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
//! // 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 = Datastore::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().build()), auth);
//! let mut hub = Datastore::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().unwrap().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 = LookupRequest::default();
//! let mut req = RunQueryRequest::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.projects().lookup(req, "projectId")
//! let result = hub.projects().run_query(req, "projectId")
//! .doit().await;
//!
//! match result {
@@ -126,10 +127,10 @@
//! ## Handling Errors
//!
//! All errors produced by the system are provided either as [Result](client::Result) enumeration as return value of
//! the doit() methods, or handed as possibly intermediate results to either the
//! the doit() methods, or handed as possibly intermediate results to either the
//! [Hub Delegate](client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html).
//!
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This
//! makes the system potentially resilient to all kinds of errors.
//!
//! ## Uploads and Downloads
@@ -139,25 +140,25 @@
//! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making
//! this call: `.param("alt", "media")`.
//!
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! Methods supporting uploads can do so using up to 2 different protocols:
//! *simple* and *resumable*. The distinctiveness of each is represented by customized
//! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively.
//!
//! ## Customization and Callbacks
//!
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! You may alter the way an `doit()` method is called by providing a [delegate](client::Delegate) to the
//! [Method Builder](client::CallBuilder) before making the final `doit()` call.
//! Respective methods will be called to provide progress information, as well as determine whether the system should
//! retry on failure.
//!
//! The [delegate trait](client::Delegate) is default-implemented, allowing you to customize it with minimal effort.
//!
//! ## Optional Parts in Server-Requests
//!
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! All structures provided by this library are made to be [encodable](client::RequestValue) and
//! [decodable](client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses
//! are valid.
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! Most optionals are are considered [Parts](client::Part) which are identifiable by name, which will be sent to
//! the server to indicate either the set parts of the request or the desired parts in the response.
//!
//! ## Builder Arguments