Skip to content

Commit 41548e3

Browse files
committed
Merge pull request octokit#164 from strongloop/rate-limit
Rate limit API and enhancements
2 parents 5d6d0a8 + 7f5b6dc commit 41548e3

17 files changed

+312
-198
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ github.authorization.create({
143143
* Events: 100%
144144
* Search: 100%
145145
* Markdown: 100%
146+
* Rate Limit: 100%
146147

147148
## Running the Tests
148149

api/v3.0.0/authorization.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var authorization = module.exports = {
5050
ret = {};
5151
if (!ret.meta)
5252
ret.meta = {};
53-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
53+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
5454
if (res.headers[header])
5555
ret.meta[header] = res.headers[header];
5656
});
@@ -90,7 +90,7 @@ var authorization = module.exports = {
9090
ret = {};
9191
if (!ret.meta)
9292
ret.meta = {};
93-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
93+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
9494
if (res.headers[header])
9595
ret.meta[header] = res.headers[header];
9696
});
@@ -132,7 +132,7 @@ var authorization = module.exports = {
132132
ret = {};
133133
if (!ret.meta)
134134
ret.meta = {};
135-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
135+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
136136
if (res.headers[header])
137137
ret.meta[header] = res.headers[header];
138138
});
@@ -177,7 +177,7 @@ var authorization = module.exports = {
177177
ret = {};
178178
if (!ret.meta)
179179
ret.meta = {};
180-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
180+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
181181
if (res.headers[header])
182182
ret.meta[header] = res.headers[header];
183183
});
@@ -217,7 +217,7 @@ var authorization = module.exports = {
217217
ret = {};
218218
if (!ret.meta)
219219
ret.meta = {};
220-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
220+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
221221
if (res.headers[header])
222222
ret.meta[header] = res.headers[header];
223223
});

api/v3.0.0/events.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var events = module.exports = {
5050
ret = {};
5151
if (!ret.meta)
5252
ret.meta = {};
53-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
53+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
5454
if (res.headers[header])
5555
ret.meta[header] = res.headers[header];
5656
});
@@ -93,7 +93,7 @@ var events = module.exports = {
9393
ret = {};
9494
if (!ret.meta)
9595
ret.meta = {};
96-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
96+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
9797
if (res.headers[header])
9898
ret.meta[header] = res.headers[header];
9999
});
@@ -136,7 +136,7 @@ var events = module.exports = {
136136
ret = {};
137137
if (!ret.meta)
138138
ret.meta = {};
139-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
139+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
140140
if (res.headers[header])
141141
ret.meta[header] = res.headers[header];
142142
});
@@ -179,7 +179,7 @@ var events = module.exports = {
179179
ret = {};
180180
if (!ret.meta)
181181
ret.meta = {};
182-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
182+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
183183
if (res.headers[header])
184184
ret.meta[header] = res.headers[header];
185185
});
@@ -221,7 +221,7 @@ var events = module.exports = {
221221
ret = {};
222222
if (!ret.meta)
223223
ret.meta = {};
224-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
224+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
225225
if (res.headers[header])
226226
ret.meta[header] = res.headers[header];
227227
});
@@ -263,7 +263,7 @@ var events = module.exports = {
263263
ret = {};
264264
if (!ret.meta)
265265
ret.meta = {};
266-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
266+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
267267
if (res.headers[header])
268268
ret.meta[header] = res.headers[header];
269269
});
@@ -305,7 +305,7 @@ var events = module.exports = {
305305
ret = {};
306306
if (!ret.meta)
307307
ret.meta = {};
308-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
308+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
309309
if (res.headers[header])
310310
ret.meta[header] = res.headers[header];
311311
});
@@ -347,7 +347,7 @@ var events = module.exports = {
347347
ret = {};
348348
if (!ret.meta)
349349
ret.meta = {};
350-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
350+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
351351
if (res.headers[header])
352352
ret.meta[header] = res.headers[header];
353353
});
@@ -389,7 +389,7 @@ var events = module.exports = {
389389
ret = {};
390390
if (!ret.meta)
391391
ret.meta = {};
392-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
392+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
393393
if (res.headers[header])
394394
ret.meta[header] = res.headers[header];
395395
});
@@ -432,7 +432,7 @@ var events = module.exports = {
432432
ret = {};
433433
if (!ret.meta)
434434
ret.meta = {};
435-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
435+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
436436
if (res.headers[header])
437437
ret.meta[header] = res.headers[header];
438438
});

api/v3.0.0/gists.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var gists = module.exports = {
5151
ret = {};
5252
if (!ret.meta)
5353
ret.meta = {};
54-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
54+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
5555
if (res.headers[header])
5656
ret.meta[header] = res.headers[header];
5757
});
@@ -94,7 +94,7 @@ var gists = module.exports = {
9494
ret = {};
9595
if (!ret.meta)
9696
ret.meta = {};
97-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
97+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
9898
if (res.headers[header])
9999
ret.meta[header] = res.headers[header];
100100
});
@@ -136,7 +136,7 @@ var gists = module.exports = {
136136
ret = {};
137137
if (!ret.meta)
138138
ret.meta = {};
139-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
139+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
140140
if (res.headers[header])
141141
ret.meta[header] = res.headers[header];
142142
});
@@ -178,7 +178,7 @@ var gists = module.exports = {
178178
ret = {};
179179
if (!ret.meta)
180180
ret.meta = {};
181-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
181+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
182182
if (res.headers[header])
183183
ret.meta[header] = res.headers[header];
184184
});
@@ -218,7 +218,7 @@ var gists = module.exports = {
218218
ret = {};
219219
if (!ret.meta)
220220
ret.meta = {};
221-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
221+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
222222
if (res.headers[header])
223223
ret.meta[header] = res.headers[header];
224224
});
@@ -258,7 +258,7 @@ var gists = module.exports = {
258258
ret = {};
259259
if (!ret.meta)
260260
ret.meta = {};
261-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
261+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
262262
if (res.headers[header])
263263
ret.meta[header] = res.headers[header];
264264
});
@@ -298,7 +298,7 @@ var gists = module.exports = {
298298
ret = {};
299299
if (!ret.meta)
300300
ret.meta = {};
301-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
301+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
302302
if (res.headers[header])
303303
ret.meta[header] = res.headers[header];
304304
});
@@ -338,7 +338,7 @@ var gists = module.exports = {
338338
ret = {};
339339
if (!ret.meta)
340340
ret.meta = {};
341-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
341+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
342342
if (res.headers[header])
343343
ret.meta[header] = res.headers[header];
344344
});
@@ -378,7 +378,7 @@ var gists = module.exports = {
378378
ret = {};
379379
if (!ret.meta)
380380
ret.meta = {};
381-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
381+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
382382
if (res.headers[header])
383383
ret.meta[header] = res.headers[header];
384384
});
@@ -418,7 +418,7 @@ var gists = module.exports = {
418418
ret = {};
419419
if (!ret.meta)
420420
ret.meta = {};
421-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
421+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
422422
if (res.headers[header])
423423
ret.meta[header] = res.headers[header];
424424
});
@@ -458,7 +458,7 @@ var gists = module.exports = {
458458
ret = {};
459459
if (!ret.meta)
460460
ret.meta = {};
461-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
461+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
462462
if (res.headers[header])
463463
ret.meta[header] = res.headers[header];
464464
});
@@ -498,7 +498,7 @@ var gists = module.exports = {
498498
ret = {};
499499
if (!ret.meta)
500500
ret.meta = {};
501-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
501+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
502502
if (res.headers[header])
503503
ret.meta[header] = res.headers[header];
504504
});
@@ -538,7 +538,7 @@ var gists = module.exports = {
538538
ret = {};
539539
if (!ret.meta)
540540
ret.meta = {};
541-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
541+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
542542
if (res.headers[header])
543543
ret.meta[header] = res.headers[header];
544544
});
@@ -579,7 +579,7 @@ var gists = module.exports = {
579579
ret = {};
580580
if (!ret.meta)
581581
ret.meta = {};
582-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
582+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
583583
if (res.headers[header])
584584
ret.meta[header] = res.headers[header];
585585
});
@@ -620,7 +620,7 @@ var gists = module.exports = {
620620
ret = {};
621621
if (!ret.meta)
622622
ret.meta = {};
623-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
623+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
624624
if (res.headers[header])
625625
ret.meta[header] = res.headers[header];
626626
});
@@ -662,7 +662,7 @@ var gists = module.exports = {
662662
ret = {};
663663
if (!ret.meta)
664664
ret.meta = {};
665-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
665+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
666666
if (res.headers[header])
667667
ret.meta[header] = res.headers[header];
668668
});
@@ -703,7 +703,7 @@ var gists = module.exports = {
703703
ret = {};
704704
if (!ret.meta)
705705
ret.meta = {};
706-
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
706+
["x-ratelimit-limit", "x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes", "link", "location", "last-modified", "etag", "status"].forEach(function(header) {
707707
if (res.headers[header])
708708
ret.meta[header] = res.headers[header];
709709
});

0 commit comments

Comments
 (0)