1 | ;
|
2 |
|
3 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4 |
|
5 | var _Requestable2 = require('./Requestable');
|
6 |
|
7 | var _Requestable3 = _interopRequireDefault(_Requestable2);
|
8 |
|
9 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10 |
|
11 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12 |
|
13 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
14 |
|
15 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
|
16 | * @file
|
17 | * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.
|
18 | * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.
|
19 | * Github.js is freely distributable.
|
20 | */
|
21 |
|
22 | /**
|
23 | * RateLimit allows users to query their rate-limit status
|
24 | */
|
25 | var RateLimit = function (_Requestable) {
|
26 | _inherits(RateLimit, _Requestable);
|
27 |
|
28 | /**
|
29 | * construct a RateLimit
|
30 | * @param {Requestable.auth} auth - the credentials to authenticate to GitHub
|
31 | * @param {string} [apiBase] - the base Github API URL
|
32 | * @return {Promise} - the promise for the http request
|
33 | */
|
34 | function RateLimit(auth, apiBase) {
|
35 | _classCallCheck(this, RateLimit);
|
36 |
|
37 | return _possibleConstructorReturn(this, (RateLimit.__proto__ || Object.getPrototypeOf(RateLimit)).call(this, auth, apiBase));
|
38 | }
|
39 |
|
40 | /**
|
41 | * Query the current rate limit
|
42 | * @see https://developer.github.com/v3/rate_limit/
|
43 | * @param {Requestable.callback} [cb] - will receive the rate-limit data
|
44 | * @return {Promise} - the promise for the http request
|
45 | */
|
46 |
|
47 |
|
48 | _createClass(RateLimit, [{
|
49 | key: 'getRateLimit',
|
50 | value: function getRateLimit(cb) {
|
51 | return this._request('GET', '/rate_limit', null, cb);
|
52 | }
|
53 | }]);
|
54 |
|
55 | return RateLimit;
|
56 | }(_Requestable3.default);
|
57 |
|
58 | module.exports = RateLimit;
|
59 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJhdGVMaW1pdC5qcyJdLCJuYW1lcyI6WyJSYXRlTGltaXQiLCJhdXRoIiwiYXBpQmFzZSIsImNiIiwiX3JlcXVlc3QiLCJSZXF1ZXN0YWJsZSIsIm1vZHVsZSIsImV4cG9ydHMiXSwibWFwcGluZ3MiOiI7Ozs7QUFPQTs7Ozs7Ozs7OzsrZUFQQTs7Ozs7OztBQVNBOzs7SUFHTUEsUzs7O0FBQ0g7Ozs7OztBQU1BLHFCQUFZQyxJQUFaLEVBQWtCQyxPQUFsQixFQUEyQjtBQUFBOztBQUFBLGlIQUNsQkQsSUFEa0IsRUFDWkMsT0FEWTtBQUUxQjs7QUFFRDs7Ozs7Ozs7OztpQ0FNYUMsRSxFQUFJO0FBQ2QsYUFBTyxLQUFLQyxRQUFMLENBQWMsS0FBZCxFQUFxQixhQUFyQixFQUFvQyxJQUFwQyxFQUEwQ0QsRUFBMUMsQ0FBUDtBQUNGOzs7O0VBbkJvQkUscUI7O0FBc0J4QkMsT0FBT0MsT0FBUCx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