View Source GraphQLWSClient.Client behaviour (GraphQL-over-Websocket Client v0.1.0)

A behaviour that is implemented by modules that use GraphQLWSClient.

Link to this section Summary

Callbacks

Closes the connection to the server.

Connects to the server.

Connects to the server. Raises on error

Sends a query to the server and returns the result.

Sends a query to the server and returns the result. Raises on error.

Starts the client.

Sends a subscription to the server and returns the subscription ID.

Sends a subscription to the server and returns the subscription ID. Raises on error.

Removes the subscription for the given subscription ID.

Removes the subscription for the given subscription ID. Raises on error.

Link to this section Callbacks

@callback close(timeout()) :: :ok

Closes the connection to the server.

@callback open(timeout()) :: :ok | {:error, Exception.t()}

Connects to the server.

@callback open!(timeout()) :: :ok | no_return()

Connects to the server. Raises on error

Link to this callback

query(query, map, timeout)

View Source
@callback query(GraphQLWSClient.query(), map(), timeout()) ::
  {:ok, any()} | {:error, Exception.t()}

Sends a query to the server and returns the result.

Link to this callback

query!(query, map, timeout)

View Source
@callback query!(GraphQLWSClient.query(), map(), timeout()) :: any() | no_return()

Sends a query to the server and returns the result. Raises on error.

@callback start_link(GenServer.options()) :: GenServer.on_start()

Starts the client.

Link to this callback

subscribe(query, map, pid, timeout)

View Source
@callback subscribe(GraphQLWSClient.query(), map(), pid(), timeout()) ::
  {:ok, GraphQLWSClient.subscription_id()} | {:error, Exception.t()}

Sends a subscription to the server and returns the subscription ID.

Link to this callback

subscribe!(query, map, pid, timeout)

View Source

Sends a subscription to the server and returns the subscription ID. Raises on error.

Link to this callback

unsubscribe(subscription_id, timeout)

View Source
@callback unsubscribe(GraphQLWSClient.subscription_id(), timeout()) ::
  :ok | {:error, Exception.t()}

Removes the subscription for the given subscription ID.

Link to this callback

unsubscribe!(subscription_id, timeout)

View Source
@callback unsubscribe!(GraphQLWSClient.subscription_id(), timeout()) :: :ok | no_return()

Removes the subscription for the given subscription ID. Raises on error.