Skip to content

Commit 72e6295

Browse files
committed
Added support for organizations.
1 parent 9aa1560 commit 72e6295

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

github.js

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Github.js 0.5.2
1+
// Github.js 0.6.0
22
// (c) 2012 Michael Aufreiter, Development Seed
33
// Github.js is freely distributable under the MIT license.
44
// For all details and documentation:
@@ -47,7 +47,7 @@
4747
});
4848
}
4949

50-
// USER API
50+
// User API
5151
// =======
5252

5353
Github.User = function() {
@@ -56,9 +56,47 @@
5656
cb(err, res);
5757
});
5858
};
59+
60+
// List user organizations
61+
// -------
62+
63+
this.orgs = function(cb) {
64+
_request("GET", "/user/orgs", null, function(err, res) {
65+
cb(err, res);
66+
});
67+
};
68+
69+
// Show user information
70+
// -------
71+
72+
this.show = function(username, cb) {
73+
_request("GET", "/users/"+username, null, function(err, res) {
74+
cb(err, res);
75+
});
76+
}
77+
78+
// List user repositories
79+
// -------
80+
81+
this.userRepos = function(username, cb) {
82+
_request("GET", "/users/"+username+"/repos?type=all&per_page=100", null, function(err, res) {
83+
cb(err, res);
84+
});
85+
};
86+
87+
// List organization repositories
88+
// -------
89+
90+
this.orgRepos = function(orgname, cb) {
91+
_request("GET", "/orgs/"+orgname+"/repos?type=all&per_page=100", null, function(err, res) {
92+
cb(err, res);
93+
});
94+
};
5995
};
6096

6197

98+
99+
62100
// Repository API
63101
// =======
64102

@@ -114,7 +152,6 @@
114152
};
115153

116154
// For a given file path, get the corresponding sha (blob for files, tree for dirs)
117-
// TODO: So inefficient, it sucks hairy donkey balls.
118155
// -------
119156

120157
this.getSha = function(branch, path, cb) {

0 commit comments

Comments
 (0)