Packages

The extension for building GraphQL APIs with Ash

Current section

Files

Jump to
ash_graphql lib resource subscription.ex
Raw

lib/resource/subscription.ex

defmodule AshGraphql.Resource.Subscription do
@moduledoc "Represents a configured query on a resource"
defstruct [
:name,
:resource,
:actions,
:action_types,
:read_action,
:actor,
:hide_inputs,
:meta
]
@subscription_schema [
name: [
type: :atom,
doc: "The name to use for the subscription."
],
actor: [
type:
{:spark_function_behaviour, AshGraphql.Subscription.Actor,
{AshGraphql.Subscription.ActorFunction, 1}},
doc: "The actor to use for authorization."
],
actions: [
type: {:or, [{:list, :atom}, :atom]},
doc: "The create/update/destroy actions the subsciption should listen to."
],
action_types: [
type: {:or, [{:list, :atom}, :atom]},
doc: "The type of actions the subsciption should listen to."
],
read_action: [
type: :atom,
doc: "The read action to use for reading data"
],
hide_inputs: [
type: {:list, :atom},
doc:
"A list of inputs to hide from the subscription, usable if the read action has arguments.",
default: []
],
meta: [
type: :keyword_list,
doc: "A keyword list of metadata to include in the subscription."
]
]
def schema, do: @subscription_schema
end