Trait ClientTrait

Source
pub trait ClientTrait {
    // Required methods
    fn access_token(&self) -> impl Future<Output = Result<String>> + Send;
    fn refresh_access_token(
        &mut self,
    ) -> impl Future<Output = Result<()>> + Send;
    fn http_client(&self) -> &Client;

    // Provided methods
    fn url_with_query<I, K, V>(&self, url: &str, queries: I) -> Result<Url>
       where I: IntoIterator,
             I::Item: Borrow<(K, V)>,
             K: AsRef<str>,
             V: AsRef<str> { ... }
    fn authorized_url(
        &self,
        url: &str,
    ) -> impl Future<Output = Result<Url>> + Send
       where Self: Sync { ... }
    fn get_empty<R: DeserializeOwned, U: IntoUrl + Send>(
        &self,
        url: U,
    ) -> impl Future<Output = Result<R>> + Send
       where Self: Sync { ... }
    fn get<R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + ?Sized + Sync>(
        &self,
        url: U,
        query: &T,
    ) -> impl Future<Output = Result<R>> + Send
       where Self: Sync { ... }
    fn post_empty<R: DeserializeOwned, U: IntoUrl + Send>(
        &self,
        url: U,
    ) -> impl Future<Output = Result<R>> + Send
       where Self: Sync { ... }
    fn post<R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + ?Sized + Sync>(
        &self,
        url: U,
        data: &T,
    ) -> impl Future<Output = Result<R>> + Send
       where Self: Sync { ... }
    fn json<R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + ?Sized + Sync>(
        &self,
        url: U,
        data: &T,
    ) -> impl Future<Output = Result<R>> + Send
       where Self: Sync { ... }
    fn download<U: IntoUrl + Send, T: Serialize + ?Sized + Sync>(
        &self,
        url: U,
        query: &T,
    ) -> impl Future<Output = Result<Vec<u8>>> + Send
       where Self: Sync { ... }
}

Required Methods§

Source

fn access_token(&self) -> impl Future<Output = Result<String>> + Send

Source

fn refresh_access_token(&mut self) -> impl Future<Output = Result<()>> + Send

Source

fn http_client(&self) -> &Client

Provided Methods§

Source

fn url_with_query<I, K, V>(&self, url: &str, queries: I) -> Result<Url>
where I: IntoIterator, I::Item: Borrow<(K, V)>, K: AsRef<str>, V: AsRef<str>,

Source

fn authorized_url(&self, url: &str) -> impl Future<Output = Result<Url>> + Send
where Self: Sync,

Source

fn get_empty<R: DeserializeOwned, U: IntoUrl + Send>( &self, url: U, ) -> impl Future<Output = Result<R>> + Send
where Self: Sync,

Source

fn get<R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + ?Sized + Sync>( &self, url: U, query: &T, ) -> impl Future<Output = Result<R>> + Send
where Self: Sync,

Source

fn post_empty<R: DeserializeOwned, U: IntoUrl + Send>( &self, url: U, ) -> impl Future<Output = Result<R>> + Send
where Self: Sync,

Source

fn post<R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + ?Sized + Sync>( &self, url: U, data: &T, ) -> impl Future<Output = Result<R>> + Send
where Self: Sync,

Source

fn json<R: DeserializeOwned, U: IntoUrl + Send, T: Serialize + ?Sized + Sync>( &self, url: U, data: &T, ) -> impl Future<Output = Result<R>> + Send
where Self: Sync,

Source

fn download<U: IntoUrl + Send, T: Serialize + ?Sized + Sync>( &self, url: U, query: &T, ) -> impl Future<Output = Result<Vec<u8>>> + Send
where Self: Sync,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§