Struct prima_bridge::GraphQLRequest
source · [−]pub struct GraphQLRequest<'a> { /* private fields */ }
Expand description
The GraphQLRequest is a struct that represent a GraphQL request to be done with the Bridge
Implementations
sourceimpl<'a> GraphQLRequest<'a>
impl<'a> GraphQLRequest<'a>
sourcepub fn new<S: Serialize>(
bridge: &'a Bridge,
graphql_body: impl Into<GraphQLBody<S>>
) -> PrimaBridgeResult<Self>
pub fn new<S: Serialize>(
bridge: &'a Bridge,
graphql_body: impl Into<GraphQLBody<S>>
) -> PrimaBridgeResult<Self>
creates a new GraphQLRequest
pub fn new_with_multipart<S: Serialize>(
bridge: &'a Bridge,
graphql_body: impl Into<GraphQLBody<S>>,
multipart: Multipart
) -> PrimaBridgeResult<Self>
Trait Implementations
sourceimpl<'a> DeliverableRequest<'a> for GraphQLRequest<'a>
impl<'a> DeliverableRequest<'a> for GraphQLRequest<'a>
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. Read more
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. Read more
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
sourcefn set_custom_headers(self, headers: HeaderMap) -> Self
fn set_custom_headers(self, headers: HeaderMap) -> Self
adds a new set of headers to the request. Any header already present gets merged.
sourcefn set_query_pairs(self, query_pairs: Vec<(&'a str, &'a str)>) -> Self
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_form(&self) -> PrimaBridgeResult<Option<Form>>
sourcefn add_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self
fn add_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self
adds a new set of headers to the request. Any header already present gets merged.
sourcefn with_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self
fn with_custom_headers(self, headers: Vec<(HeaderName, HeaderValue)>) -> Self
add a custom header to the set of request headers
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 param
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 custom query string param
fn get_all_headers(&self) -> HeaderMap
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) -> HeaderMap
Auto Trait Implementations
impl<'a> !RefUnwindSafe for GraphQLRequest<'a>
impl<'a> Send for GraphQLRequest<'a>
impl<'a> Sync for GraphQLRequest<'a>
impl<'a> Unpin for GraphQLRequest<'a>
impl<'a> !UnwindSafe for GraphQLRequest<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more