multiverse v1.1.0 Multiverse.Adapters.ISODate
Adapter that fetches ISO-8601 date from request header and Elixir.Date
to resolve changes that must be applied to the connection.
Current date is used as fallback when:
- version header is not present in request;
- value of a version header is malformed (and warning is logged);
latestchannel is used instead of date.
When edge channel is used instead of date, no changes are applied to the connection.
Link to this section Summary
Functions
Fetch default client version
Initialize adapter configuration at compile time
Resolve version by string value from request header
Comparator that is used to order and filter versions that should be applied to a connection
Link to this section Types
Link to this section Functions
fetch_default_version(conn :: Plug.Conn.t()) :: {:ok, version(), Plug.Conn.t()}
Fetch default client version.
This callback is used when version header is not set or empty. Additionally adapters may use it to fallback to default version in case of errors or when version header value is malformed.
Callback implementation for Multiverse.Adapter.fetch_default_version/1.
Initialize adapter configuration at compile time.
This callback can be used to fetch Multiverse configuration from application environment, file or other places.
Callback implementation for Multiverse.Adapter.init/2.
resolve_version_or_channel( conn :: Plug.Conn.t(), channel_name_or_version :: String.t() ) :: {:ok, version(), Plug.Conn.t()}
Resolve version by string value from request header.
This callback can be used to set named channels for API versions,
for eg. latest header value could be resolved to current date and
edge to the most recent defined version.
Also, it is responsible for casting string value to adapter-specific version type and handling possible errors.
You can terminate connection if you want to return error without further processing of the request.
Callback implementation for Multiverse.Adapter.resolve_version_or_channel/2.
Comparator that is used to order and filter versions that should be applied to a connection.
It should compare two arguments, and return true if the first argument precedes the second one or they are equal.
Callback implementation for Multiverse.Adapter.version_comparator/2.