pub struct TeamAuthDefaultClient { /* private fields */ }
Available on crate feature
default_client
only.Expand description
Default HTTP client using Team authorization.
Implementations§
Source§impl TeamAuthDefaultClient
impl TeamAuthDefaultClient
Sourcepub fn new(tokens: impl Into<Arc<TokenCache>>) -> Self
pub fn new(tokens: impl Into<Arc<TokenCache>>) -> Self
Create a new client using the given OAuth2 token, with no user/admin context selected.
Sourcepub fn select(&mut self, team_select: Option<TeamSelect>)
pub fn select(&mut self, team_select: Option<TeamSelect>)
Select a user or team context to operate in.
Sourcepub fn set_path_root(&mut self, path_root: &PathRoot)
pub fn set_path_root(&mut self, path_root: &PathRoot)
Set a root which all subsequent paths are evaluated relative to.
The default, if this function is not called, is to behave as if it was called with
PathRoot::Home
.
See https://www.dropbox.com/developers/reference/path-root-header-modes for more information.
Trait Implementations§
Source§impl HttpClient for TeamAuthDefaultClient
impl HttpClient for TeamAuthDefaultClient
Source§type Request = UreqRequest
type Request = UreqRequest
The concrete type of request supported by the client.
Source§fn execute(
&self,
request: Self::Request,
body: &[u8],
) -> Result<HttpRequestResultRaw, Error>
fn execute( &self, request: Self::Request, body: &[u8], ) -> Result<HttpRequestResultRaw, Error>
Make a HTTP request.
Source§fn new_request(&self, url: &str) -> Self::Request
fn new_request(&self, url: &str) -> Self::Request
Create a new request instance for the given URL. It should be a POST request.
Source§fn update_token(&self, old_token: Arc<String>) -> Result<bool, Error>
fn update_token(&self, old_token: Arc<String>) -> Result<bool, Error>
Attempt to update the current authentication token. The previously fetched token is given
as a way to avoid repeat updates in case of a race. If the update is successful, return
true
and the current request will be retried with a newly-fetched token. Return false
if
authentication is not supported, or return an error if the update operation fails.Source§fn team_select(&self) -> Option<&TeamSelect>
fn team_select(&self) -> Option<&TeamSelect>
The alternate user or team context currently set, if any.
impl TeamAuthClient for TeamAuthDefaultClient
Auto Trait Implementations§
impl Freeze for TeamAuthDefaultClient
impl !RefUnwindSafe for TeamAuthDefaultClient
impl Send for TeamAuthDefaultClient
impl Sync for TeamAuthDefaultClient
impl Unpin for TeamAuthDefaultClient
impl !UnwindSafe for TeamAuthDefaultClient
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> HttpClient for Twhere
T: HttpClient + Sync,
impl<T> HttpClient for Twhere
T: HttpClient + Sync,
Source§type Request = <T as HttpClient>::Request
type Request = <T as HttpClient>::Request
The concrete type of request supported by the client.
Source§async fn execute(
&self,
request: <T as HttpClient>::Request,
body: Bytes,
) -> Result<HttpRequestResultRaw, Error>
async fn execute( &self, request: <T as HttpClient>::Request, body: Bytes, ) -> Result<HttpRequestResultRaw, Error>
Make a HTTP request.
async fn execute_borrowed_body( &self, request: <T as HttpClient>::Request, body_slice: &[u8], ) -> Result<HttpRequestResultRaw, Error>
Source§fn new_request(&self, url: &str) -> <T as HttpClient>::Request
fn new_request(&self, url: &str) -> <T as HttpClient>::Request
Create a new request instance for the given URL. It should be a POST request.
Source§fn update_token(
&self,
old_token: Arc<String>,
) -> impl Future<Output = Result<bool, Error>> + Send
fn update_token( &self, old_token: Arc<String>, ) -> impl Future<Output = Result<bool, Error>> + Send
Attempt to update the current authentication token. The previously fetched token is given
as a way to avoid repeat updates in case of a race. If the update is successful, return
true
and the current request will be retried with a newly-fetched token. Return false
if
authentication is not supported, or return an error if the update operation fails.Source§fn team_select(&self) -> Option<&TeamSelect>
fn team_select(&self) -> Option<&TeamSelect>
The alternate user or team context currently set, if any.