pub struct ClientCredentials<S: ?Sized> { /* private fields */ }
Expand description
Credentials for the client authentication.
Implementations§
Source§impl<S: ?Sized> ClientCredentials<S>
impl<S: ?Sized> ClientCredentials<S>
Sourcepub fn new(
client_id: impl Into<SharedString>,
client_secret: impl Into<SharedString>,
) -> Self
pub fn new( client_id: impl Into<SharedString>, client_secret: impl Into<SharedString>, ) -> Self
Creates a new instance.
Sourcepub fn try_from_config(config: &'static Table) -> Result<Self, Error>
pub fn try_from_config(config: &'static Table) -> Result<Self, Error>
Attempts to create a new instance with the configuration.
Sourcepub fn set_client_key(&mut self, client_key: impl Into<SharedString>)
pub fn set_client_key(&mut self, client_key: impl Into<SharedString>)
Sets the client key.
Sourcepub fn set_access_token(&self, access_token: impl ToString)
pub fn set_access_token(&self, access_token: impl ToString)
Sets the access token.
Sourcepub fn set_expires(&self, expires_in: Duration)
pub fn set_expires(&self, expires_in: Duration)
Sets the expires.
Sourcepub fn client_key(&self) -> &str
pub fn client_key(&self) -> &str
Returns the client key.
Sourcepub fn client_secret(&self) -> &str
pub fn client_secret(&self) -> &str
Returns the client secret.
Sourcepub fn access_token(&self) -> String
pub fn access_token(&self) -> String
Returns the access token regardless of whether it has expired.
Sourcepub fn expires_at(&self) -> DateTime
pub fn expires_at(&self) -> DateTime
Returns the time the client credentials expire at.
Sourcepub fn expires_in(&self) -> Duration
pub fn expires_in(&self) -> Duration
Returns the time when the client credentials will expire in.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true
if the access token for the client credentials has expired.
Sourcepub fn to_request_params(&self) -> Map
pub fn to_request_params(&self) -> Map
Converts self
to the request params.
Source§impl<S: ?Sized + AuthorizationProvider> ClientCredentials<S>
impl<S: ?Sized + AuthorizationProvider> ClientCredentials<S>
Trait Implementations§
Auto Trait Implementations§
impl<S> !Freeze for ClientCredentials<S>
impl<S> !RefUnwindSafe for ClientCredentials<S>
impl<S> Send for ClientCredentials<S>
impl<S> Sync for ClientCredentials<S>
impl<S> Unpin for ClientCredentials<S>
impl<S> UnwindSafe for ClientCredentials<S>where
S: UnwindSafe + ?Sized,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more