Struct artemis::client::Client[][src]

#[repr(transparent)]pub struct Client<M: Exchange = TerminatorExchange>(pub Arc<ClientImpl<M>>);

An Artemis client type used to run queries against

Implementations

impl Client[src]

pub fn builder<U: Into<String>>(url: U) -> ClientBuilder[src]

Returns a ClientBuilder with the given endpoint URL

impl<M: Exchange> Client<M>[src]

pub async fn query<Q: GraphQLQuery>(
    &self,
    _query: Q,
    variables: Q::Variables
) -> Result<Response<Q::ResponseData>, QueryError>
[src]

Executes a query with the given variables Returns the result of the query, or a QueryError if one of the exchanges encountered a fatal error.

Example

let client = ClientBuilder::new("http://localhost:8080/graphql")
    .with_default_exchanges()
    .build();

let result = client.query(GetConference, Variables { id: "1".to_string() }).await.unwrap();

assert!(result.data.is_some())

pub async fn query_with_options<Q: GraphQLQuery>(
    &self,
    _query: Q,
    variables: Q::Variables,
    options: QueryOptions
) -> Result<Response<Q::ResponseData>, QueryError>
[src]

Executes a query with the given variables and options Returns the result of the query, or a QueryError if one of the exchanges encountered a fatal error.

Example


let client = ClientBuilder::new("http://localhost:8080/graphql")
    .with_default_exchanges()
    .build();

let result = client.query(GetConference, Variables { id: "1".to_string() }).await.unwrap();

assert!(result.data.is_some())

pub fn subscribe<Q: GraphQLQuery + 'static>(
    &self,
    query: Q,
    variables: Q::Variables
) -> Observable<Result<Response<<Q as GraphQLQuery>::ResponseData>, QueryError>, M>
[src]

Subscribes to a query, returning any potential early results, the initial result and any future updates The function returns an Observable which can be subscribed to like a regular stream. Dropping the Observable will cancel the subscription.

Requires feature: observable

Example

let client = ClientBuilder::new("http://localhost:8080/graphql")
    .with_default_exchanges()
    .build();

let mut observable = client.subscribe(GetConference, Variables { id: "1".to_string() });
let result = observable.next().await.unwrap().unwrap();

assert!(result.data.is_some())

pub fn subscribe_with_options<Q: GraphQLQuery + 'static>(
    &self,
    _query: Q,
    variables: Q::Variables,
    options: QueryOptions
) -> Observable<Result<Response<<Q as GraphQLQuery>::ResponseData>, QueryError>, M>
[src]

Subscribes to a query with options, returning any potential early results, the initial result and any future updates The function returns an Observable which can be subscribed to like a regular stream. Dropping the Observable will cancel the subscription.

Requires feature: observable

Example


let client = ClientBuilder::new("http://localhost:8080/graphql")
    .with_default_exchanges()
    .build();

let mut observable = client.subscribe(GetConference, Variables { id: "1".to_string() });
let result = observable.next().await.unwrap().unwrap();

assert!(result.data.is_some())

Trait Implementations

impl<M: Clone + Exchange> Clone for Client<M>[src]

Auto Trait Implementations

impl<M = TerminatorExchange> !RefUnwindSafe for Client<M>

impl<M> Send for Client<M>

impl<M> Sync for Client<M>

impl<M> Unpin for Client<M>

impl<M = TerminatorExchange> !UnwindSafe for Client<M>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,