Struct osauth::client::AuthenticatedClient
source · pub struct AuthenticatedClient { /* private fields */ }
Expand description
Authenticated HTTP client.
Uses Arc
internally and should be reused when possible by cloning it.
Implementations§
source§impl AuthenticatedClient
impl AuthenticatedClient
sourcepub async fn new<Auth: AuthType + 'static>(
client: Client,
auth_type: Auth
) -> Result<AuthenticatedClient, Error>
pub async fn new<Auth: AuthType + 'static>( client: Client, auth_type: Auth ) -> Result<AuthenticatedClient, Error>
Create a new authenticated client.
sourcepub async fn get_endpoint(
&self,
service_type: &str,
filters: &EndpointFilters
) -> Result<Url, Error>
pub async fn get_endpoint( &self, service_type: &str, filters: &EndpointFilters ) -> Result<Url, Error>
Get a URL for the requested service.
sourcepub async fn refresh(&mut self) -> Result<(), Error>
pub async fn refresh(&mut self) -> Result<(), Error>
Update the authentication.
Warning
Authentication will also be updated for clones of this client, since they share the same authentication object.
sourcepub fn set_auth_type<Auth: AuthType + 'static>(&mut self, auth_type: Auth)
pub fn set_auth_type<Auth: AuthType + 'static>(&mut self, auth_type: Auth)
Set a new authentication for this client.
sourcepub fn request(&self, method: Method, url: Url) -> RequestBuilder
pub fn request(&self, method: Method, url: Url) -> RequestBuilder
Start an authenticated request.
Trait Implementations§
source§impl Clone for AuthenticatedClient
impl Clone for AuthenticatedClient
source§fn clone(&self) -> AuthenticatedClient
fn clone(&self) -> AuthenticatedClient
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 AuthenticatedClient
impl Debug for AuthenticatedClient
source§impl From<AuthenticatedClient> for Client
impl From<AuthenticatedClient> for Client
source§fn from(value: AuthenticatedClient) -> Client
fn from(value: AuthenticatedClient) -> Client
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for AuthenticatedClient
impl Send for AuthenticatedClient
impl Sync for AuthenticatedClient
impl Unpin for AuthenticatedClient
impl !UnwindSafe for AuthenticatedClient
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