diff --git a/documentation/dsls/DSL:-Ash.Domain.md b/documentation/dsls/DSL:-Ash.Domain.md index c6e774d1..bfe8eecf 100644 --- a/documentation/dsls/DSL:-Ash.Domain.md +++ b/documentation/dsls/DSL:-Ash.Domain.md @@ -98,7 +98,7 @@ define name ``` -Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more. +Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. @@ -140,7 +140,7 @@ define_calculation name ``` -Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more. +Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. @@ -166,7 +166,7 @@ define_calculation :referral_link, User, args: [{:arg, :id}, {:ref, :id}] | Name | Type | Default | Docs | |------|------|---------|------| | [`calculation`](#resources-resource-define_calculation-calculation){: #resources-resource-define_calculation-calculation } | `atom` | | The name of the calculation that will be evaluated. Defaults to the same name as the function. | -| [`args`](#resources-resource-define_calculation-args){: #resources-resource-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/code-interface.md) for more. | +| [`args`](#resources-resource-define_calculation-args){: #resources-resource-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. | diff --git a/documentation/dsls/DSL:-Ash.Resource.md b/documentation/dsls/DSL:-Ash.Resource.md index 4e59d1e6..15b87f4e 100644 --- a/documentation/dsls/DSL:-Ash.Resource.md +++ b/documentation/dsls/DSL:-Ash.Resource.md @@ -1287,7 +1287,7 @@ end | Name | Type | Default | Docs | |------|------|---------|------| | [`manual`](#actions-read-manual){: #actions-read-manual } | `(any, any, any -> any) \| module` | | Delegates running of the query to the provided module. Accepts a module or module and opts, or a function that takes the ash query, the data layer query, and context. See the [manual actions guide](/documentation/topics/manual-actions.md) for more. | -| [`get?`](#actions-read-get?){: #actions-read-get? } | `boolean` | `false` | Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/code-interface.md) for more. | +| [`get?`](#actions-read-get?){: #actions-read-get? } | `boolean` | `false` | Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. | | [`modify_query`](#actions-read-modify_query){: #actions-read-modify_query } | `mfa \| (any, any -> any)` | | Allows direct manipulation of the data layer query via an MFA. The ash query and the data layer query will be provided as additional arguments. The result must be `{:ok, new_data_layer_query} \| {:error, error}`. | | [`get_by`](#actions-read-get_by){: #actions-read-get_by } | `atom \| list(atom)` | | A helper to automatically generate a "get by X" action. Sets `get?` to true, add args for each of the specified fields, and adds a filter for each of the arguments. | | [`timeout`](#actions-read-timeout){: #actions-read-timeout } | `pos_integer` | | The maximum amount of time, in milliseconds, that the action is allowed to run for. Ignored if the data layer doesn't support transactions *and* async is disabled. | @@ -1973,7 +1973,7 @@ Target: `Ash.Resource.Actions.Destroy` ## code_interface -Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/code-interface.md) for more. +Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. ### Nested DSLs @@ -2008,7 +2008,7 @@ define name ``` -Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more. +Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. @@ -2050,7 +2050,7 @@ define_calculation name ``` -Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more. +Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. @@ -2076,7 +2076,7 @@ define_calculation :referral_link, args: [{:arg, :id}, {:ref, :id}] | Name | Type | Default | Docs | |------|------|---------|------| | [`calculation`](#code_interface-define_calculation-calculation){: #code_interface-define_calculation-calculation } | `atom` | | The name of the calculation that will be evaluated. Defaults to the same name as the function. | -| [`args`](#code_interface-define_calculation-args){: #code_interface-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/code-interface.md) for more. | +| [`args`](#code_interface-define_calculation-args){: #code_interface-define_calculation-args } | `any` | `[]` | Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. | diff --git a/documentation/home.md b/documentation/home.md index 0e43d959..1ad998a2 100644 --- a/documentation/home.md +++ b/documentation/home.md @@ -36,6 +36,7 @@ Welcome to the Ash Framework documentation! Here you will find everything you ne - [Attributes](documentation/topics/resources/attributes.md) - [Calculations](documentation/topics/resources/calculations.md) - [Aggregates](documentation/topics/resources/aggregates.md) +- [Code Interfaces](documentation/topics/resources/code-interfaces.md) ### Actions diff --git a/documentation/topics/actions/create-actions.md b/documentation/topics/actions/create-actions.md index 4c178701..6336d690 100644 --- a/documentation/topics/actions/create-actions.md +++ b/documentation/topics/actions/create-actions.md @@ -18,7 +18,7 @@ Ticket |> Ash.create!() ``` -See the [Code Interface guide](documentation/topics/code-interface.md) for creating an interface to call the action more elegantly, like so: +See the [Code Interface guide](documentation/topics/resources/code-interfaces.md) for creating an interface to call the action more elegantly, like so: ```elixir Support.open_ticket!("Need help!") diff --git a/documentation/topics/actions/update-actions.md b/documentation/topics/actions/update-actions.md index 2e96437f..49204483 100644 --- a/documentation/topics/actions/update-actions.md +++ b/documentation/topics/actions/update-actions.md @@ -18,7 +18,7 @@ ticket # providing an initial ticket to close |> Ash.update!() ``` -See the [Code Interface guide](documentation/topics/code-interface.md) for creating an interface to call the action more elegantly, like so: +See the [Code Interface guide](documentation/topics/resources/code-interfaces.md) for creating an interface to call the action more elegantly, like so: ```elixir Support.close_ticket!(ticket, "I figured it out.") diff --git a/documentation/topics/code-interface.md b/documentation/topics/resources/code-interfaces.md similarity index 100% rename from documentation/topics/code-interface.md rename to documentation/topics/resources/code-interfaces.md diff --git a/documentation/tutorials/get-started.md b/documentation/tutorials/get-started.md index a5f7989c..3b9b9bcb 100644 --- a/documentation/tutorials/get-started.md +++ b/documentation/tutorials/get-started.md @@ -609,4 +609,4 @@ See the [Policies guide](/documentation/topics/security/policies.md) for informa Creating and using changesets manually can be verbose, and they all look very similar. Luckily, Ash has your back and can help you build high quality interfaces for you! -Check out the [Code Interface Guide](/documentation/topics/code-interface.md) to derive things like `Helpdesk.Support.Ticket.assign!(representative.id)` +Check out the [Code Interface Guide](/documentation/topics/topics/code-interfaces.md) to derive things like `Helpdesk.Support.Ticket.assign!(representative.id)` diff --git a/lib/ash/domain/dsl.ex b/lib/ash/domain/dsl.ex index d36b9537..add94425 100644 --- a/lib/ash/domain/dsl.ex +++ b/lib/ash/domain/dsl.ex @@ -89,7 +89,7 @@ defmodule Ash.Domain.Dsl do @define %Spark.Dsl.Entity{ name: :define, describe: """ - Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """, examples: [ "define :get_user_by_id, User, action: :get_by_id, args: [:id], get?: true" @@ -103,7 +103,7 @@ defmodule Ash.Domain.Dsl do @define_calculation %Spark.Dsl.Entity{ name: :define_calculation, describe: """ - Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """, examples: [ "define_calculation :referral_link, User, args: [:id]", diff --git a/lib/ash/resource/actions/read.ex b/lib/ash/resource/actions/read.ex index 79e0f60c..41de2c7f 100644 --- a/lib/ash/resource/actions/read.ex +++ b/lib/ash/resource/actions/read.ex @@ -56,7 +56,7 @@ defmodule Ash.Resource.Actions.Read do type: :boolean, default: false, doc: """ - Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Expresses that this action innately only returns a single result. Used by extensions to validate and/or modify behavior. Causes code interfaces to return a single value instead of a list. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """ ], modify_query: [ diff --git a/lib/ash/resource/calculation_interface.ex b/lib/ash/resource/calculation_interface.ex index 827b8656..9e870df9 100644 --- a/lib/ash/resource/calculation_interface.ex +++ b/lib/ash/resource/calculation_interface.ex @@ -21,7 +21,7 @@ defmodule Ash.Resource.CalculationInterface do type: :any, default: [], doc: """ - Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Supply field or argument values referenced by the calculation, in the form of :name, `{:arg, :name}` and/or `{:ref, :name}`. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """ ] ] diff --git a/lib/ash/resource/dsl.ex b/lib/ash/resource/dsl.ex index aa8eb940..30ae9948 100644 --- a/lib/ash/resource/dsl.ex +++ b/lib/ash/resource/dsl.ex @@ -839,7 +839,7 @@ defmodule Ash.Resource.Dsl do @define_calculation %Spark.Dsl.Entity{ name: :define_calculation, describe: """ - Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Defines a function with the corresponding name and arguments, that evaluates a calculation. Use `:_record` to take an instance of a record. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """, examples: [ "define_calculation :referral_link, args: [:id]", @@ -854,7 +854,7 @@ defmodule Ash.Resource.Dsl do @define %Spark.Dsl.Entity{ name: :define, describe: """ - Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Defines a function with the corresponding name and arguments. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """, examples: [ "define :get_user_by_id, action: :get_by_id, args: [:id], get?: true" @@ -868,7 +868,7 @@ defmodule Ash.Resource.Dsl do @code_interface %Spark.Dsl.Section{ name: :code_interface, describe: """ - Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/code-interface.md) for more. + Functions that will be defined on the resource. See the [code interface guide](/documentation/topics/topics/code-interfaces.md) for more. """, examples: [ """ diff --git a/mix.exs b/mix.exs index 0f4ad8f2..eece944d 100644 --- a/mix.exs +++ b/mix.exs @@ -48,6 +48,7 @@ defmodule Ash.MixProject do "documentation/topics/about_ash/contributing-to-ash.md", "documentation/topics/resources/attributes.md", "documentation/topics/resources/embedded-resources.md", + "documentation/topics/resources/code-interfaces.md", "documentation/topics/actions/actions.md", "documentation/topics/actions/read-actions.md", "documentation/topics/actions/create-actions.md", @@ -68,7 +69,6 @@ defmodule Ash.MixProject do "documentation/how_to/validate-changes.md", "documentation/topics/resources/aggregates.md", "documentation/topics/resources/calculations.md", - "documentation/topics/code-interface.md", "documentation/topics/extending-resources.md", "documentation/topics/expressions.md", "documentation/topics/reference/glossary.md", @@ -102,8 +102,9 @@ defmodule Ash.MixProject do Resources: [ "documentation/topics/resources/attributes.md", "documentation/topics/resources/calculations.md", - "documentation/topics/resources/aggregates.md" + "documentation/topics/resources/aggregates.md", "documentation/topics/resources/embedded-resources.md", + "documentation/topics/resources/code-interfaces.md" ], Actions: [ "documentation/topics/actions/actions.md",