PhoenixKit.API.CoreTools (phoenix_kit v2.63.0)

Copy Markdown View Source

The tools core itself provides, in the system namespace.

They need no module and no scope: every valid key may call them. system.get_identity answers "who am I and what may I do" and is the first thing to call when setting a key up; system.get_approval follows an operation that waits for a person's approval.

Summary

Functions

Handler of system.get_approval: the state of one of the calling key's approvals (PhoenixKit.API.Approvals.status_view/1), or not_found for an id that does not exist, is malformed, belongs to another key, or is not an approval.

Handler of system.get_identity.

The tools core declares; PhoenixKit.API.Registry adds them to every module's.

Functions

get_approval(map1, map2)

@spec get_approval(map(), map()) :: {:ok, map()} | {:error, atom(), String.t(), map()}

Handler of system.get_approval: the state of one of the calling key's approvals (PhoenixKit.API.Approvals.status_view/1), or not_found for an id that does not exist, is malformed, belongs to another key, or is not an approval.

get_identity(input, map)

@spec get_identity(map(), map()) :: {:ok, map()} | {:error, atom(), String.t(), map()}

Handler of system.get_identity.

Returns {:ok, map} with key (prefix, name, expires_at, requires_approval), owner (id, email, service_user), scopes (the effective scopes) and tools (name, scope, read_only of every tool they unlock).

tools()

@spec tools() :: [PhoenixKit.API.Tool.t()]

The tools core declares; PhoenixKit.API.Registry adds them to every module's.