-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Currently this library supports a paging pattern where the user provides page/per_page params which is interpolated into a limit and offset.
Another paging strategy used by APIs (see instagram/twitter) allows the user to specify an ID and an amount.
Example:
Providing since_id = 10 and amount = 5 would return 5 rows in descending order as follows:
id: 15
id: 14
id: 13
id: 12
id: 11
Providing max_id = 10 and amount = 5 would return 5 rows in descending order as follows:
id: 10
id: 9
id: 8
id: 7
id: 6
Note that since_id is exclusive and max_id is inclusive.
Pagination attribute:
The pagination attribute in the response is also handled a little different. Below is an example of Instagram's implementation:
"pagination": {
"next_url": "https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296",
"next_max_id": "13872296"
}Incompatibility
The page/per_page and since_id/max_id/amount paging strategies are mutually exclusive and incompatible with each other. For this reason, if params from both strategies are found in the same requests, an exception should be throws.