[][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, 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
;
fn expires(&self) -> Option<Instant>;
fn scopes(&self) -> Option<&[Scope]>; #[must_use] 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] 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

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

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

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

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