View Source JSONAPIPlug.Pagination behaviour (jsonapi_plug v1.0.5)

JSON:API Pagination strategy

Pagination links can be generated by implementing a module conforming to the JSONAPIPlug.Pagination behavior and configuring the pagination of your API module:

defmodule MyApp.MyController do
  plug JSONAPIPlug.Plug, api: MyApp.MyApi, resource: MyApp.MyResource
config :my_app, MyApp.API, pagination: MyApp.MyPagination

Actual pagination needs to be handled by your application and is outside the scope of this library.

Links can be generated using the information stored in the connection jsonapi_plug private field and by passing additional information to your pagination module by passing options from your controller.

See the tests for an example implementation of page based pagination strategy.



@type link() :: :first | :last | :next | :prev
@type links() :: %{required(link()) => String.t()}
@type options() :: Keyword.t()
@type params() :: %{required(String.t()) => String.t()}
@type t() :: module()


Link to this callback

paginate(t, list, arg3, params, options)

View Source