AshDyan.Adapters.GenApiBridge (AshDyan v0.1.0)

Copy Markdown View Source

A small MFA-based bridge for exposing AshDyan through ash_phoenix_gen_api.

ash_phoenix_gen_api generates runtime API surfaces from Ash resources. This module provides a stable {module, function, args} entry point so a generated API can route a generic analysis call to AshDyan.run/2 without AshDyan depending on ash_phoenix_gen_api.

Example

In your gen_api configuration, point the analysis action at:

{AshDyan.Adapters.GenApiBridge, :run, [:spec, :opts]}

where :spec and :opts are supplied by the generated call.

Summary

Functions

Bridge entry point: runs an AshDyan request and returns the result.

Like run/2 but returns a JSON-encodable map (the result struct as a map).

Functions

run(spec, opts \\ [])

@spec run(
  map() | AshDyan.Request.t(),
  keyword()
) :: {:ok, AshDyan.Result.t()} | {:error, term()}

Bridge entry point: runs an AshDyan request and returns the result.

spec is a request map or AshDyan.Request. opts is a keyword list of AshDyan.run/2 options (e.g. actor:, tenant:).

run_json(spec, opts \\ [])

Like run/2 but returns a JSON-encodable map (the result struct as a map).