Behaviour and helpers for Unit JSON:API resource structs.
Every resource module implements cast/1 to convert raw JSON:API data
maps into typed structs, and uses from_response/2 / from_response_list/2
to wrap API results.
Summary
Functions
Parse an ISO 8601 date string into a Date.
Parse an ISO 8601 datetime string into a DateTime.
Wrap an API response containing a single data object.
Wrap an API response containing a list of data objects.
Extract a relationship ID from a JSON:API relationships map.
Extract a relationship type from a JSON:API relationships map.
Callbacks
Functions
Parse an ISO 8601 date string into a Date.
@spec cast_datetime(String.t() | nil) :: DateTime.t() | nil
Parse an ISO 8601 datetime string into a DateTime.
Wrap an API response containing a single data object.
Wrap an API response containing a list of data objects.
Extract a relationship ID from a JSON:API relationships map.
Extract a relationship type from a JSON:API relationships map.