[−][src]Trait twitch_oauth2::TwitchToken
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,
&'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
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,
&'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,
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,
Revoke the token. See https://dev.twitch.tv/docs/authentication#revoking-access-tokens
Implementations on Foreign Types
impl<T: TwitchToken> TwitchToken for Box<T>
[src]
fn client_id(&self) -> &ClientId
[src]
fn token(&self) -> &AccessToken
[src]
fn login(&self) -> Option<&str>
[src]
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]
&'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>
[src]
fn scopes(&self) -> Option<&[Scope]>
[src]
Implementors
impl TwitchToken for AppAccessToken
[src]
fn client_id(&self) -> &ClientId
[src]
fn token(&self) -> &AccessToken
[src]
fn login(&self) -> Option<&str>
[src]
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]
&'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>
[src]
fn scopes(&self) -> Option<&[Scope]>
[src]
impl TwitchToken for UserToken
[src]
fn client_id(&self) -> &ClientId
[src]
fn token(&self) -> &AccessToken
[src]
fn login(&self) -> Option<&str>
[src]
fn refresh_token<'life0, 'async_trait, RE, C, F>(
&'life0 mut self,
__arg1: 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]
&'life0 mut self,
__arg1: 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,