[][src]Struct conjure_runtime::Client

pub struct Client { /* fields omitted */ }

An asynchronous HTTP client to a remote service.

It implements the Conjure AsyncClient trait, but also offers a "raw" request interface for use with services that don't provide Conjure service definitions.

Methods

impl Client[src]

pub fn new(
    service: &str,
    user_agent: UserAgent,
    host_metrics: &Arc<HostMetricsRegistry>,
    metrics: &Arc<MetricRegistry>,
    config: &ServiceConfig
) -> Result<Client, Error>
[src]

Creates a new client.

The user agent is extended with an agent identifying the name and version of this crate.

pub fn set_assume_idempotent(&mut self, assume_idempotent: bool)[src]

Configures the client to assume that all requests are idempotent.

Idempotent operations can be rerun without changing the result of the operation, which allows the client to safely retry failed requests. By default, GET, HEAD, PUT, and DELETE requests are assumed to be idempotent, but this method can be used to override that behavior.

pub fn assume_idempotent(&self) -> bool[src]

Returns true if the client is configured to assume all requests are idempotent.

pub fn set_propagate_qos_errors(&mut self, propagate_qos_errors: bool)[src]

Configures transparent propagation of QoS errors (i.e. 429 and 503 responses).

By default, the client will automatically retry in response to QoS errors, but if this option is enabled it will instead immediately return an error which will cause the same response. This is designed for contexts where one service is proxying a request to another and the developer wants to avoid nested retry loops.

pub fn propagate_qos_errors(&self) -> bool[src]

Returns true if the client will propagate QoS errors.

pub fn set_propagate_service_errors(&mut self, propagate_service_errors: bool)[src]

Configures transparent propagation of service errors.

By default, the client will turn service errors returned by the remote server into an internal server error, but if this option is enabled it will instead return the same service error it received. This is designed for contexts where one service is proxying a request to another and the developer wants the upstream client to see downstream errors.

pub fn propagate_service_errors(&self) -> bool[src]

Returns true if the client will propagate service errors.

pub fn request(&self, method: Method, pattern: &'static str) -> RequestBuilder[src]

Returns a new request builder.

The pattern argument is a template for the request path. The param method on the builder is used to fill in the parameters in the pattern with dynamic values.

pub fn get(&self, pattern: &'static str) -> RequestBuilder[src]

Returns a new builder for a GET request.

pub fn post(&self, pattern: &'static str) -> RequestBuilder[src]

Returns a new builder for a POST request.

pub fn put(&self, pattern: &'static str) -> RequestBuilder[src]

Returns a new builder for a PUT request.

pub fn delete(&self, pattern: &'static str) -> RequestBuilder[src]

Returns a new builder for a DELETE request.

pub fn patch(&self, pattern: &'static str) -> RequestBuilder[src]

Returns a new builder for a PATCH request.

pub fn refresh_handle(&self) -> RefreshHandle[src]

Returns a new handle which can be used to dynamically refresh the client's configuration.

Trait Implementations

impl AsyncClient for Client[src]

type BinaryWriter = BodyWriter

The client's binary request body writer type.

type BinaryBody = ResponseBody

The client's binary response body type.

impl Clone for Client[src]

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,