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
JSONAPIPlug.page 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.