Struct google_calendar::Client

source ·
pub struct Client { /* private fields */ }
Expand description

Entrypoint for interacting with the API client.

Implementations§

source§

impl Client

source

pub fn new<I, K, R, T, Q>( client_id: I, client_secret: K, redirect_uri: R, token: T, refresh_token: Q ) -> Selfwhere I: ToString, K: ToString, R: ToString, T: ToString, Q: ToString,

Create a new Client struct. It takes a type that can convert into an &str (String or Vec<u8> for example). As long as the function is given a valid API key your requests will work.

source

pub fn set_auto_access_token_refresh(&mut self, enabled: bool) -> &mut Self

Enables or disables the automatic refreshing of access tokens upon expiration

source

pub async fn set_expires_at(&self, expires_at: Option<Instant>) -> &Self

Sets a specific Instant at which the access token should be considered expired. The expiration value will only be used when automatic access token refreshing is also enabled. None may be passed in if the expiration is unknown. In this case automatic refreshes will be attempted when encountering an UNAUTHENTICATED status code on a response.

source

pub async fn expires_at(&self) -> Option<Instant>

Gets the Instant at which the access token used by this client is set to expire if one is known

source

pub async fn set_expires_in(&self, expires_in: i64) -> &Self

Sets the number of seconds in which the current access token should be considered expired

source

pub async fn expires_in(&self) -> Option<Duration>

Gets the number of seconds from now in which the current access token will be considered expired if one is known

source

pub async fn is_expired(&self) -> Option<bool>

Determines if the access token currently stored in the client is expired. If the expiration can not be determined, None is returned

source

pub fn with_host_override<H>(&mut self, host: H) -> &mut Selfwhere H: ToString,

Override the host for all endpoins in the client.

source

pub fn remove_host_override(&mut self) -> &mut Self

Disables the global host override for the client.

source

pub fn get_host_override(&self) -> Option<&str>

source

pub async fn new_from_env<T, R>(token: T, refresh_token: R) -> Selfwhere T: ToString, R: ToString,

Create a new Client struct from environment variables. It takes a type that can convert into an &str (String or Vec<u8> for example). As long as the function is given a valid API key and your requests will work. We pass in the token and refresh token to the client so if you are storing it in a database, you can get it first.

Return a user consent url with an optional set of scopes. If no scopes are provided, they will not be passed in the url.

source

pub async fn refresh_access_token(&self) -> Result<AccessToken>

Refresh an access token from a refresh token. Client must have a refresh token for this to work.

source

pub async fn get_access_token( &mut self, code: &str, state: &str ) -> Result<AccessToken>

Get an access token from the code returned by the URL paramter sent to the redirect URL.

source

pub fn acl(&self) -> Acl

Return a reference to an interface that provides access to acl operations.

source

pub fn calendar_list(&self) -> CalendarList

Return a reference to an interface that provides access to calendarList operations.

source

pub fn calendars(&self) -> Calendars

Return a reference to an interface that provides access to calendars operations.

source

pub fn channels(&self) -> Channels

Return a reference to an interface that provides access to channels operations.

source

pub fn colors(&self) -> Colors

Return a reference to an interface that provides access to colors operations.

source

pub fn events(&self) -> Events

Return a reference to an interface that provides access to events operations.

source

pub fn freebusy(&self) -> Freebusy

Return a reference to an interface that provides access to freebusy operations.

source

pub fn settings(&self) -> Settings

Return a reference to an interface that provides access to settings operations.

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more