ash v1.36.3 Ash.Api.Dsl View Source

A small DSL for declaring APIs

Apis are the entrypoints for working with your resources.

Table of Contents

resources

List the resources present in this API

Examples:

resources do
  resource MyApp.User
  resource MyApp.Post
  resource MyApp.Comment
end

resource

A reference to a resource

Introspection Target:

Ash.Api.ResourceReference

Examples:

resource MyApp.User
  • :as - false A short name for the resource. Defaults to the last part of the module underscored, e.g SpecialThing -> :special_thing.

    Can be used in calls to Api modules, e.g Api.read(:special_thing) and also customizes action helpers defined on the Api, e.g Api.special_thing_create(...)

  • :resource - Required. The module of the resource