ash v0.1.1 Ash.Api View Source
An Api allows you to interact with your resources, anc holds non-resource-specific configuration.
Your Api can also house config that is not resource specific. Defining a resource won't do much for you. Once you have some resources defined, you include them in an Api like so:
defmodule MyApp.Api do
use Ash.Api
resources [OneResource, SecondResource]
end
Then you can interact through that Api with the actions that those resources expose.
For example: MyApp.Api.create(OneResource, %{attributes: %{name: "thing"}}), or
MyApp.Api.read(OneResource, %{filter: %{name: "thing"}}). Corresponding actions must
be defined in your resources in order to call them through the Api.
Link to this section Summary
Functions
By default, side loading data happens synchronously. In order to
side load in parallel, you must start a task supervisor in your application
and provide the name of that task supervisor to your Api. Other concurrency
options for parallel side loading can happen here.
Link to this section Functions
By default, side loading data happens synchronously. In order to
side load in parallel, you must start a task supervisor in your application
and provide the name of that task supervisor to your Api. Other concurrency
options for parallel side loading can happen here.
You can add a task supervisor to your application, by adding:
{Task.Supervisor, name: MyApp.MyName} to the list of children. Then, you'd configure
supervisor: MyApp.MyName.
Opts
supervisor(atom) Required: The name of the task supervisor that will supervise the parallel side loading tasks.max_concurrency(integer): The total number of side loads (per side load nesting level, per ongoing side load) that can be running. UsesSystem.schedulers_online/0if unset. Constraints: must be greater than zerotimeout(integer): the maximum amount of time to wait (in milliseconds) without receiving a task reply. seetask.supervisor.async_stream/6- Default: 5000 Constraints: must be positiveshutdown(integer): an integer indicating the timeout value. Defaults to 5000 milliseconds - Default: 5000 Constraints: must be positive