pub struct RefreshToken(/* private fields */);
Expand description
A Refresh Token
Implementations§
Source§impl RefreshToken
impl RefreshToken
Sourcepub fn from_static(raw: &'static str) -> Self
pub fn from_static(raw: &'static str) -> Self
Constructs a new RefreshToken from a static reference
Sourcepub fn into_boxed_ref(self) -> Box<RefreshTokenRef>
pub fn into_boxed_ref(self) -> Box<RefreshTokenRef>
Converts this RefreshToken
into a Box<RefreshTokenRef>
This will drop any excess capacity.
Methods from Deref<Target = RefreshTokenRef>§
Sourcepub fn secret(&self) -> &str
pub fn secret(&self) -> &str
Get the secret from this string.
This function is the same as RefreshToken::as_str
, but has another name for searchability, prefer to use this function.
Sourcepub fn refresh_token_request(
&self,
client_id: &ClientId,
client_secret: &ClientSecret,
) -> Request<Vec<u8>>
pub fn refresh_token_request( &self, client_id: &ClientId, client_secret: &ClientSecret, ) -> Request<Vec<u8>>
Get the request needed to refresh this token.
Parse the response from this endpoint with TwitchTokenResponse::from_response
Sourcepub async fn refresh_token<'a, C>(
&self,
http_client: &'a C,
client_id: &ClientId,
client_secret: &ClientSecret,
) -> Result<(AccessToken, Duration, Option<RefreshToken>), RefreshTokenError<<C as Client>::Error>>where
C: Client,
Available on crate feature client
only.
pub async fn refresh_token<'a, C>(
&self,
http_client: &'a C,
client_id: &ClientId,
client_secret: &ClientSecret,
) -> Result<(AccessToken, Duration, Option<RefreshToken>), RefreshTokenError<<C as Client>::Error>>where
C: Client,
client
only.Refresh the token, call if it has expired.
See https://dev.twitch.tv/docs/authentication/refresh-tokens
Trait Implementations§
Source§impl AsRef<RefreshTokenRef> for RefreshToken
impl AsRef<RefreshTokenRef> for RefreshToken
Source§fn as_ref(&self) -> &RefreshTokenRef
fn as_ref(&self) -> &RefreshTokenRef
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<str> for RefreshToken
impl AsRef<str> for RefreshToken
Source§impl Borrow<RefreshTokenRef> for RefreshToken
impl Borrow<RefreshTokenRef> for RefreshToken
Source§fn borrow(&self) -> &RefreshTokenRef
fn borrow(&self) -> &RefreshTokenRef
Immutably borrows from an owned value. Read more
Source§impl Borrow<str> for RefreshToken
impl Borrow<str> for RefreshToken
Source§impl Clone for RefreshToken
impl Clone for RefreshToken
Source§fn clone(&self) -> RefreshToken
fn clone(&self) -> RefreshToken
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RefreshToken
impl Debug for RefreshToken
Source§impl Deref for RefreshToken
impl Deref for RefreshToken
Source§impl<'de> Deserialize<'de> for RefreshToken
impl<'de> Deserialize<'de> for RefreshToken
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for RefreshToken
impl Display for RefreshToken
Source§impl From<&RefreshTokenRef> for RefreshToken
impl From<&RefreshTokenRef> for RefreshToken
Source§fn from(s: &RefreshTokenRef) -> Self
fn from(s: &RefreshTokenRef) -> Self
Converts to this type from the input type.
Source§impl From<&str> for RefreshToken
impl From<&str> for RefreshToken
Source§impl From<Box<RefreshTokenRef>> for RefreshToken
impl From<Box<RefreshTokenRef>> for RefreshToken
Source§fn from(r: Box<RefreshTokenRef>) -> Self
fn from(r: Box<RefreshTokenRef>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<Cow<'a, RefreshTokenRef>> for RefreshToken
impl<'a> From<Cow<'a, RefreshTokenRef>> for RefreshToken
Source§fn from(r: Cow<'a, RefreshTokenRef>) -> Self
fn from(r: Cow<'a, RefreshTokenRef>) -> Self
Converts to this type from the input type.
Source§impl From<RefreshToken> for Box<RefreshTokenRef>
impl From<RefreshToken> for Box<RefreshTokenRef>
Source§fn from(r: RefreshToken) -> Self
fn from(r: RefreshToken) -> Self
Converts to this type from the input type.
Source§impl<'a> From<RefreshToken> for Cow<'a, RefreshTokenRef>
impl<'a> From<RefreshToken> for Cow<'a, RefreshTokenRef>
Source§fn from(owned: RefreshToken) -> Self
fn from(owned: RefreshToken) -> Self
Converts to this type from the input type.
Source§impl From<RefreshToken> for String
impl From<RefreshToken> for String
Source§fn from(s: RefreshToken) -> Self
fn from(s: RefreshToken) -> Self
Converts to this type from the input type.
Source§impl From<String> for RefreshToken
impl From<String> for RefreshToken
Source§impl FromStr for RefreshToken
impl FromStr for RefreshToken
Source§impl Hash for RefreshToken
impl Hash for RefreshToken
Source§impl Ord for RefreshToken
impl Ord for RefreshToken
Source§impl PartialEq<&RefreshTokenRef> for RefreshToken
impl PartialEq<&RefreshTokenRef> for RefreshToken
Source§impl PartialEq<RefreshToken> for &RefreshTokenRef
impl PartialEq<RefreshToken> for &RefreshTokenRef
Source§impl PartialEq<RefreshToken> for RefreshTokenRef
impl PartialEq<RefreshToken> for RefreshTokenRef
Source§impl PartialEq<RefreshTokenRef> for RefreshToken
impl PartialEq<RefreshTokenRef> for RefreshToken
Source§impl PartialEq for RefreshToken
impl PartialEq for RefreshToken
Source§impl PartialOrd for RefreshToken
impl PartialOrd for RefreshToken
Source§impl Serialize for RefreshToken
impl Serialize for RefreshToken
impl Eq for RefreshToken
impl StructuralPartialEq for RefreshToken
Auto Trait Implementations§
impl Freeze for RefreshToken
impl RefUnwindSafe for RefreshToken
impl Send for RefreshToken
impl Sync for RefreshToken
impl Unpin for RefreshToken
impl UnwindSafe for RefreshToken
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)