Struct prima_bridge::prelude::GraphQLRequest
source · pub struct GraphQLRequest<'a, Client: BridgeClient> { /* private fields */ }
Expand description
The GraphQLRequest is a struct that represent a GraphQL request to be done with a crate::Bridge.
Implementations§
source§impl<'a, Client: BridgeClient> GraphQLRequest<'a, Client>
impl<'a, Client: BridgeClient> GraphQLRequest<'a, Client>
sourcepub fn new<S: Serialize>(
bridge: &'a BridgeImpl<Client>,
graphql_body: impl Into<GraphQLBody<S>>
) -> PrimaBridgeResult<Self>
pub fn new<S: Serialize>( bridge: &'a BridgeImpl<Client>, graphql_body: impl Into<GraphQLBody<S>> ) -> PrimaBridgeResult<Self>
Creates a new GraphQLRequest
pub fn new_with_multipart<S: Serialize>( bridge: &'a BridgeImpl<Client>, graphql_body: impl Into<GraphQLBody<S>>, multipart: GraphQLMultipart ) -> PrimaBridgeResult<Self>
Trait Implementations§
source§impl<'a, Client: BridgeClient> DeliverableRequest<'a> for GraphQLRequest<'a, Client>
impl<'a, Client: BridgeClient> DeliverableRequest<'a> for GraphQLRequest<'a, Client>
type Client = Client
source§fn 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.
source§fn 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
source§fn 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
source§fn 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.
source§fn set_timeout(self, timeout: Duration) -> Self
fn set_timeout(self, timeout: Duration) -> Self
set request timeout
source§fn get_timeout(&self) -> Duration
fn get_timeout(&self) -> Duration
get request timeout
source§fn 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.
source§fn 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.
source§fn 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
source§fn 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 get_url(&self) -> Url
fn tracing_headers(&self) -> HeaderMap
Auto Trait Implementations§
impl<'a, Client> !RefUnwindSafe for GraphQLRequest<'a, Client>
impl<'a, Client> Send for GraphQLRequest<'a, Client>where
Client: Sync,
impl<'a, Client> Sync for GraphQLRequest<'a, Client>where
Client: Sync,
impl<'a, Client> Unpin for GraphQLRequest<'a, Client>
impl<'a, Client> !UnwindSafe for GraphQLRequest<'a, Client>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more