octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
7.02k stars 1.03k forks source link

Authenticated user getOrgs #37

Closed mc0 closed 12 years ago

mc0 commented 12 years ago

This doesn't appear to be implemented anywhere GET /user/orgs: http://developer.github.com/v3/orgs/

If I can help contribute this let me know.

mikedeboer commented 12 years ago

Yes it is, try github.orgs.getFromUser({ "user": "mc0" }, function(err, res) { ... })

mikedeboer commented 12 years ago

whoops didn't see the Authenticated part.. :S

katowulf commented 12 years ago

The documentation lists github.user.getOrgs as a valid call, but it produces this error:

github.user.getOrgs({per_page: 100}, function(err, data) {
            ^
TypeError: Object #<Object> has no method 'getOrgs'
    at Object.<anonymous> (C:\Users\a93453\Documents\GitHub\git-stats\muck.js:11:13)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Array.0 (module.js:484:10)
    at EventEmitter._tickCallback (node.js:190:38)
mikedeboertest commented 12 years ago

@katowulf what do you mean? the stack-trace that you provide here makes no sense to me at all; there is no file called muck.js in this project and I don't know what git-stats is. Please review carefully if you are calling this function on the right object!

katowulf commented 12 years ago

git-stats is a directory on my hard drive, and muck.js is, naturally, the app I ran to produce the error. The stack trace isn't important, other than noting that there is no "getOrgs" method on GitHubApi::users.

Of course, this is probably also related to being on such an old version. I was able to fix the problem by not re-using the GitHubApi instance (i.e. calling new GitHubApi({...})). I'll upgrade and you can disregard these comments.