|
1 |
| -// Github.js 0.5.2 |
| 1 | +// Github.js 0.6.0 |
2 | 2 | // (c) 2012 Michael Aufreiter, Development Seed
|
3 | 3 | // Github.js is freely distributable under the MIT license.
|
4 | 4 | // For all details and documentation:
|
|
47 | 47 | });
|
48 | 48 | }
|
49 | 49 |
|
50 |
| - // USER API |
| 50 | + // User API |
51 | 51 | // =======
|
52 | 52 |
|
53 | 53 | Github.User = function() {
|
|
56 | 56 | cb(err, res);
|
57 | 57 | });
|
58 | 58 | };
|
| 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 | + }; |
59 | 95 | };
|
60 | 96 |
|
61 | 97 |
|
| 98 | + |
| 99 | + |
62 | 100 | // Repository API
|
63 | 101 | // =======
|
64 | 102 |
|
|
114 | 152 | };
|
115 | 153 |
|
116 | 154 | // For a given file path, get the corresponding sha (blob for files, tree for dirs)
|
117 |
| - // TODO: So inefficient, it sucks hairy donkey balls. |
118 | 155 | // -------
|
119 | 156 |
|
120 | 157 | this.getSha = function(branch, path, cb) {
|
|
0 commit comments