ExUtcp.Transports.Graphql (ex_utcp v0.3.2)

Copy Markdown View Source

Production-ready GraphQL transport implementation for UTCP.

This transport handles GraphQL-based tool providers with:

  • Real GraphQL queries, mutations, and subscriptions
  • Connection management and pooling
  • Authentication support (API Key, Basic, OAuth2)
  • Error recovery with retry logic
  • Real-time subscription support
  • Schema introspection and validation

Summary

Functions

Returns a specification to start this module under a supervisor.

Introspects the GraphQL schema.

Creates a new GraphQL transport.

Starts the GraphQL transport GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

introspect_schema(provider, opts \\ [])

@spec introspect_schema(
  pid(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Introspects the GraphQL schema.

mutation(provider, mutation_string, variables \\ %{}, opts \\ [])

@spec mutation(pid(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, term()}

Executes a GraphQL mutation.

new(opts \\ [])

@spec new(keyword()) :: %ExUtcp.Transports.Graphql{
  connection_timeout: non_neg_integer(),
  logger: function(),
  max_retries: non_neg_integer(),
  pool_opts: keyword(),
  retry_config: map(),
  retry_delay: non_neg_integer()
}

Creates a new GraphQL transport.

query(provider, query_string, variables \\ %{}, opts \\ [])

@spec query(pid(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, term()}

Executes a GraphQL query.

start_link(opts \\ [])

@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}

Starts the GraphQL transport GenServer.

subscription(provider, subscription_string, variables \\ %{}, opts \\ [])

@spec subscription(pid(), String.t(), map(), keyword()) ::
  {:ok, [map()]} | {:error, term()}

Executes a GraphQL subscription.