Struct byo_graphql::GraphqlClient
source · 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 !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