pub struct Client<T> { /* private fields */ }
Expand description
Glimesh client. The client is generic over its connection/transport, meaning it can be used with http or websockets (or any future transport Glimesh might support).
To create a client you first create the underlying connection/transport,
such as crate::http::Connection
.
Implementations§
source§impl<T> Client<T>
impl<T> Client<T>
sourcepub fn new(conn: T) -> Self
pub fn new(conn: T) -> Self
Create a new client from a connection. Prefer calling into_client
on the connection itself.
sourcepub fn into_connection(self) -> T
pub fn into_connection(self) -> T
Turn this client back into its underlying connection
source§impl<T> Client<T>where
T: QueryConn,
impl<T> Client<T>where T: QueryConn,
sourcepub async fn query<Q>(
&self,
variables: Q::Variables
) -> Result<Q::ResponseData, T::Error>where
Q: GraphQLQuery,
Q::Variables: Send + Sync,
pub async fn query<Q>( &self, variables: Q::Variables ) -> Result<Q::ResponseData, T::Error>where Q: GraphQLQuery, Q::Variables: Send + Sync,
Perform a graphql query using the underlying connection.
Errors
See QueryConn::query
for error information
source§impl<T> Client<T>where
T: MutationConn,
impl<T> Client<T>where T: MutationConn,
sourcepub async fn mutate<Q>(
&self,
variables: Q::Variables
) -> Result<Q::ResponseData, T::Error>where
Q: GraphQLQuery,
Q::Variables: Send + Sync,
pub async fn mutate<Q>( &self, variables: Q::Variables ) -> Result<Q::ResponseData, T::Error>where Q: GraphQLQuery, Q::Variables: Send + Sync,
Perform a graphql mutation using the underlying connection
Errors
See MutationConn::mutate
for error information
source§impl<T> Client<T>where
T: SubscriptionConn,
impl<T> Client<T>where T: SubscriptionConn,
sourcepub async fn subscribe<'a, Q>(
&self,
variables: Q::Variables
) -> Result<Subscription<Q::ResponseData>, T::Error>where
Q: GraphQLQuery,
Q::Variables: Send + Sync,
pub async fn subscribe<'a, Q>( &self, variables: Q::Variables ) -> Result<Subscription<Q::ResponseData>, T::Error>where Q: GraphQLQuery, Q::Variables: Send + Sync,
Subscribe to a graphql subcription using the underlying connection.
Errors
See SubscriptionConn::subscribe
for error information