No Description

Lucas Stadler d767e2d6e8 Add Makefiles for unpaginate and stars 10 years ago
..
.gitignore 640a4f7191 Unpaginate all the (json) resources 10 years ago
Makefile d767e2d6e8 Add Makefiles for unpaginate and stars 10 years ago
README.md bd3c5dc805 Add a README 10 years ago
unpaginate.go 969309f365 Support for basic auth with token or password 10 years ago

README.md

unpaginate

unpaginate unpaginates JSON resources.

The requested resource is assumed to return an array of JSON objects. unpaginate prints a new array containing the JSON objects from all pages on stdout.

Pagination is assumed to be in the format that the GitHub v3 API uses:

HTTP/1.1 200 OK
...
Link: <https://api.github.com/user/527119/repos?per_page=42&page=2>; rel="next", <https://api.github.com/user/527119/repos?per_page=42&page=2>; rel="last"

Usage

$ ./unpaginate https://api.github.com/users/heyLu/repos
...

$ ./unpaginate -user heyLu:$token https://api.github.com/user/repos
...

Note that the resources must return arrays of JSON objects. Any other kind of input will break unpaginate, sometimes in unexpected ways.

unpaginate was written to be used with stars, but is hopefully also useful in other contexts.