REST pagination via the Link header.
GitHub returns pagination as a Link header listing next, prev, first,
and last URLs. This module parses that header into a map. GhEx.REST.stream/3
is the high-level consumer; use links/1 directly when you want to drive
pagination yourself.
GraphQL cursor pagination is handled separately by GhEx.GraphQL.stream/4.
Summary
Functions
Parses the Link header of a response into a %{rel => url} map.
Parses a raw Link header value into a %{rel => url} map.
Functions
@spec links(Req.Response.t()) :: %{optional(String.t()) => String.t()}
Parses the Link header of a response into a %{rel => url} map.
Returns an empty map when the header is absent.
Examples
iex> resp = %Req.Response{
...> headers: %{"link" => [~s(<https://api.github.com/x?page=2>; rel="next", <https://api.github.com/x?page=9>; rel="last")]}
...> }
iex> GhEx.Pagination.links(resp)
%{"next" => "https://api.github.com/x?page=2", "last" => "https://api.github.com/x?page=9"}
Parses a raw Link header value into a %{rel => url} map.