PhoenixGenApi.Structs.FunConfig (PhoenixGenApi v1.1.2)

View Source

Defines the configuration for a function that can be called through the API.

This struct holds all the necessary information to route, validate, and execute a function call based on an incoming request.

Summary

Functions

Checks if the request has the necessary permissions to be executed.

Validates and converts the request arguments based on the arg_types and arg_orders configuration.

Selects a target node for the request based on the choose_node_mode strategy.

Checks if the service is configured to run locally.

Validates the function configuration.

Types

t()

@type t() :: %PhoenixGenApi.Structs.FunConfig{
  arg_orders: [String.t()],
  arg_types: map() | nil,
  check_permission: false | {:arg, String.t()},
  choose_node_mode: atom() | {atom(), atom()},
  mfa: {module(), function(), args :: list()},
  nodes: [atom()] | {module(), function(), args :: list()},
  request_info: boolean(),
  request_type: String.t(),
  response_type: :sync | :async | :stream | :none,
  service: atom() | String.t(),
  timeout: integer() | :infinity
}

Functions

check_permission!(request, config)

Checks if the request has the necessary permissions to be executed.

convert_args!(config, request)

Validates and converts the request arguments based on the arg_types and arg_orders configuration.

get_node(config, request)

Selects a target node for the request based on the choose_node_mode strategy.

is_local_service?(config)

Checks if the service is configured to run locally.

valid?(config)

Validates the function configuration.