pub struct GraphqlClient { /* private fields */ }
Expand description
A client that you may reuse to do several queries
Implementations§
Source§impl GraphqlClient
impl GraphqlClient
Sourcepub fn set_bearer_auth<S: Into<String>>(&mut self, auth: S)
pub fn set_bearer_auth<S: Into<String>>(&mut self, auth: S)
specify the optional authentication token which will be used in all requests
Sourcepub async fn raw<S: Into<String>>(&self, query: S) -> ByoResult<Response>
pub async fn raw<S: Into<String>>(&self, query: S) -> ByoResult<Response>
return a raw reqwest Response. You should usually not need this function
Sourcepub async fn text<S: Into<String>>(&self, query: S) -> ByoResult<String>
pub async fn text<S: Into<String>>(&self, query: S) -> ByoResult<String>
get the server’s answer as unparsed text. This is mainly useful to debug and tune your structures or query
Sourcepub async fn get_data<S: Into<String>, Data: DeserializeOwned>(
&self,
query: S,
) -> ByoResult<Data>
pub async fn get_data<S: Into<String>, Data: DeserializeOwned>( &self, query: S, ) -> ByoResult<Data>
get the data
part of the answer in the desired type
(it usually looks like a map)
Sourcepub async fn get_first_item<S: Into<String>, Item: DeserializeOwned>(
&self,
query: S,
) -> ByoResult<Item>
pub async fn get_first_item<S: Into<String>, Item: DeserializeOwned>( &self, query: S, ) -> ByoResult<Item>
get the first item in the answer, if present. This is a convenience method for the simplest case, most especially for when you query a unique item.
Auto Trait Implementations§
impl Freeze for GraphqlClient
impl !RefUnwindSafe for GraphqlClient
impl Send for GraphqlClient
impl Sync for GraphqlClient
impl Unpin for GraphqlClient
impl !UnwindSafe for GraphqlClient
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