[][src]Trait prima_bridge::prelude::DeliverableRequest

pub trait DeliverableRequest<'a>: Sized + 'a {
    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_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self;
fn set_query_pairs(self, query_pairs: Vec<(&'a str, &'a str)>) -> Self;
fn get_id(&self) -> Uuid; 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) -> Vec<(HeaderName, HeaderValue)> { ... }
#[must_use] fn send<'async_trait>(
        &'a self
    ) -> Pin<Box<dyn Future<Output = PrimaBridgeResult<Response>> + Send + 'async_trait>>
    where
        'a: 'async_trait,
        Self: Sync + 'async_trait
, { ... }
fn get_url(&self) -> Url { ... }
fn tracing_headers(&self) -> Vec<(HeaderName, HeaderValue)> { ... } }

Represent a request that is ready to be delivered to the server

Required methods

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.

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

sets a serializable body for the request

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

sets request method. Defaults to GET.

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

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

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.

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

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

fn set_query_pairs(self, query_pairs: Vec<(&'a str, &'a str)>) -> Self

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

fn get_id(&self) -> Uuid

retrurns a unique id for the request

Loading content...

Provided methods

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

add a custom header to the set of request headers

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

add a custom query string param

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

add a custom query string param

fn get_all_headers(&self) -> Vec<(HeaderName, HeaderValue)>

#[must_use]fn send<'async_trait>(
    &'a self
) -> Pin<Box<dyn Future<Output = PrimaBridgeResult<Response>> + Send + 'async_trait>> where
    'a: 'async_trait,
    Self: Sync + 'async_trait, 

fn get_url(&self) -> Url

fn tracing_headers(&self) -> Vec<(HeaderName, HeaderValue)>

Loading content...

Implementors

impl<'a> DeliverableRequest<'a> for RestRequest<'a>[src]

impl<'a> DeliverableRequest<'a> for GraphQLRequest<'a>[src]

Loading content...