The one table of API paths. The router macro (PhoenixKitWeb.Integration)
forwards every entry to its plug, and PhoenixKit.API.BodyGuard guards every
entry, so the two cannot disagree about where the API lives.
The axis of the API is the audience, not a module: modules own the names of
their tools (catalogue.set_prices), the paths are
/api/admin/v1 /mcp/admin the admin audience, with a key
/api/public/v1 /mcp/public the public audience, without oneunder the kit's URL prefix. The segment that names the public audience is
public_segment/0, the only place it is spelled: renaming the public
prefix is a change of that one line.
Entries
entries/0 lists {segments, audience, cors?}:
segments, the path under the URL prefix, split by/;audience,:adminor:public, which decides the plug's options and the switchPhoenixKit.API.BodyGuardlooks at;cors?, whether the answers carry the CORS headers of the public REST audience (PhoenixKit.API.REST), the guard's included;
Anything that builds a URL for a client (PhoenixKit.API.OpenAPI,
PhoenixKit.API.PublicDiscovery) takes rest_path/1 and mcp_path/1,
which are the only paths the API answers on.
Summary
Functions
Every path the API answers on. See the moduledoc for the shape.
The canonical path of the MCP endpoint of audience, without the URL prefix.
The path of segments as forward takes it: "/api/admin/v1".
The plug that serves the path made of segments: REST under api, MCP under mcp.
The options of the forward of entry: the audience.
The path segment that names the public audience in /api/<segment>/v1 and
/mcp/<segment>: the one place it is spelled.
The canonical path of the REST API of audience, without the URL prefix.
Types
Functions
@spec entries() :: [entry()]
Every path the API answers on. See the moduledoc for the shape.
@spec mcp_path(:admin | :public) :: String.t()
The canonical path of the MCP endpoint of audience, without the URL prefix.
The path of segments as forward takes it: "/api/admin/v1".
The plug that serves the path made of segments: REST under api, MCP under mcp.
The options of the forward of entry: the audience.
@spec public_segment() :: String.t()
The path segment that names the public audience in /api/<segment>/v1 and
/mcp/<segment>: the one place it is spelled.
@spec rest_path(:admin | :public) :: String.t()
The canonical path of the REST API of audience, without the URL prefix.