ash_json_api_wrapper/lib/paginator/paginator.ex
Zach Daniel a9d94bdd9b improvement: paginators & better filter support
improvement: new spark_function_behaviour for `before_request`
2023-01-15 01:07:41 -05:00

20 lines
532 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()],
request :: Finch.Request.t(),
opts :: Keyword.t()
) :: {:ok, %{optional(:params) => map, optional(:headers) => map}} | :halt
end