Struct graphql_client_web::Client
source · pub struct Client { /* private fields */ }
Expand description
The main interface to the library.
The workflow is the following:
- create a client
- (optionally) configure it
- use it to perform queries with the [call] method
Implementations
sourceimpl Client
impl Client
sourcepub fn new<Endpoint>(endpoint: Endpoint) -> Clientwhere
Endpoint: Into<String>,
pub fn new<Endpoint>(endpoint: Endpoint) -> Clientwhere
Endpoint: Into<String>,
Initialize a client. The endpoint
parameter is the URI of the GraphQL API.
sourcepub fn add_header(&mut self, name: &str, value: &str)
pub fn add_header(&mut self, name: &str, value: &str)
Add a header to those sent with the requests. Can be used for things like authorization.
sourcepub fn call<Q: GraphQLQuery + 'static>(
&self,
_query: Q,
variables: Q::Variables
) -> impl Future<Item = Response<Q::ResponseData>, Error = ClientError> + 'static
pub fn call<Q: GraphQLQuery + 'static>(
&self,
_query: Q,
variables: Q::Variables
) -> impl Future<Item = Response<Q::ResponseData>, Error = ClientError> + 'static
Perform a query.
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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