Trait prima_bridge::prelude::DeliverableRequest
source · 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§
Required Methods§
sourcefn raw_body(self, body: impl Into<Body>) -> Self
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.
sourcefn json_body<B: Serialize>(self, body: &B) -> PrimaBridgeResult<Self>
fn json_body<B: Serialize>(self, body: &B) -> PrimaBridgeResult<Self>
sets a serializable body for the request
sourcefn to(self, path: &'a str) -> Self
fn to(self, path: &'a str) -> Self
sets the destination path (relative to the url defined in the bridge) for the request
sourcefn ignore_status_code(self) -> Self
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.
sourcefn set_timeout(self, timeout: Duration) -> Self
fn set_timeout(self, timeout: Duration) -> Self
set request timeout
sourcefn get_timeout(&self) -> Duration
fn get_timeout(&self) -> Duration
get request timeout
Provided Methods§
sourcefn with_custom_header(self, name: HeaderName, value: HeaderValue) -> Self
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.
sourcefn with_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self
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.
sourcefn with_query_pair(self, name: &'a str, value: &'a str) -> Self
fn with_query_pair(self, name: &'a str, value: &'a str) -> Self
add a custom query string parameter
sourcefn with_query_pairs(self, pairs: Vec<(&'a str, &'a str)>) -> Self
fn with_query_pairs(self, pairs: Vec<(&'a str, &'a str)>) -> Self
add a list of custom query string parameters
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
Object Safety§
This trait is not object safe.