EndPointBlank.Phoenix.Versioned (end_point_blank_elixir v0.6.0)

Copy Markdown

Macro that adds per-action version metadata to a Phoenix controller.

Usage

defmodule MyAppWeb.BooksController do
  use Phoenix.Controller
  use EndPointBlank.Phoenix.Versioned

  version_of :index, ["v1", "v2"]
  version_of :index, ["v0"]

  def index(conn, _params), do: ...
end

Lifecycle state (Current, Deprecated, ...) is not declared here. It is managed in the EndPointBlank portal, where changing it does not require shipping code. This reports which versions an action serves, and nothing about what they mean.

Multiple calls for the same action merge, deduplicated, in declaration order.

The registered metadata is read by EndPointBlank.Phoenix.EndpointRegistrar when it builds the endpoint list sent to the EndPointBlank API at startup.

Summary

Functions

Declares which versions action serves. Stores an %{action => [versions]} map, merging with any prior declaration for the same action.

Functions

version_of(action, versions)

(macro)

Declares which versions action serves. Stores an %{action => [versions]} map, merging with any prior declaration for the same action.