[][src]Trait twitch_oauth2::TwitchToken

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

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

Required methods

pub fn client_id(&self) -> &ClientId[src]

Client ID associated with the token. Twitch requires this in all helix API calls

pub fn token(&self) -> &AccessToken[src]

Get the AccessToken for authenticating

pub fn login(&self) -> Option<&str>[src]

Get the username associated to this token

#[must_use]pub fn refresh_token<'life0, 'async_trait, RE, C, F>(
    &'life0 mut self,
    http_client: C
) -> Pin<Box<dyn Future<Output = Result<(), RefreshTokenError<RE>>> + 'async_trait>> where
    RE: Error + Send + Sync + 'static,
    C: FnOnce(HttpRequest) -> F,
    F: Future<Output = Result<HttpResponse, RE>>,
    RE: 'async_trait,
    C: 'async_trait,
    F: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Refresh this token, changing the token to a newer one

pub fn expires(&self) -> Option<Instant>[src]

Get instant when token will expire.

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

Retrieve scopes attached to the token

Loading content...

Provided methods

#[must_use]pub fn validate_token<'life0, 'async_trait, RE, C, F>(
    &'life0 self,
    http_client: C
) -> Pin<Box<dyn Future<Output = Result<ValidatedToken, ValidationError<RE>>> + 'async_trait>> where
    RE: Error + Send + Sync + 'static,
    C: FnOnce(HttpRequest) -> F,
    F: Future<Output = Result<HttpResponse, RE>>,
    RE: 'async_trait,
    C: 'async_trait,
    F: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

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

#[must_use]pub fn revoke_token<'async_trait, RE, C, F>(
    self,
    http_client: C
) -> Pin<Box<dyn Future<Output = Result<(), RevokeTokenError<RE>>> + 'async_trait>> where
    Self: Sized,
    RE: Error + Send + Sync + 'static,
    C: FnOnce(HttpRequest) -> F,
    F: Future<Output = Result<HttpResponse, RE>>,
    RE: 'async_trait,
    C: 'async_trait,
    F: 'async_trait,
    Self: 'async_trait, 
[src]

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...