Trait HttpClient

Source
pub trait HttpClient {
    // Required method
    fn post<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
        client_id: &'life2 str,
        client_secret: &'life3 str,
        body: String,
    ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Abstraction of the parts of a HTTP client implementation that this crate needs.

Required Methods§

Source

fn post<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, url: &'life1 str, client_id: &'life2 str, client_secret: &'life3 str, body: String, ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Make a HTTP POST request.

[client_id] and [client_secret] are to be given as HTTP Basic Auth credentials username and password, respectively.

The [body] is of content-type application/x-www-form-urlencoded, and the response body is expected to be application/json.

The response body must be deserialized into a json value.

Implementations on Foreign Types§

Source§

impl HttpClient for Client

Source§

fn post<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, url: &'life1 str, client_id: &'life2 str, client_secret: &'life3 str, body: String, ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Implementors§