gapirs-drive-v3 0.0.1

Rust library for Google API drive v0.0.1
Documentation
// This file was generated by code-gen. DO NOT EDIT MANUALLY! 

pub mod resources;
pub mod schemas;
pub mod scopes;
extern crate derive_more;
extern crate std;
#[derive(::derive_more::Debug, Clone)]
pub struct Hub<
    C1: crate::gapirs_common::ConnectRequirements,
    C2: crate::gapirs_common::ConnectRequirements,
> {
    #[debug(skip)]
    auth: crate::gapirs_common::deps::yup_oauth2::authenticator::Authenticator<C2>,
    client: crate::gapirs_common::deps::hyper_util::client::legacy::Client<
        C1,
        crate::gapirs_common::api::OutgoingBodyContent,
    >,
    region: ::core::option::Option<::alloc::string::String>,
}
impl<
    C1: crate::gapirs_common::ConnectRequirements,
    C2: crate::gapirs_common::ConnectRequirements,
> crate::gapirs_common::HubBase for Hub<C1, C2> {
    type Connector = C1;
    type ConnectorAuth = C2;
    fn new(
        client: crate::gapirs_common::deps::hyper_util::client::legacy::Client<
            Self::Connector,
            crate::gapirs_common::api::OutgoingBodyContent,
        >,
        auth: crate::gapirs_common::deps::yup_oauth2::authenticator::Authenticator<
            Self::ConnectorAuth,
        >,
    ) -> Self {
        Self {
            client,
            auth,
            region: ::core::option::Option::None,
        }
    }
    fn get_client(
        &self,
    ) -> &::gapirs_common::deps::hyper_util::client::legacy::Client<
        Self::Connector,
        crate::gapirs_common::api::OutgoingBodyContent,
    > {
        &self.client
    }
    fn get_global_url(&self) -> &::core::primitive::str {
        "https://www.googleapis.com/"
    }
    fn get_service_path(&self) -> &::core::primitive::str {
        "drive/v3/"
    }
    fn get_endpoints() -> &'static ::phf::Map<
        &'static ::core::primitive::str,
        &'static ::core::primitive::str,
    > {
        &ENDPOINTS
    }
    fn set_region(
        &mut self,
        region: impl ::core::convert::Into<::alloc::string::String>,
    ) {
        self.region = ::core::option::Option::Some(region.into());
    }
    fn get_region(&self) -> ::core::option::Option<&::alloc::string::String> {
        self.region.as_ref()
    }
    async fn get_token(
        &self,
        scopes: &[impl crate::gapirs_common::Scope],
    ) -> ::core::result::Result<
        ::alloc::string::String,
        crate::gapirs_common::errors::ApiCallError,
    > {
        let token = self
            .auth
            .token(scopes)
            .await
            .map_err(::gapirs_common::errors::GetTokenError::Auth)?;
        if token.is_expired() {
            return ::core::result::Result::Err(
                ::core::convert::Into::into(
                    ::gapirs_common::errors::GetTokenError::TokenExpired,
                ),
            );
        }
        ::core::result::Result::Ok(
            ::std::string::ToString::to_string(
                token.token().ok_or(::gapirs_common::errors::GetTokenError::NoToken)?,
            ),
        )
    }
}
pub trait ApiCalls<'a, H: crate::gapirs_common::Hub> {
    fn about(&'a self) -> resources::about::About<'a, H>;
    fn accessproposals(&'a self) -> resources::accessproposals::Accessproposals<'a, H>;
    fn apps(&'a self) -> resources::apps::Apps<'a, H>;
    fn changes(&'a self) -> resources::changes::Changes<'a, H>;
    fn channels(&'a self) -> resources::channels::Channels<'a, H>;
    fn comments(&'a self) -> resources::comments::Comments<'a, H>;
    fn drives(&'a self) -> resources::drives::Drives<'a, H>;
    fn files(&'a self) -> resources::files::Files<'a, H>;
    fn operations(&'a self) -> resources::operations::Operations<'a, H>;
    fn permissions(&'a self) -> resources::permissions::Permissions<'a, H>;
    fn replies(&'a self) -> resources::replies::Replies<'a, H>;
    fn revisions(&'a self) -> resources::revisions::Revisions<'a, H>;
    fn teamdrives(&'a self) -> resources::teamdrives::Teamdrives<'a, H>;
}
impl<'a, H: crate::gapirs_common::Hub> ApiCalls<'a, H> for H {
    fn about(&'a self) -> resources::about::About<'a, H> {
        resources::about::About {
            hub: self,
        }
    }
    fn accessproposals(&'a self) -> resources::accessproposals::Accessproposals<'a, H> {
        resources::accessproposals::Accessproposals {
            hub: self,
        }
    }
    fn apps(&'a self) -> resources::apps::Apps<'a, H> {
        resources::apps::Apps { hub: self }
    }
    fn changes(&'a self) -> resources::changes::Changes<'a, H> {
        resources::changes::Changes {
            hub: self,
        }
    }
    fn channels(&'a self) -> resources::channels::Channels<'a, H> {
        resources::channels::Channels {
            hub: self,
        }
    }
    fn comments(&'a self) -> resources::comments::Comments<'a, H> {
        resources::comments::Comments {
            hub: self,
        }
    }
    fn drives(&'a self) -> resources::drives::Drives<'a, H> {
        resources::drives::Drives {
            hub: self,
        }
    }
    fn files(&'a self) -> resources::files::Files<'a, H> {
        resources::files::Files {
            hub: self,
        }
    }
    fn operations(&'a self) -> resources::operations::Operations<'a, H> {
        resources::operations::Operations {
            hub: self,
        }
    }
    fn permissions(&'a self) -> resources::permissions::Permissions<'a, H> {
        resources::permissions::Permissions {
            hub: self,
        }
    }
    fn replies(&'a self) -> resources::replies::Replies<'a, H> {
        resources::replies::Replies {
            hub: self,
        }
    }
    fn revisions(&'a self) -> resources::revisions::Revisions<'a, H> {
        resources::revisions::Revisions {
            hub: self,
        }
    }
    fn teamdrives(&'a self) -> resources::teamdrives::Teamdrives<'a, H> {
        resources::teamdrives::Teamdrives {
            hub: self,
        }
    }
}
static ENDPOINTS: ::phf::Map<
    &'static ::core::primitive::str,
    &'static ::core::primitive::str,
> = ::phf::Map {
    key: 12913932095322966823,
    disps: &[],
    entries: &[],
};