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>

source

pub fn new<S: Serialize>( bridge: &'a BridgeImpl<Client>, graphql_body: impl Into<GraphQLBody<S>> ) -> PrimaBridgeResult<Self>

Creates a new GraphQLRequest

source

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>

§

type Client = Client

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. Read more
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 get_url(&self) -> Url

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more