pub trait DeliverableRequest<'a>: Sized + Sealed + 'a {
    type Client: BridgeClient;

Show 17 methods // Required methods fn raw_body(self, body: impl Into<Body>) -> Self; fn json_body<B: Serialize>(self, body: &B) -> PrimaBridgeResult<Self>; fn method(self, method: Method) -> Self; fn to(self, path: &'a str) -> Self; fn ignore_status_code(self) -> Self; fn set_timeout(self, timeout: Duration) -> Self; fn get_timeout(&self) -> Duration; fn get_id(&self) -> Uuid; fn get_body(&self) -> Option<&[u8]>; // Provided methods fn with_custom_header(self, name: HeaderName, value: HeaderValue) -> Self { ... } fn with_custom_headers( self, headers: Vec<(HeaderName, HeaderValue)> ) -> Self { ... } fn with_query_pair(self, name: &'a str, value: &'a str) -> Self { ... } fn with_query_pairs(self, pairs: Vec<(&'a str, &'a str)>) -> Self { ... } fn get_all_headers(&self) -> HeaderMap { ... } fn send<'async_trait>( self ) -> Pin<Box<dyn Future<Output = PrimaBridgeResult<Response>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn get_url(&self) -> Url { ... } fn tracing_headers(&self) -> HeaderMap { ... }
}
Expand description

Represents a request that is ready to be delivered to the server.

Required Associated Types§

source

type Client: BridgeClient

Required Methods§

source

fn raw_body(self, body: impl Into<Body>) -> Self

sets the raw body for the request it will get delivered in the request as is.

source

fn json_body<B: Serialize>(self, body: &B) -> PrimaBridgeResult<Self>

sets a serializable body for the request

source

fn method(self, method: Method) -> Self

sets request method. Defaults to GET.

source

fn to(self, path: &'a str) -> Self

sets the destination path (relative to the url defined in the bridge) for the request

source

fn ignore_status_code(self) -> Self

ignore the status code, and parse the results even if the response has a wrong status code. This is useful when you are dealing with an api that return errors with a not 2XX status codes.

source

fn set_timeout(self, timeout: Duration) -> Self

set request timeout

source

fn get_timeout(&self) -> Duration

get request timeout

source

fn get_id(&self) -> Uuid

returns a unique id for the request

source

fn get_body(&self) -> Option<&[u8]>

Returns the request body as a slice of bytes.

This will return None in the following cases:

  • The request does not have a body
  • The request body is multipart form data
  • The request body is a stream (eg. a file) and therefore not in memory

Provided Methods§

source

fn with_custom_header(self, name: HeaderName, value: HeaderValue) -> Self

adds a new header to the request. If the header is already present, it gets overwritten.

source

fn with_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self

adds a new set of headers to the request. Any header already present gets overwritten.

source

fn with_query_pair(self, name: &'a str, value: &'a str) -> Self

add a custom query string parameter

source

fn with_query_pairs(self, pairs: Vec<(&'a str, &'a str)>) -> Self

add a list of custom query string parameters

source

fn get_all_headers(&self) -> HeaderMap

source

fn send<'async_trait>( self ) -> Pin<Box<dyn Future<Output = PrimaBridgeResult<Response>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

source

fn get_url(&self) -> Url

source

fn tracing_headers(&self) -> HeaderMap

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, Client: BridgeClient> DeliverableRequest<'a> for GraphQLRequest<'a, Client>

§

type Client = Client

source§

impl<'a, Client: BridgeClient> DeliverableRequest<'a> for RestRequest<'a, Client>

§

type Client = Client