[][src]Trait twitch_oauth2::TwitchToken

pub trait TwitchToken {
    fn client_id(&self) -> &ClientId;
fn token(&self) -> &AccessToken;
fn login(&self) -> Option<&str>;
#[must_use] fn refresh_token<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), RefreshTokenError>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn expires(&self) -> Option<Instant>;
fn scopes(&self) -> Option<&[Scope]>; #[must_use] fn validate_token<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn revoke_token<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<(), RevokeTokenError>> + 'async_trait>>
    where
        Self: Sized,
        Self: 'async_trait
, { ... } }

Trait for twitch tokens to get fields and generalize over AppAccessToken and UserToken

Required methods

fn client_id(&self) -> &ClientId

Get the client-id. Twitch requires this in all helix api calls

fn token(&self) -> &AccessToken

Get the AccessToken for authenticating

fn login(&self) -> Option<&str>

Get the username associated to this token

#[must_use]fn refresh_token<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), RefreshTokenError>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Refresh this token, changing the token to a newer one

fn expires(&self) -> Option<Instant>

Get instant when token will expire.

fn scopes(&self) -> Option<&[Scope]>

Retrieve scopes attached to the token

Loading content...

Provided methods

#[must_use]fn validate_token<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Validate this token. Should be checked on regularly, according to https://dev.twitch.tv/docs/authentication#validating-requests

#[must_use]fn revoke_token<'async_trait>(
    self
) -> Pin<Box<dyn Future<Output = Result<(), RevokeTokenError>> + 'async_trait>> where
    Self: Sized,
    Self: 'async_trait, 

Loading content...

Implementations on Foreign Types

impl<T: TwitchToken> TwitchToken for Box<T>[src]

Loading content...

Implementors

impl TwitchToken for AppAccessToken[src]

impl TwitchToken for UserToken[src]

Loading content...