Works out how a list operation pages, from its parameters and response.
Specs don't say how an API paginates, but the shapes are recognisable:
| style | seen in | recognised by |
|---|---|---|
:cursor_after | OpenAI, Stripe | an after / starting_after parameter and a has_more field |
:cursor | Cloudflare, Slack | a cursor parameter and a cursor / next_cursor field in the response |
:next_url | Twilio | a next_page_uri / next_page_url field |
:page | GitHub, Cloudflare | a page parameter; GitHub's Link header is followed when sent |
:offset | Cloudflare | offset and limit parameters |
:link_header | GitHub | any other paging parameter (per_page, after): follows rel="next" in the Link header, if the API sends one |
The result is data for the runtime: where the items are (items, a path
into the response), how each item decodes (item, a schema), and what the
style needs (parameter names, paths to fields).
Summary
Functions
The pagination of op, or nil if it doesn't page.
Functions
@spec detect( %Infusion.IR.Operation{ body: term(), cookie_params: term(), deprecated?: term(), description: term(), function: term(), header_params: term(), id: term(), method: term(), module: term(), naming: term(), path: term(), path_params: term(), query_params: term(), responses: term(), servers: term(), streaming?: term(), summary: term() }, %Infusion.IR{ auth: term(), operations: term(), schemas: term(), servers: term(), warnings: term() } ) :: map() | nil
The pagination of op, or nil if it doesn't page.