{"action":"opened","issue":{"url":"https://api.github.com/repos/philschatz/octokat.js/issues/31","labels_url":"https://api.github.com/repos/philschatz/octokat.js/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/philschatz/octokat.js/issues/31/comments","events_url":"https://api.github.com/repos/philschatz/octokat.js/issues/31/events","html_url":"https://github.com/philschatz/octokat.js/issues/31","id":66076455,"number":31,"title":"Count number of issues/PRs?","user":{"login":"zeke","id":2289,"avatar_url":"https://avatars.githubusercontent.com/u/2289?v=3","gravatar_id":"","url":"https://api.github.com/users/zeke","html_url":"https://github.com/zeke","followers_url":"https://api.github.com/users/zeke/followers","following_url":"https://api.github.com/users/zeke/following{/other_user}","gists_url":"https://api.github.com/users/zeke/gists{/gist_id}","starred_url":"https://api.github.com/users/zeke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeke/subscriptions","organizations_url":"https://api.github.com/users/zeke/orgs","repos_url":"https://api.github.com/users/zeke/repos","events_url":"https://api.github.com/users/zeke/events{/privacy}","received_events_url":"https://api.github.com/users/zeke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-03T05:02:16Z","updated_at":"2015-04-03T05:02:16Z","closed_at":null,"body":"I'm considering using octokat on the npmjs.com website. We currently have some spaghetti-ish browserify code that hits the github API to display issue and pull request counts for npm packages:\r\n\r\n![screen shot 2015-04-02 at 9 53 33 pm](https://cloud.githubusercontent.com/assets/2289/6978239/ff4cad00-d982-11e4-9670-4c4c407159bf.png)\r\n\r\nWe're using this One Weird Trick™ that @pengwynn taught us to fetch the counts: We set `per_page` to `1`, then use @thlorenz's [parse-link-header](https://github.com/thlorenz/parse-link-header) to pull the last page out of the response header. Because we only asked for one result, the last page is also the number of issues. This is a nice trick because it only requires a single request, even if there are hundreds of issues on the repo.\r\n\r\nFrom the octokat README, I can see that the `per_page` option is supported, and attaches a `lastPage()` function to the response object, but that doesn't solve the problem of fetching the count. Is there a way to do this with octokat?\r\n\r\n```js\r\nnew (require(\"octokat\"))().repos(\"npm\", \"newww\").issues.fetch({per_page: 1})\r\n  .then(function() { console.log(arguments) })\r\n```\r\n\r\ncc @yashprit and @coleGillespie, who both have an interest in making this work on the npm website. :)"}}