pub struct HttpSession { /* private fields */ }Expand description
HTTP session manager
Implementations§
Source§impl HttpSession
impl HttpSession
Sourcepub fn new(config: HttpConfig) -> Self
pub fn new(config: HttpConfig) -> Self
Create a new HTTP session
Sourcepub fn config(&self) -> &HttpConfig
pub fn config(&self) -> &HttpConfig
Get the configuration
Sourcepub async fn set_auth_token(&self, token: AuthToken)
pub async fn set_auth_token(&self, token: AuthToken)
Set authentication token
Sourcepub async fn auth_token(&self) -> Option<AuthToken>
pub async fn auth_token(&self) -> Option<AuthToken>
Get authentication token
Sourcepub async fn is_authenticated(&self) -> bool
pub async fn is_authenticated(&self) -> bool
Check if session is authenticated
Sourcepub async fn clear_auth_token(&self)
pub async fn clear_auth_token(&self)
Clear authentication token
Sourcepub async fn is_token_expired(&self) -> bool
pub async fn is_token_expired(&self) -> bool
Check if token is expired
Get authorization header value
Trait Implementations§
Source§impl Clone for HttpSession
impl Clone for HttpSession
Source§fn clone(&self) -> HttpSession
fn clone(&self) -> HttpSession
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for HttpSession
impl !RefUnwindSafe for HttpSession
impl Send for HttpSession
impl Sync for HttpSession
impl Unpin for HttpSession
impl !UnwindSafe for HttpSession
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