Skip to content

Commit 0e467b1

Browse files
committed
Sort repositories by updated date.
1 parent a075e78 commit 0e467b1

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

github.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Github.js 0.6.0
1+
// Github.js 0.6.1
22
// (c) 2012 Michael Aufreiter, Development Seed
33
// Github.js is freely distributable under the MIT license.
44
// For all details and documentation:
5-
// http://github.com/michael/github
5+
// http://substance.io/michael/github
66

77
(function() {
88
var Github;
@@ -16,9 +16,9 @@
1616
function headers() {
1717
var headers = {}
1818
if (options.auth === 'oauth' && !options.token) return { Accept: 'application/vnd.github.raw' };
19-
if (options.auth === 'basic' && (!options.username || !options.password)) return { Accept: 'application/vnd.github.raw' };
19+
if (options.auth === 'basic' && (!options.username || !options.password)) return { Accept: 'application/vnd.github.raw' };
2020
return options.auth == 'oauth'
21-
? { Authorization: 'token '+ options.token, Accept: 'application/vnd.github.raw' }
21+
? { Authorization: 'token '+ options.token, Accept: 'application/vnd.github.raw' }
2222
: { Authorization : 'Basic ' + Base64.encode(options.username + ':' + options.password), Accept: 'application/vnd.github.raw' }
2323
}
2424

@@ -28,7 +28,7 @@
2828
url: API_URL + path,
2929
data: JSON.stringify(data),
3030
dataType: 'json',
31-
contentType: 'application/json',
31+
contentType: 'application/x-www-form-urlencoded',
3232
success: function(res) { cb(null, res); },
3333
error: function(err) { cb(err); },
3434
headers : headers()
@@ -40,7 +40,7 @@
4040
type: method,
4141
url: API_URL + path,
4242
data: JSON.stringify(data),
43-
contentType: 'application/json',
43+
contentType: 'application/x-www-form-urlencoded',
4444
success: function(res) { cb(null, res); },
4545
error: function(err) { cb(err); },
4646
headers : headers()
@@ -52,7 +52,7 @@
5252

5353
Github.User = function() {
5454
this.repos = function(cb) {
55-
_request("GET", "/user/repos?type=all&per_page=100", null, function(err, res) {
55+
_request("GET", "/user/repos?type=all&per_page=1000&sort=updated", null, function(err, res) {
5656
cb(err, res);
5757
});
5858
};
@@ -79,7 +79,7 @@
7979
// -------
8080

8181
this.userRepos = function(username, cb) {
82-
_request("GET", "/users/"+username+"/repos?type=all&per_page=100", null, function(err, res) {
82+
_request("GET", "/users/"+username+"/repos?type=all&per_page=1000&sort=updated", null, function(err, res) {
8383
cb(err, res);
8484
});
8585
};
@@ -88,15 +88,14 @@
8888
// -------
8989

9090
this.orgRepos = function(orgname, cb) {
91-
_request("GET", "/orgs/"+orgname+"/repos?type=all&per_page=100", null, function(err, res) {
91+
_request("GET", "/orgs/"+orgname+"/repos?type=all&per_page=1000&sort=updated&direction=desc", null, function(err, res) {
9292
cb(err, res);
9393
});
9494
};
9595
};
9696

9797

9898

99-
10099
// Repository API
101100
// =======
102101

@@ -345,4 +344,4 @@
345344
return new Github.User();
346345
};
347346
};
348-
}).call(this);
347+
}).call(this);

0 commit comments

Comments
 (0)