Struct TeamAuthDefaultClient

Source
pub struct TeamAuthDefaultClient { /* private fields */ }
Available on crate feature default_client only.
Expand description

Default HTTP client using Team authorization.

Implementations§

Source§

impl TeamAuthDefaultClient

Source

pub fn new(tokens: impl Into<Arc<TokenCache>>) -> Self

Create a new client using the given OAuth2 token, with no user/admin context selected.

Source

pub fn select(&mut self, team_select: Option<TeamSelect>)

Select a user or team context to operate in.

Source

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

Source§

type Request = UreqRequest

The concrete type of request supported by the client.
Source§

fn execute( &self, request: Self::Request, body: &[u8], ) -> Result<HttpRequestResultRaw, Error>

Make a HTTP request.
Source§

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 token(&self) -> Option<Arc<String>>

The client’s current authentication token, if any.
Source§

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 path_root(&self) -> Option<&str>

The currently set path root, if any.
Source§

fn team_select(&self) -> Option<&TeamSelect>

The alternate user or team context currently set, if any.
Source§

impl TeamAuthClient for TeamAuthDefaultClient

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HttpClient for T
where T: HttpClient + Sync,

Source§

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>

Make a HTTP request.
Source§

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

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

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 token(&self) -> Option<Arc<String>>

The client’s current authentication token, if any.
Source§

fn path_root(&self) -> Option<&str>

The currently set path root, if any.
Source§

fn team_select(&self) -> Option<&TeamSelect>

The alternate user or team context currently set, if any.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> TeamAuthClient for T
where T: TeamAuthClient + Sync,