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§
Source§impl Client
impl Client
Sourcepub fn new<Endpoint>(endpoint: Endpoint) -> Client
pub fn new<Endpoint>(endpoint: Endpoint) -> Client
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>(
&self,
_query: Q,
variables: <Q as GraphQLQuery>::Variables,
) -> impl Future<Item = Response<<Q as GraphQLQuery>::ResponseData>, Error = ClientError> + 'staticwhere
Q: GraphQLQuery + 'static,
pub fn call<Q>(
&self,
_query: Q,
variables: <Q as GraphQLQuery>::Variables,
) -> impl Future<Item = Response<<Q as GraphQLQuery>::ResponseData>, Error = ClientError> + 'staticwhere
Q: GraphQLQuery + 'static,
Perform a query.
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
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