|
250 | 250 |
|
251 | 251 | this.userStarred = function (username, cb) { |
252 | 252 | // Github does not always honor the 1000 limit so we want to iterate over the data set. |
253 | | - _requestAllPages('/users/' + username + '/starred?type=all&per_page=100', function (err, res) { |
254 | | - cb(err, res); |
255 | | - }); |
| 253 | + _requestAllPages('/users/' + username + '/starred?type=all&per_page=100', cb); |
256 | 254 | }; |
257 | 255 |
|
258 | 256 | // List a user's gists |
|
360 | 358 | // repo.deleteRef('tags/v1.0') |
361 | 359 |
|
362 | 360 | this.deleteRef = function (ref, cb) { |
363 | | - _request('DELETE', repoPath + '/git/refs/' + ref, options, function (err, res, xhr) { |
364 | | - cb(err, res, xhr); |
365 | | - }); |
| 361 | + _request('DELETE', repoPath + '/git/refs/' + ref, options, cb); |
366 | 362 | }; |
367 | 363 |
|
368 | 364 | // Create a repo |
|
383 | 379 | // ------- |
384 | 380 |
|
385 | 381 | this.listTags = function (cb) { |
386 | | - _request('GET', repoPath + '/tags', null, function (err, tags, xhr) { |
387 | | - if (err) { |
388 | | - return cb(err); |
389 | | - } |
390 | | - |
391 | | - cb(null, tags, xhr); |
392 | | - }); |
| 382 | + _request('GET', repoPath + '/tags', null, cb); |
393 | 383 | }; |
394 | 384 |
|
395 | 385 | // List all pull requests of a respository |
|
437 | 427 | url += '?' + params.join('&'); |
438 | 428 | } |
439 | 429 |
|
440 | | - _request('GET', url, null, function (err, pulls, xhr) { |
441 | | - if (err) return cb(err); |
442 | | - cb(null, pulls, xhr); |
443 | | - }); |
| 430 | + _request('GET', url, null, cb); |
444 | 431 | }; |
445 | 432 |
|
446 | 433 | // Gets details for a specific pull request |
447 | 434 | // ------- |
448 | 435 |
|
449 | 436 | this.getPull = function (number, cb) { |
450 | | - _request('GET', repoPath + '/pulls/' + number, null, function (err, pull, xhr) { |
451 | | - if (err) return cb(err); |
452 | | - cb(null, pull, xhr); |
453 | | - }); |
| 437 | + _request('GET', repoPath + '/pulls/' + number, null, cb); |
454 | 438 | }; |
455 | 439 |
|
456 | 440 | // Retrieve the changes made between base and head |
457 | 441 | // ------- |
458 | 442 |
|
459 | 443 | this.compare = function (base, head, cb) { |
460 | | - _request('GET', repoPath + '/compare/' + base + '...' + head, null, function (err, diff, xhr) { |
461 | | - if (err) return cb(err); |
462 | | - cb(null, diff, xhr); |
463 | | - }); |
| 444 | + _request('GET', repoPath + '/compare/' + base + '...' + head, null, cb); |
464 | 445 | }; |
465 | 446 |
|
466 | 447 | // List all branches of a repository |
|
486 | 467 | // ------- |
487 | 468 |
|
488 | 469 | this.getCommit = function (branch, sha, cb) { |
489 | | - _request('GET', repoPath + '/git/commits/' + sha, null, function (err, commit, xhr) { |
490 | | - if (err) return cb(err); |
491 | | - cb(null, commit, xhr); |
492 | | - }); |
| 470 | + _request('GET', repoPath + '/git/commits/' + sha, null, cb); |
493 | 471 | }; |
494 | 472 |
|
495 | 473 | // For a given file path, get the corresponding sha (blob for files, tree for dirs) |
|
613 | 591 | this.updateHead = function (head, commit, cb) { |
614 | 592 | _request('PATCH', repoPath + '/git/refs/heads/' + head, { |
615 | 593 | sha: commit |
616 | | - }, function (err) { |
617 | | - cb(err); |
618 | | - }); |
| 594 | + }, cb); |
619 | 595 | }; |
620 | 596 |
|
621 | 597 | // Show repository information |
|
779 | 755 |
|
780 | 756 | that.postTree(tree, function (err, rootTree) { |
781 | 757 | that.commit(latestCommit, rootTree, 'Deleted ' + path, function (err, commit) { |
782 | | - that.updateHead(branch, commit, function (err) { |
783 | | - cb(err); |
784 | | - }); |
| 758 | + that.updateHead(branch, commit, cb); |
785 | 759 | }); |
786 | 760 | }); |
787 | 761 | }); |
|
967 | 941 | this.comment = function (issue, comment, cb) { |
968 | 942 | _request('POST', issue.comments_url, { |
969 | 943 | body: comment |
970 | | - }, function (err, res) { |
971 | | - cb(err, res); |
972 | | - }); |
| 944 | + }, cb); |
973 | 945 | }; |
974 | 946 | }; |
975 | 947 |
|
|
0 commit comments