Ash extension for generating PhoenixGenApi function configurations from Ash resources.
This extension allows you to define PhoenixGenApi endpoints directly in your
Ash resource DSL, automatically generating FunConfig structs that can be
pulled by gateway nodes.
Usage
Add the extension to your resource:
defmodule MyApp.Chat.DirectMessage do
use Ash.Resource,
extensions: [AshPhoenixGenApi.Resource]
gen_api do
service "chat"
nodes {ClusterHelper, :get_nodes, [:chat]}
choose_node_mode :random
action :send_direct_message do
request_type "send_direct_message"
timeout 10_000
response_type :async
request_info true
end
action :get_conversation do
timeout 5_000
end
mfa :ping do
request_type "ping"
mfa {MyApp.Chat.Api, :ping, []}
arg_types %{}
end
end
endDSL
See the DSL documentation for the full list of configuration options.