kaizensoze / node-github

[DEPRECATED] Node.js wrapper for GitHub API
https://kaizensoze.github.io/node-github/
MIT License
29 stars 5 forks source link

Added getAllPages method #97

Closed martinheidegger closed 8 years ago

martinheidegger commented 8 years ago

Added this useful helper method that allows people to quickly get the content of all pages from a github-client method.

kaizensoze commented 8 years ago

This doesn't seem to be getting all results. For instance, I have 631 starred repos, but getAllPages returns 200:

"use strict";

var Assert = require("assert");
var Client = require("./../lib/index");
var testAuth = require("./../test_auth.json");

var github = new Client({});

github.authenticate({
    type: "oauth",
    token: testAuth["token"]
});

github.getAllPages(github.activity.getStarredRepos, { per_page: 100 }, function(err, res) {
    console.log(res.length);
    Assert.ok(res.length == 621);
});
martinheidegger commented 8 years ago

Thank you for second-check it. I seem to have refactored it a little too much. The new commit i just pushed seems to mitigate former issues.