mirror of
https://github.com/ash-project/ash_json_api_wrapper.git
synced 2024-09-21 13:52:59 +12:00
20 lines
488 B
Elixir
20 lines
488 B
Elixir
|
defmodule AshJsonApiWrapper.Paginator do
|
||
|
@moduledoc """
|
||
|
Behavior for scanning pages of a paginated endpoint.
|
||
|
"""
|
||
|
|
||
|
@type ref :: {module, Keyword.t()}
|
||
|
|
||
|
defmacro __using__(_) do
|
||
|
quote do
|
||
|
@behaviour AshJsonApiWrapper.Paginator
|
||
|
end
|
||
|
end
|
||
|
|
||
|
@callback continue(
|
||
|
response :: term,
|
||
|
entities :: [Ash.Resource.record()],
|
||
|
opts :: Keyword.t()
|
||
|
) :: {:ok, %{optional(:params) => map, optional(:headers) => map}} | :halt
|
||
|
end
|