# `AshPhoenixGenApi.Resource`
[🔗](https://github.com/ohhi-vn/ash_phoenix_gen_api/blob/v1.0.3/lib/ash_phoenix_gen_api/resource.ex#L1)

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
    end

## DSL

See the DSL documentation for the full list of configuration options.

# `gen_api`
*macro* 

---

*Consult [api-reference.md](api-reference.md) for complete listing*
