UNPKG

135 kBSource Map (JSON)View Raw
1{"version":3,"sources":["node_modules/browser-pack/_prelude.js","lib/Gist.js","lib/GitHub.js","lib/Issue.js","lib/Markdown.js","lib/Organization.js","lib/Project.js","lib/RateLimit.js","lib/Repository.js","lib/Requestable.js","lib/Search.js","lib/Team.js","lib/User.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","GitHub","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","_Requestable2","Gist","id","auth","apiBase","_classCallCheck","_this","_possibleConstructorReturn","__proto__","Object","getPrototypeOf","__id","cb","_request","gist","_this2","then","response","data","_request204or404","_requestAllPages","revision","comment","body","_Requestable3","default","_Gist","_User","_Issue","_Search","_RateLimit","_Repository","_Organization","_Team","_Markdown","_Project","arguments","undefined","__apiBase","__auth","_Gist2","user","_User2","organization","_Organization2","teamId","_Team2","repo","_Repository2","_getFullName","_Issue2","query","_Search2","_RateLimit2","_Markdown2","_Project2","fullname","Issue","repository","__repository","issueData","options","issue","milestone","milestoneData","labelData","label","Markdown","Organization","__name","requestOptions","_getOptionsWithDefaults","direction","username","AcceptHeader","Project","colId","position","listProjectColumns","_ref","Promise","all","map","column","cardsInColumns","cards","reduce","prev","_ref2","push","apply","_toConsumableArray","catch","err","cardId","column_id","RateLimit","_utf","_jsBase","_debug","log","_debug2","Repository","__fullname","__currentTree","branch","sha","ref","number","base","head","since","_dateToISO","until","path","treeSHA","content","postBody","_getContentObject","_utf2","encode","encoding","Buffer","toString","Blob","Base64","_typeof","JSON","stringify","baseTreeSHA","blobSHA","newTree","base_tree","tree","mode","type","baseSHA","parent","message","parents","assign","commitSHA","force","raw","encodeURI","org","oldBranch","newBranch","_this3","getRef","object","createRef","_this4","getSha","deleteCommit","oldPath","newPath","_this5","oldSha","getTree","_ref2$data","createTree","_ref3","commit","_ref4","updateHead","_this6","filePath","shouldEncode","author","committer","methodHasNoBody","method","METHODS_WITH_NO_BODY","indexOf","getNextPage","split","nextUrl","link","search","match","callbackErrorOrThrow","error","hasOwnProperty","_object$response","status","statusText","_object$config","config","url","ResponseError","_axios","request","Requestable","token","password","__AcceptHeader","__authorizationHeader","newCacheBuster","Date","getTime","replace","headers","Content-Type","Accept","Authorization","visibility","affiliation","sort","per_page","date","toISOString","__getURL","__getRequestHeaders","queryParams","params","responseType","requestPromise","_axios2","keys","results","_results","thisGroup","Array","items","page","parseInt","shift","pop","Search","defaults","__defaults","withOptions","forEach","prop","_search","Team","__teamId","owner","User","__user","endpoint","__getScopedUrl","before"],"mappings":"CAAA,SAAAA,GAAA,GAAA,gBAAAC,UAAA,mBAAAC,QAAAA,OAAAD,QAAAD,QAAA,IAAA,kBAAAG,SAAAA,OAAAC,IAAAD,UAAAH,OAAA,CAAA,GAAAK,EAAAA,GAAA,mBAAAC,QAAAA,OAAA,mBAAAC,QAAAA,OAAA,mBAAAC,MAAAA,KAAAC,KAAAJ,EAAAK,OAAAV,MAAA,WAAA,MAAA,YAAA,QAAAW,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAhB,GAAA,IAAAa,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAC,GAAA,kBAAAC,UAAAA,OAAA,KAAAlB,GAAAiB,EAAA,MAAAA,GAAAD,GAAA,EAAA,IAAAG,EAAA,MAAAA,GAAAH,GAAA,EAAA,IAAAI,GAAA,GAAAC,OAAA,uBAAAL,EAAA,IAAA,MAAAI,GAAAE,KAAA,mBAAAF,EAAA,GAAAG,GAAAV,EAAAG,IAAAf,WAAAW,GAAAI,GAAA,GAAAQ,KAAAD,EAAAtB,QAAA,SAAAU,GAAA,MAAAI,GAAAH,EAAAI,GAAA,GAAAL,IAAAA,IAAAY,EAAAA,EAAAtB,QAAAU,EAAAC,EAAAC,EAAAC,GAAA,MAAAD,GAAAG,GAAAf,QAAA,IAAA,GAAAkB,GAAA,kBAAAD,UAAAA,QAAAF,EAAA,EAAAA,EAAAF,EAAAW,OAAAT,IAAAD,EAAAD,EAAAE,GAAA,OA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AC1B,OAAOzF,MAAKsC,iBAAiBtC,KAAKoQ,eAAe,WAAY5K,EAAgB1D,4CAU/DiD,EAASjD,GAOvB,MANAiD,GAAUA,MACa,kBAAZA,KACRjD,EAAKiD,EACLA,MAEHA,EAAQkD,MAAQjI,KAAKkI,WAAWnD,EAAQkD,OACjCjI,KAAK+B,SAAS,MAAO,iBAAkBgD,EAASjD,qCAShDA,GACP,MAAO9B,MAAK+B,SAAS,MAAO,eAAgB,KAAMD,kCAU9C6D,EAAU7D,GACd,MAAO9B,MAAK+B,SAAS,MAAd,mBAAwC4D,EAAY,KAAM7D,oCAU3D6D,EAAU7D,GAChB,MAAO9B,MAAK+B,SAAS,SAAd,mBAA2C4D,EAAY,KAAM7D,sCAU5DiD,EAASjD,GACjB,MAAO9B,MAAK+B,SAAS,OAAQ,cAAegD,EAASjD,UArMxCY,EAAAC,QAyMnBlD,GAAOD,QAAUyQ","file":"GitHub.min.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\n\n/**\n * A Gist can retrieve and modify gists.\n */\nclass Gist extends Requestable {\n /**\n * Create a Gist.\n * @param {string} id - the id of the gist (not required when creating a gist)\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(id, auth, apiBase) {\n super(auth, apiBase);\n this.__id = id;\n }\n\n /**\n * Fetch a gist.\n * @see https://developer.github.com/v3/gists/#get-a-single-gist\n * @param {Requestable.callback} [cb] - will receive the gist\n * @return {Promise} - the Promise for the http request\n */\n read(cb) {\n return this._request('GET', `/gists/${this.__id}`, null, cb);\n }\n\n /**\n * Create a new gist.\n * @see https://developer.github.com/v3/gists/#create-a-gist\n * @param {Object} gist - the data for the new gist\n * @param {Requestable.callback} [cb] - will receive the new gist upon creation\n * @return {Promise} - the Promise for the http request\n */\n create(gist, cb) {\n return this._request('POST', '/gists', gist, cb)\n .then((response) => {\n this.__id = response.data.id;\n return response;\n });\n }\n\n /**\n * Delete a gist.\n * @see https://developer.github.com/v3/gists/#delete-a-gist\n * @param {Requestable.callback} [cb] - will receive true if the request succeeds\n * @return {Promise} - the Promise for the http request\n */\n delete(cb) {\n return this._request('DELETE', `/gists/${this.__id}`, null, cb);\n }\n\n /**\n * Fork a gist.\n * @see https://developer.github.com/v3/gists/#fork-a-gist\n * @param {Requestable.callback} [cb] - the function that will receive the gist\n * @return {Promise} - the Promise for the http request\n */\n fork(cb) {\n return this._request('POST', `/gists/${this.__id}/forks`, null, cb);\n }\n\n /**\n * Update a gist.\n * @see https://developer.github.com/v3/gists/#edit-a-gist\n * @param {Object} gist - the new data for the gist\n * @param {Requestable.callback} [cb] - the function that receives the API result\n * @return {Promise} - the Promise for the http request\n */\n update(gist, cb) {\n return this._request('PATCH', `/gists/${this.__id}`, gist, cb);\n }\n\n /**\n * Star a gist.\n * @see https://developer.github.com/v3/gists/#star-a-gist\n * @param {Requestable.callback} [cb] - will receive true if the request is successful\n * @return {Promise} - the Promise for the http request\n */\n star(cb) {\n return this._request('PUT', `/gists/${this.__id}/star`, null, cb);\n }\n\n /**\n * Unstar a gist.\n * @see https://developer.github.com/v3/gists/#unstar-a-gist\n * @param {Requestable.callback} [cb] - will receive true if the request is successful\n * @return {Promise} - the Promise for the http request\n */\n unstar(cb) {\n return this._request('DELETE', `/gists/${this.__id}/star`, null, cb);\n }\n\n /**\n * Check if a gist is starred by the user.\n * @see https://developer.github.com/v3/gists/#check-if-a-gist-is-starred\n * @param {Requestable.callback} [cb] - will receive true if the gist is starred and false if the gist is not starred\n * @return {Promise} - the Promise for the http request\n */\n isStarred(cb) {\n return this._request204or404(`/gists/${this.__id}/star`, null, cb);\n }\n\n /**\n * List the gist's commits\n * @see https://developer.github.com/v3/gists/#list-gist-commits\n * @param {Requestable.callback} [cb] - will receive the array of commits\n * @return {Promise} - the Promise for the http request\n */\n listCommits(cb) {\n return this._requestAllPages(`/gists/${this.__id}/commits`, null, cb);\n }\n\n /**\n * Fetch one of the gist's revision.\n * @see https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist\n * @param {string} revision - the id of the revision\n * @param {Requestable.callback} [cb] - will receive the revision\n * @return {Promise} - the Promise for the http request\n */\n getRevision(revision, cb) {\n return this._request('GET', `/gists/${this.__id}/${revision}`, null, cb);\n }\n\n /**\n * List the gist's comments\n * @see https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist\n * @param {Requestable.callback} [cb] - will receive the array of comments\n * @return {Promise} - the promise for the http request\n */\n listComments(cb) {\n return this._requestAllPages(`/gists/${this.__id}/comments`, null, cb);\n }\n\n /**\n * Fetch one of the gist's comments\n * @see https://developer.github.com/v3/gists/comments/#get-a-single-comment\n * @param {number} comment - the id of the comment\n * @param {Requestable.callback} [cb] - will receive the comment\n * @return {Promise} - the Promise for the http request\n */\n getComment(comment, cb) {\n return this._request('GET', `/gists/${this.__id}/comments/${comment}`, null, cb);\n }\n\n /**\n * Comment on a gist\n * @see https://developer.github.com/v3/gists/comments/#create-a-comment\n * @param {string} comment - the comment to add\n * @param {Requestable.callback} [cb] - the function that receives the API result\n * @return {Promise} - the Promise for the http request\n */\n createComment(comment, cb) {\n return this._request('POST', `/gists/${this.__id}/comments`, {body: comment}, cb);\n }\n\n /**\n * Edit a comment on the gist\n * @see https://developer.github.com/v3/gists/comments/#edit-a-comment\n * @param {number} comment - the id of the comment\n * @param {string} body - the new comment\n * @param {Requestable.callback} [cb] - will receive the modified comment\n * @return {Promise} - the promise for the http request\n */\n editComment(comment, body, cb) {\n return this._request('PATCH', `/gists/${this.__id}/comments/${comment}`, {body: body}, cb);\n }\n\n /**\n * Delete a comment on the gist.\n * @see https://developer.github.com/v3/gists/comments/#delete-a-comment\n * @param {number} comment - the id of the comment\n * @param {Requestable.callback} [cb] - will receive true if the request succeeds\n * @return {Promise} - the Promise for the http request\n */\n deleteComment(comment, cb) {\n return this._request('DELETE', `/gists/${this.__id}/comments/${comment}`, null, cb);\n }\n}\n\nmodule.exports = Gist;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n/* eslint valid-jsdoc: [\"error\", {\"requireReturnDescription\": false}] */\n\nimport Gist from './Gist';\nimport User from './User';\nimport Issue from './Issue';\nimport Search from './Search';\nimport RateLimit from './RateLimit';\nimport Repository from './Repository';\nimport Organization from './Organization';\nimport Team from './Team';\nimport Markdown from './Markdown';\nimport Project from './Project';\n\n/**\n * GitHub encapsulates the functionality to create various API wrapper objects.\n */\nclass GitHub {\n /**\n * Create a new GitHub.\n * @param {Requestable.auth} [auth] - the credentials to authenticate to Github. If auth is\n * not provided requests will be made unauthenticated\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(auth, apiBase = 'https://api.github.com') {\n this.__apiBase = apiBase;\n this.__auth = auth || {};\n }\n\n /**\n * Create a new Gist wrapper\n * @param {string} [id] - the id for the gist, leave undefined when creating a new gist\n * @return {Gist}\n */\n getGist(id) {\n return new Gist(id, this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new User wrapper\n * @param {string} [user] - the name of the user to get information about\n * leave undefined for the authenticated user\n * @return {User}\n */\n getUser(user) {\n return new User(user, this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new Organization wrapper\n * @param {string} organization - the name of the organization\n * @return {Organization}\n */\n getOrganization(organization) {\n return new Organization(organization, this.__auth, this.__apiBase);\n }\n\n /**\n * create a new Team wrapper\n * @param {string} teamId - the name of the team\n * @return {team}\n */\n getTeam(teamId) {\n return new Team(teamId, this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new Repository wrapper\n * @param {string} user - the user who owns the repository\n * @param {string} repo - the name of the repository\n * @return {Repository}\n */\n getRepo(user, repo) {\n return new Repository(this._getFullName(user, repo), this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new Issue wrapper\n * @param {string} user - the user who owns the repository\n * @param {string} repo - the name of the repository\n * @return {Issue}\n */\n getIssues(user, repo) {\n return new Issue(this._getFullName(user, repo), this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new Search wrapper\n * @param {string} query - the query to search for\n * @return {Search}\n */\n search(query) {\n return new Search(query, this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new RateLimit wrapper\n * @return {RateLimit}\n */\n getRateLimit() {\n return new RateLimit(this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new Markdown wrapper\n * @return {Markdown}\n */\n getMarkdown() {\n return new Markdown(this.__auth, this.__apiBase);\n }\n\n /**\n * Create a new Project wrapper\n * @param {string} id - the id of the project\n * @return {Project}\n */\n getProject(id) {\n return new Project(id, this.__auth, this.__apiBase);\n }\n\n /**\n * Computes the full repository name\n * @param {string} user - the username (or the full name)\n * @param {string} repo - the repository name, must not be passed if `user` is the full name\n * @return {string} the repository's full name\n */\n _getFullName(user, repo) {\n let fullname = user;\n\n if (repo) {\n fullname = `${user}/${repo}`;\n }\n\n return fullname;\n }\n}\n\nmodule.exports = GitHub;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\n\n/**\n * Issue wraps the functionality to get issues for repositories\n */\nclass Issue extends Requestable {\n /**\n * Create a new Issue\n * @param {string} repository - the full name of the repository (`:user/:repo`) to get issues for\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(repository, auth, apiBase) {\n super(auth, apiBase);\n this.__repository = repository;\n }\n\n /**\n * Create a new issue\n * @see https://developer.github.com/v3/issues/#create-an-issue\n * @param {Object} issueData - the issue to create\n * @param {Requestable.callback} [cb] - will receive the created issue\n * @return {Promise} - the promise for the http request\n */\n createIssue(issueData, cb) {\n return this._request('POST', `/repos/${this.__repository}/issues`, issueData, cb);\n }\n\n /**\n * List the issues for the repository\n * @see https://developer.github.com/v3/issues/#list-issues-for-a-repository\n * @param {Object} options - filtering options\n * @param {Requestable.callback} [cb] - will receive the array of issues\n * @return {Promise} - the promise for the http request\n */\n listIssues(options, cb) {\n return this._requestAllPages(`/repos/${this.__repository}/issues`, options, cb);\n }\n\n /**\n * List the events for an issue\n * @see https://developer.github.com/v3/issues/events/#list-events-for-an-issue\n * @param {number} issue - the issue to get events for\n * @param {Requestable.callback} [cb] - will receive the list of events\n * @return {Promise} - the promise for the http request\n */\n listIssueEvents(issue, cb) {\n return this._request('GET', `/repos/${this.__repository}/issues/${issue}/events`, null, cb);\n }\n\n /**\n * List comments on an issue\n * @see https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue\n * @param {number} issue - the id of the issue to get comments from\n * @param {Requestable.callback} [cb] - will receive the comments\n * @return {Promise} - the promise for the http request\n */\n listIssueComments(issue, cb) {\n return this._request('GET', `/repos/${this.__repository}/issues/${issue}/comments`, null, cb);\n }\n\n /**\n * Get a single comment on an issue\n * @see https://developer.github.com/v3/issues/comments/#get-a-single-comment\n * @param {number} id - the comment id to get\n * @param {Requestable.callback} [cb] - will receive the comment\n * @return {Promise} - the promise for the http request\n */\n getIssueComment(id, cb) {\n return this._request('GET', `/repos/${this.__repository}/issues/comments/${id}`, null, cb);\n }\n\n /**\n * Comment on an issue\n * @see https://developer.github.com/v3/issues/comments/#create-a-comment\n * @param {number} issue - the id of the issue to comment on\n * @param {string} comment - the comment to add\n * @param {Requestable.callback} [cb] - will receive the created comment\n * @return {Promise} - the promise for the http request\n */\n createIssueComment(issue, comment, cb) {\n return this._request('POST', `/repos/${this.__repository}/issues/${issue}/comments`, {body: comment}, cb);\n }\n\n /**\n * Edit a comment on an issue\n * @see https://developer.github.com/v3/issues/comments/#edit-a-comment\n * @param {number} id - the comment id to edit\n * @param {string} comment - the comment to edit\n * @param {Requestable.callback} [cb] - will receive the edited comment\n * @return {Promise} - the promise for the http request\n */\n editIssueComment(id, comment, cb) {\n return this._request('PATCH', `/repos/${this.__repository}/issues/comments/${id}`, {body: comment}, cb);\n }\n\n /**\n * Delete a comment on an issue\n * @see https://developer.github.com/v3/issues/comments/#delete-a-comment\n * @param {number} id - the comment id to delete\n * @param {Requestable.callback} [cb] - will receive true if the request is successful\n * @return {Promise} - the promise for the http request\n */\n deleteIssueComment(id, cb) {\n return this._request('DELETE', `/repos/${this.__repository}/issues/comments/${id}`, null, cb);\n }\n\n /**\n * Edit an issue\n * @see https://developer.github.com/v3/issues/#edit-an-issue\n * @param {number} issue - the issue number to edit\n * @param {Object} issueData - the new issue data\n * @param {Requestable.callback} [cb] - will receive the modified issue\n * @return {Promise} - the promise for the http request\n */\n editIssue(issue, issueData, cb) {\n return this._request('PATCH', `/repos/${this.__repository}/issues/${issue}`, issueData, cb);\n }\n\n /**\n * Get a particular issue\n * @see https://developer.github.com/v3/issues/#get-a-single-issue\n * @param {number} issue - the issue number to fetch\n * @param {Requestable.callback} [cb] - will receive the issue\n * @return {Promise} - the promise for the http request\n */\n getIssue(issue, cb) {\n return this._request('GET', `/repos/${this.__repository}/issues/${issue}`, null, cb);\n }\n\n /**\n * List the milestones for the repository\n * @see https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository\n * @param {Object} options - filtering options\n * @param {Requestable.callback} [cb] - will receive the array of milestones\n * @return {Promise} - the promise for the http request\n */\n listMilestones(options, cb) {\n return this._request('GET', `/repos/${this.__repository}/milestones`, options, cb);\n }\n\n /**\n * Get a milestone\n * @see https://developer.github.com/v3/issues/milestones/#get-a-single-milestone\n * @param {string} milestone - the id of the milestone to fetch\n * @param {Requestable.callback} [cb] - will receive the milestone\n * @return {Promise} - the promise for the http request\n */\n getMilestone(milestone, cb) {\n return this._request('GET', `/repos/${this.__repository}/milestones/${milestone}`, null, cb);\n }\n\n /**\n * Create a new milestone\n * @see https://developer.github.com/v3/issues/milestones/#create-a-milestone\n * @param {Object} milestoneData - the milestone definition\n * @param {Requestable.callback} [cb] - will receive the milestone\n * @return {Promise} - the promise for the http request\n */\n createMilestone(milestoneData, cb) {\n return this._request('POST', `/repos/${this.__repository}/milestones`, milestoneData, cb);\n }\n\n /**\n * Edit a milestone\n * @see https://developer.github.com/v3/issues/milestones/#update-a-milestone\n * @param {string} milestone - the id of the milestone to edit\n * @param {Object} milestoneData - the updates to make to the milestone\n * @param {Requestable.callback} [cb] - will receive the updated milestone\n * @return {Promise} - the promise for the http request\n */\n editMilestone(milestone, milestoneData, cb) {\n return this._request('PATCH', `/repos/${this.__repository}/milestones/${milestone}`, milestoneData, cb);\n }\n\n /**\n * Delete a milestone (this is distinct from closing a milestone)\n * @see https://developer.github.com/v3/issues/milestones/#delete-a-milestone\n * @param {string} milestone - the id of the milestone to delete\n * @param {Requestable.callback} [cb] - will receive the status\n * @return {Promise} - the promise for the http request\n */\n deleteMilestone(milestone, cb) {\n return this._request('DELETE', `/repos/${this.__repository}/milestones/${milestone}`, null, cb);\n }\n\n /**\n * Create a new label\n * @see https://developer.github.com/v3/issues/labels/#create-a-label\n * @param {Object} labelData - the label definition\n * @param {Requestable.callback} [cb] - will receive the object representing the label\n * @return {Promise} - the promise for the http request\n */\n createLabel(labelData, cb) {\n return this._request('POST', `/repos/${this.__repository}/labels`, labelData, cb);\n }\n\n /**\n * List the labels for the repository\n * @see https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository\n * @param {Object} options - filtering options\n * @param {Requestable.callback} [cb] - will receive the array of labels\n * @return {Promise} - the promise for the http request\n */\n listLabels(options, cb) {\n return this._request('GET', `/repos/${this.__repository}/labels`, options, cb);\n }\n\n /**\n * Get a label\n * @see https://developer.github.com/v3/issues/labels/#get-a-single-label\n * @param {string} label - the name of the label to fetch\n * @param {Requestable.callback} [cb] - will receive the label\n * @return {Promise} - the promise for the http request\n */\n getLabel(label, cb) {\n return this._request('GET', `/repos/${this.__repository}/labels/${label}`, null, cb);\n }\n\n /**\n * Edit a label\n * @see https://developer.github.com/v3/issues/labels/#update-a-label\n * @param {string} label - the name of the label to edit\n * @param {Object} labelData - the updates to make to the label\n * @param {Requestable.callback} [cb] - will receive the updated label\n * @return {Promise} - the promise for the http request\n */\n editLabel(label, labelData, cb) {\n return this._request('PATCH', `/repos/${this.__repository}/labels/${label}`, labelData, cb);\n }\n\n /**\n * Delete a label\n * @see https://developer.github.com/v3/issues/labels/#delete-a-label\n * @param {string} label - the name of the label to delete\n * @param {Requestable.callback} [cb] - will receive the status\n * @return {Promise} - the promise for the http request\n */\n deleteLabel(label, cb) {\n return this._request('DELETE', `/repos/${this.__repository}/labels/${label}`, null, cb);\n }\n}\n\nmodule.exports = Issue;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\n\n/**\n * Renders html from Markdown text\n */\nclass Markdown extends Requestable {\n /**\n * construct a Markdown\n * @param {Requestable.auth} auth - the credentials to authenticate to GitHub\n * @param {string} [apiBase] - the base Github API URL\n * @return {Promise} - the promise for the http request\n */\n constructor(auth, apiBase) {\n super(auth, apiBase);\n }\n\n /**\n * Render html from Markdown text.\n * @see https://developer.github.com/v3/markdown/#render-an-arbitrary-markdown-document\n * @param {Object} options - conversion options\n * @param {string} [options.text] - the markdown text to convert\n * @param {string} [options.mode=markdown] - can be either `markdown` or `gfm`\n * @param {string} [options.context] - repository name if mode is gfm\n * @param {Requestable.callback} [cb] - will receive the converted html\n * @return {Promise} - the promise for the http request\n */\n render(options, cb) {\n return this._request('POST', '/markdown', options, cb, true);\n }\n}\n\nmodule.exports = Markdown;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\n\n/**\n * Organization encapsulates the functionality to create repositories in organizations\n */\nclass Organization extends Requestable {\n /**\n * Create a new Organization\n * @param {string} organization - the name of the organization\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(organization, auth, apiBase) {\n super(auth, apiBase);\n this.__name = organization;\n }\n\n /**\n * Create a repository in an organization\n * @see https://developer.github.com/v3/repos/#create\n * @param {Object} options - the repository definition\n * @param {Requestable.callback} [cb] - will receive the created repository\n * @return {Promise} - the promise for the http request\n */\n createRepo(options, cb) {\n return this._request('POST', `/orgs/${this.__name}/repos`, options, cb);\n }\n\n /**\n * List the repositories in an organization\n * @see https://developer.github.com/v3/repos/#list-organization-repositories\n * @param {Requestable.callback} [cb] - will receive the list of repositories\n * @return {Promise} - the promise for the http request\n */\n getRepos(cb) {\n let requestOptions = this._getOptionsWithDefaults({direction: 'desc'});\n\n return this._requestAllPages(`/orgs/${this.__name}/repos`, requestOptions, cb);\n }\n\n /**\n * Query if the user is a member or not\n * @param {string} username - the user in question\n * @param {Requestable.callback} [cb] - will receive true if the user is a member\n * @return {Promise} - the promise for the http request\n */\n isMember(username, cb) {\n return this._request204or404(`/orgs/${this.__name}/members/${username}`, null, cb);\n }\n\n /**\n * List the users who are members of the company\n * @see https://developer.github.com/v3/orgs/members/#members-list\n * @param {object} options - filtering options\n * @param {string} [options.filter=all] - can be either `2fa_disabled` or `all`\n * @param {string} [options.role=all] - can be one of: `all`, `admin`, or `member`\n * @param {Requestable.callback} [cb] - will receive the list of users\n * @return {Promise} - the promise for the http request\n */\n listMembers(options, cb) {\n return this._request('GET', `/orgs/${this.__name}/members`, options, cb);\n }\n\n /**\n * List the Teams in the Organization\n * @see https://developer.github.com/v3/orgs/teams/#list-teams\n * @param {Requestable.callback} [cb] - will receive the list of teams\n * @return {Promise} - the promise for the http request\n */\n getTeams(cb) {\n return this._requestAllPages(`/orgs/${this.__name}/teams`, undefined, cb);\n }\n\n /**\n * Create a team\n * @see https://developer.github.com/v3/orgs/teams/#create-team\n * @param {object} options - Team creation parameters\n * @param {string} options.name - The name of the team\n * @param {string} [options.description] - Team description\n * @param {string} [options.repo_names] - Repos to add the team to\n * @param {string} [options.privacy=secret] - The level of privacy the team should have. Can be either one\n * of: `secret`, or `closed`\n * @param {Requestable.callback} [cb] - will receive the created team\n * @return {Promise} - the promise for the http request\n */\n createTeam(options, cb) {\n return this._request('POST', `/orgs/${this.__name}/teams`, options, cb);\n }\n\n /**\n * Get information about all projects\n * @see https://developer.github.com/v3/projects/#list-organization-projects\n * @param {Requestable.callback} [cb] - will receive the list of projects\n * @return {Promise} - the promise for the http request\n */\n listProjects(cb) {\n return this._requestAllPages(`/orgs/${this.__name}/projects`, {AcceptHeader: 'inertia-preview'}, cb);\n }\n\n /**\n * Create a new project\n * @see https://developer.github.com/v3/repos/projects/#create-a-project\n * @param {Object} options - the description of the project\n * @param {Requestable.callback} cb - will receive the newly created project\n * @return {Promise} - the promise for the http request\n */\n createProject(options, cb) {\n options = options || {};\n options.AcceptHeader = 'inertia-preview';\n return this._request('POST', `/orgs/${this.__name}/projects`, options, cb);\n }\n}\n\nmodule.exports = Organization;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\n\n/**\n * Project encapsulates the functionality to create, query, and modify cards and columns.\n */\nclass Project extends Requestable {\n /**\n * Create a Project.\n * @param {string} id - the id of the project\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(id, auth, apiBase) {\n super(auth, apiBase, 'inertia-preview');\n this.__id = id;\n }\n\n /**\n * Get information about a project\n * @see https://developer.github.com/v3/projects/#get-a-project\n * @param {Requestable.callback} cb - will receive the project information\n * @return {Promise} - the promise for the http request\n */\n getProject(cb) {\n return this._request('GET', `/projects/${this.__id}`, null, cb);\n }\n\n /**\n * Edit a project\n * @see https://developer.github.com/v3/projects/#update-a-project\n * @param {Object} options - the description of the project\n * @param {Requestable.callback} cb - will receive the modified project\n * @return {Promise} - the promise for the http request\n */\n updateProject(options, cb) {\n return this._request('PATCH', `/projects/${this.__id}`, options, cb);\n }\n\n /**\n * Delete a project\n * @see https://developer.github.com/v3/projects/#delete-a-project\n * @param {Requestable.callback} cb - will receive true if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n deleteProject(cb) {\n return this._request('DELETE', `/projects/${this.__id}`, null, cb);\n }\n\n /**\n * Get information about all columns of a project\n * @see https://developer.github.com/v3/projects/columns/#list-project-columns\n * @param {Requestable.callback} [cb] - will receive the list of columns\n * @return {Promise} - the promise for the http request\n */\n listProjectColumns(cb) {\n return this._requestAllPages(`/projects/${this.__id}/columns`, null, cb);\n }\n\n /**\n * Get information about a column\n * @see https://developer.github.com/v3/projects/columns/#get-a-project-column\n * @param {string} colId - the id of the column\n * @param {Requestable.callback} cb - will receive the column information\n * @return {Promise} - the promise for the http request\n */\n getProjectColumn(colId, cb) {\n return this._request('GET', `/projects/columns/${colId}`, null, cb);\n }\n\n /**\n * Create a new column\n * @see https://developer.github.com/v3/projects/columns/#create-a-project-column\n * @param {Object} options - the description of the column\n * @param {Requestable.callback} cb - will receive the newly created column\n * @return {Promise} - the promise for the http request\n */\n createProjectColumn(options, cb) {\n return this._request('POST', `/projects/${this.__id}/columns`, options, cb);\n }\n\n /**\n * Edit a column\n * @see https://developer.github.com/v3/projects/columns/#update-a-project-column\n * @param {string} colId - the column id\n * @param {Object} options - the description of the column\n * @param {Requestable.callback} cb - will receive the modified column\n * @return {Promise} - the promise for the http request\n */\n updateProjectColumn(colId, options, cb) {\n return this._request('PATCH', `/projects/columns/${colId}`, options, cb);\n }\n\n /**\n * Delete a column\n * @see https://developer.github.com/v3/projects/columns/#delete-a-project-column\n * @param {string} colId - the column to be deleted\n * @param {Requestable.callback} cb - will receive true if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n deleteProjectColumn(colId, cb) {\n return this._request('DELETE', `/projects/columns/${colId}`, null, cb);\n }\n\n /**\n * Move a column\n * @see https://developer.github.com/v3/projects/columns/#move-a-project-column\n * @param {string} colId - the column to be moved\n * @param {string} position - can be one of first, last, or after:<column-id>,\n * where <column-id> is the id value of a column in the same project.\n * @param {Requestable.callback} cb - will receive true if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n moveProjectColumn(colId, position, cb) {\n return this._request(\n 'POST',\n `/projects/columns/${colId}/moves`,\n {position: position},\n cb\n );\n }\n\n /**\n * Get information about all cards of a project\n * @see https://developer.github.com/v3/projects/cards/#list-project-cards\n * @param {Requestable.callback} [cb] - will receive the list of cards\n * @return {Promise} - the promise for the http request\n */\n listProjectCards(cb) {\n return this.listProjectColumns()\n .then(({data}) => {\n return Promise.all(data.map((column) => {\n return this._requestAllPages(`/projects/columns/${column.id}/cards`, null);\n }));\n }).then((cardsInColumns) => {\n const cards = cardsInColumns.reduce((prev, {data}) => {\n prev.push(...data);\n return prev;\n }, []);\n if (cb) {\n cb(null, cards);\n }\n return cards;\n }).catch((err) => {\n if (cb) {\n cb(err);\n return;\n }\n throw err;\n });\n }\n\n /**\n * Get information about all cards of a column\n * @see https://developer.github.com/v3/projects/cards/#list-project-cards\n * @param {string} colId - the id of the column\n * @param {Requestable.callback} [cb] - will receive the list of cards\n * @return {Promise} - the promise for the http request\n */\n listColumnCards(colId, cb) {\n return this._requestAllPages(`/projects/columns/${colId}/cards`, null, cb);\n }\n\n /**\n * Get information about a card\n * @see https://developer.github.com/v3/projects/cards/#get-a-project-card\n * @param {string} cardId - the id of the card\n * @param {Requestable.callback} cb - will receive the card information\n * @return {Promise} - the promise for the http request\n */\n getProjectCard(cardId, cb) {\n return this._request('GET', `/projects/columns/cards/${cardId}`, null, cb);\n }\n\n /**\n * Create a new card\n * @see https://developer.github.com/v3/projects/cards/#create-a-project-card\n * @param {string} colId - the column id\n * @param {Object} options - the description of the card\n * @param {Requestable.callback} cb - will receive the newly created card\n * @return {Promise} - the promise for the http request\n */\n createProjectCard(colId, options, cb) {\n return this._request('POST', `/projects/columns/${colId}/cards`, options, cb);\n }\n\n /**\n * Edit a card\n * @see https://developer.github.com/v3/projects/cards/#update-a-project-card\n * @param {string} cardId - the card id\n * @param {Object} options - the description of the card\n * @param {Requestable.callback} cb - will receive the modified card\n * @return {Promise} - the promise for the http request\n */\n updateProjectCard(cardId, options, cb) {\n return this._request('PATCH', `/projects/columns/cards/${cardId}`, options, cb);\n }\n\n /**\n * Delete a card\n * @see https://developer.github.com/v3/projects/cards/#delete-a-project-card\n * @param {string} cardId - the card to be deleted\n * @param {Requestable.callback} cb - will receive true if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n deleteProjectCard(cardId, cb) {\n return this._request('DELETE', `/projects/columns/cards/${cardId}`, null, cb);\n }\n\n /**\n * Move a card\n * @see https://developer.github.com/v3/projects/cards/#move-a-project-card\n * @param {string} cardId - the card to be moved\n * @param {string} position - can be one of top, bottom, or after:<card-id>,\n * where <card-id> is the id value of a card in the same project.\n * @param {string} colId - the id value of a column in the same project.\n * @param {Requestable.callback} cb - will receive true if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n moveProjectCard(cardId, position, colId, cb) {\n return this._request(\n 'POST',\n `/projects/columns/cards/${cardId}/moves`,\n {position: position, column_id: colId}, // eslint-disable-line camelcase\n cb\n );\n }\n}\n\nmodule.exports = Project;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\n\n/**\n * RateLimit allows users to query their rate-limit status\n */\nclass RateLimit extends Requestable {\n /**\n * construct a RateLimit\n * @param {Requestable.auth} auth - the credentials to authenticate to GitHub\n * @param {string} [apiBase] - the base Github API URL\n * @return {Promise} - the promise for the http request\n */\n constructor(auth, apiBase) {\n super(auth, apiBase);\n }\n\n /**\n * Query the current rate limit\n * @see https://developer.github.com/v3/rate_limit/\n * @param {Requestable.callback} [cb] - will receive the rate-limit data\n * @return {Promise} - the promise for the http request\n */\n getRateLimit(cb) {\n return this._request('GET', '/rate_limit', null, cb);\n }\n}\n\nmodule.exports = RateLimit;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\nimport Utf8 from 'utf8';\nimport {\n Base64,\n} from 'js-base64';\nimport debug from 'debug';\nconst log = debug('github:repository');\n\n/**\n * Repository encapsulates the functionality to create, query, and modify files.\n */\nclass Repository extends Requestable {\n /**\n * Create a Repository.\n * @param {string} fullname - the full name of the repository\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(fullname, auth, apiBase) {\n super(auth, apiBase);\n this.__fullname = fullname;\n this.__currentTree = {\n branch: null,\n sha: null,\n };\n }\n\n /**\n * Get a reference\n * @see https://developer.github.com/v3/git/refs/#get-a-reference\n * @param {string} ref - the reference to get\n * @param {Requestable.callback} [cb] - will receive the reference's refSpec or a list of refSpecs that match `ref`\n * @return {Promise} - the promise for the http request\n */\n getRef(ref, cb) {\n return this._request('GET', `/repos/${this.__fullname}/git/refs/${ref}`, null, cb);\n }\n\n /**\n * Create a reference\n * @see https://developer.github.com/v3/git/refs/#create-a-reference\n * @param {Object} options - the object describing the ref\n * @param {Requestable.callback} [cb] - will receive the ref\n * @return {Promise} - the promise for the http request\n */\n createRef(options, cb) {\n return this._request('POST', `/repos/${this.__fullname}/git/refs`, options, cb);\n }\n\n /**\n * Delete a reference\n * @see https://developer.github.com/v3/git/refs/#delete-a-reference\n * @param {string} ref - the name of the ref to delte\n * @param {Requestable.callback} [cb] - will receive true if the request is successful\n * @return {Promise} - the promise for the http request\n */\n deleteRef(ref, cb) {\n return this._request('DELETE', `/repos/${this.__fullname}/git/refs/${ref}`, null, cb);\n }\n\n /**\n * Delete a repository\n * @see https://developer.github.com/v3/repos/#delete-a-repository\n * @param {Requestable.callback} [cb] - will receive true if the request is successful\n * @return {Promise} - the promise for the http request\n */\n deleteRepo(cb) {\n return this._request('DELETE', `/repos/${this.__fullname}`, null, cb);\n }\n\n /**\n * List the tags on a repository\n * @see https://developer.github.com/v3/repos/#list-tags\n * @param {Requestable.callback} [cb] - will receive the tag data\n * @return {Promise} - the promise for the http request\n */\n listTags(cb) {\n return this._request('GET', `/repos/${this.__fullname}/tags`, null, cb);\n }\n\n /**\n * List the open pull requests on the repository\n * @see https://developer.github.com/v3/pulls/#list-pull-requests\n * @param {Object} options - options to filter the search\n * @param {Requestable.callback} [cb] - will receive the list of PRs\n * @return {Promise} - the promise for the http request\n */\n listPullRequests(options, cb) {\n options = options || {};\n return this._request('GET', `/repos/${this.__fullname}/pulls`, options, cb);\n }\n\n /**\n * Get information about a specific pull request\n * @see https://developer.github.com/v3/pulls/#get-a-single-pull-request\n * @param {number} number - the PR you wish to fetch\n * @param {Requestable.callback} [cb] - will receive the PR from the API\n * @return {Promise} - the promise for the http request\n */\n getPullRequest(number, cb) {\n return this._request('GET', `/repos/${this.__fullname}/pulls/${number}`, null, cb);\n }\n\n /**\n * List the files of a specific pull request\n * @see https://developer.github.com/v3/pulls/#list-pull-requests-files\n * @param {number|string} number - the PR you wish to fetch\n * @param {Requestable.callback} [cb] - will receive the list of files from the API\n * @return {Promise} - the promise for the http request\n */\n listPullRequestFiles(number, cb) {\n return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/files`, null, cb);\n }\n\n /**\n * Compare two branches/commits/repositories\n * @see https://developer.github.com/v3/repos/commits/#compare-two-commits\n * @param {string} base - the base commit\n * @param {string} head - the head commit\n * @param {Requestable.callback} cb - will receive the comparison\n * @return {Promise} - the promise for the http request\n */\n compareBranches(base, head, cb) {\n return this._request('GET', `/repos/${this.__fullname}/compare/${base}...${head}`, null, cb);\n }\n\n /**\n * List all the branches for the repository\n * @see https://developer.github.com/v3/repos/#list-branches\n * @param {Requestable.callback} cb - will receive the list of branches\n * @return {Promise} - the promise for the http request\n */\n listBranches(cb) {\n return this._request('GET', `/repos/${this.__fullname}/branches`, null, cb);\n }\n\n /**\n * Get a raw blob from the repository\n * @see https://developer.github.com/v3/git/blobs/#get-a-blob\n * @param {string} sha - the sha of the blob to fetch\n * @param {Requestable.callback} cb - will receive the blob from the API\n * @return {Promise} - the promise for the http request\n */\n getBlob(sha, cb) {\n return this._request('GET', `/repos/${this.__fullname}/git/blobs/${sha}`, null, cb, 'raw');\n }\n\n /**\n * Get a single branch\n * @see https://developer.github.com/v3/repos/branches/#get-branch\n * @param {string} branch - the name of the branch to fetch\n * @param {Requestable.callback} cb - will receive the branch from the API\n * @returns {Promise} - the promise for the http request\n */\n getBranch(branch, cb) {\n return this._request('GET', `/repos/${this.__fullname}/branches/${branch}`, null, cb);\n }\n\n /**\n * Get a commit from the repository\n * @see https://developer.github.com/v3/repos/commits/#get-a-single-commit\n * @param {string} sha - the sha for the commit to fetch\n * @param {Requestable.callback} cb - will receive the commit data\n * @return {Promise} - the promise for the http request\n */\n getCommit(sha, cb) {\n return this._request('GET', `/repos/${this.__fullname}/git/commits/${sha}`, null, cb);\n }\n\n /**\n * List the commits on a repository, optionally filtering by path, author or time range\n * @see https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository\n * @param {Object} [options] - the filtering options for commits\n * @param {string} [options.sha] - the SHA or branch to start from\n * @param {string} [options.path] - the path to search on\n * @param {string} [options.author] - the commit author\n * @param {(Date|string)} [options.since] - only commits after this date will be returned\n * @param {(Date|string)} [options.until] - only commits before this date will be returned\n * @param {Requestable.callback} cb - will receive the list of commits found matching the criteria\n * @return {Promise} - the promise for the http request\n */\n listCommits(options, cb) {\n options = options || {};\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n options.since = this._dateToISO(options.since);\n options.until = this._dateToISO(options.until);\n\n return this._request('GET', `/repos/${this.__fullname}/commits`, options, cb);\n }\n\n /**\n * List the commits on a pull request\n * @see https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository\n * @param {number|string} number - the number of the pull request to list the commits\n * @param {Object} [options] - the filtering options for commits\n * @param {Requestable.callback} [cb] - will receive the commits information\n * @return {Promise} - the promise for the http request\n */\n listCommitsOnPR(number, options, cb) {\n options = options || {};\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/commits`, options, cb);\n }\n\n /**\n * Gets a single commit information for a repository\n * @see https://developer.github.com/v3/repos/commits/#get-a-single-commit\n * @param {string} ref - the reference for the commit-ish\n * @param {Requestable.callback} cb - will receive the commit information\n * @return {Promise} - the promise for the http request\n */\n getSingleCommit(ref, cb) {\n ref = ref || '';\n return this._request('GET', `/repos/${this.__fullname}/commits/${ref}`, null, cb);\n }\n\n /**\n * Get tha sha for a particular object in the repository. This is a convenience function\n * @see https://developer.github.com/v3/repos/contents/#get-contents\n * @param {string} [branch] - the branch to look in, or the repository's default branch if omitted\n * @param {string} path - the path of the file or directory\n * @param {Requestable.callback} cb - will receive a description of the requested object, including a `SHA` property\n * @return {Promise} - the promise for the http request\n */\n getSha(branch, path, cb) {\n branch = branch ? `?ref=${branch}` : '';\n return this._request('GET', `/repos/${this.__fullname}/contents/${path}${branch}`, null, cb);\n }\n\n /**\n * List the commit statuses for a particular sha, branch, or tag\n * @see https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref\n * @param {string} sha - the sha, branch, or tag to get statuses for\n * @param {Requestable.callback} cb - will receive the list of statuses\n * @return {Promise} - the promise for the http request\n */\n listStatuses(sha, cb) {\n return this._request('GET', `/repos/${this.__fullname}/commits/${sha}/statuses`, null, cb);\n }\n\n /**\n * Get the combined view of commit statuses for a particular sha, branch, or tag\n * @see https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref\n * @param {string} sha - the sha, branch, or tag to get the combined status for\n * @param {Requestable.callback} cb - will receive the combined status\n * @returns {Promise} - the promise for the http request\n */\n getCombinedStatus(sha, cb) {\n return this._request('GET', `/repos/${this.__fullname}/commits/${sha}/status`, null, cb);\n }\n\n /**\n * Get a description of a git tree\n * @see https://developer.github.com/v3/git/trees/#get-a-tree\n * @param {string} treeSHA - the SHA of the tree to fetch\n * @param {Requestable.callback} cb - will receive the callback data\n * @return {Promise} - the promise for the http request\n */\n getTree(treeSHA, cb) {\n return this._request('GET', `/repos/${this.__fullname}/git/trees/${treeSHA}`, null, cb);\n }\n\n /**\n * Create a blob\n * @see https://developer.github.com/v3/git/blobs/#create-a-blob\n * @param {(string|Buffer|Blob)} content - the content to add to the repository\n * @param {Requestable.callback} cb - will receive the details of the created blob\n * @return {Promise} - the promise for the http request\n */\n createBlob(content, cb) {\n let postBody = this._getContentObject(content);\n\n log('sending content', postBody);\n return this._request('POST', `/repos/${this.__fullname}/git/blobs`, postBody, cb);\n }\n\n /**\n * Get the object that represents the provided content\n * @param {string|Buffer|Blob} content - the content to send to the server\n * @return {Object} the representation of `content` for the GitHub API\n */\n _getContentObject(content) {\n if (typeof content === 'string') {\n log('contet is a string');\n return {\n content: Utf8.encode(content),\n encoding: 'utf-8',\n };\n\n } else if (typeof Buffer !== 'undefined' && content instanceof Buffer) {\n log('We appear to be in Node');\n return {\n content: content.toString('base64'),\n encoding: 'base64',\n };\n\n } else if (typeof Blob !== 'undefined' && content instanceof Blob) {\n log('We appear to be in the browser');\n return {\n content: Base64.encode(content),\n encoding: 'base64',\n };\n\n } else { // eslint-disable-line\n log(`Not sure what this content is: ${typeof content}, ${JSON.stringify(content)}`);\n throw new Error('Unknown content passed to postBlob. Must be string or Buffer (node) or Blob (web)');\n }\n }\n\n /**\n * Update a tree in Git\n * @see https://developer.github.com/v3/git/trees/#create-a-tree\n * @param {string} baseTreeSHA - the SHA of the tree to update\n * @param {string} path - the path for the new file\n * @param {string} blobSHA - the SHA for the blob to put at `path`\n * @param {Requestable.callback} cb - will receive the new tree that is created\n * @return {Promise} - the promise for the http request\n * @deprecated use {@link Repository#createTree} instead\n */\n updateTree(baseTreeSHA, path, blobSHA, cb) {\n let newTree = {\n base_tree: baseTreeSHA, // eslint-disable-line\n tree: [{\n path: path,\n sha: blobSHA,\n mode: '100644',\n type: 'blob',\n }],\n };\n\n return this._request('POST', `/repos/${this.__fullname}/git/trees`, newTree, cb);\n }\n\n /**\n * Create a new tree in git\n * @see https://developer.github.com/v3/git/trees/#create-a-tree\n * @param {Object} tree - the tree to create\n * @param {string} baseSHA - the root sha of the tree\n * @param {Requestable.callback} cb - will receive the new tree that is created\n * @return {Promise} - the promise for the http request\n */\n createTree(tree, baseSHA, cb) {\n return this._request('POST', `/repos/${this.__fullname}/git/trees`, {\n tree,\n base_tree: baseSHA, // eslint-disable-line camelcase\n }, cb);\n }\n\n /**\n * Add a commit to the repository\n * @see https://developer.github.com/v3/git/commits/#create-a-commit\n * @param {string} parent - the SHA of the parent commit\n * @param {string} tree - the SHA of the tree for this commit\n * @param {string} message - the commit message\n * @param {Object} [options] - commit options\n * @param {Object} [options.author] - the author of the commit\n * @param {Object} [options.commiter] - the committer\n * @param {Requestable.callback} cb - will receive the commit that is created\n * @return {Promise} - the promise for the http request\n */\n commit(parent, tree, message, options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n let data = {\n message,\n tree,\n parents: [parent],\n };\n\n data = Object.assign({}, options, data);\n\n return this._request('POST', `/repos/${this.__fullname}/git/commits`, data, cb)\n .then((response) => {\n this.__currentTree.sha = response.data.sha; // Update latest commit\n return response;\n });\n }\n\n /**\n * Update a ref\n * @see https://developer.github.com/v3/git/refs/#update-a-reference\n * @param {string} ref - the ref to update\n * @param {string} commitSHA - the SHA to point the reference to\n * @param {boolean} force - indicates whether to force or ensure a fast-forward update\n * @param {Requestable.callback} cb - will receive the updated ref back\n * @return {Promise} - the promise for the http request\n */\n updateHead(ref, commitSHA, force, cb) {\n return this._request('PATCH', `/repos/${this.__fullname}/git/refs/${ref}`, {\n sha: commitSHA,\n force: force,\n }, cb);\n }\n\n /**\n * Update commit status\n * @see https://developer.github.com/v3/repos/statuses/\n * @param {string} commitSHA - the SHA of the commit that should be updated\n * @param {object} options - Commit status parameters\n * @param {string} options.state - The state of the status. Can be one of: pending, success, error, or failure.\n * @param {string} [options.target_url] - The target URL to associate with this status.\n * @param {string} [options.description] - A short description of the status.\n * @param {string} [options.context] - A string label to differentiate this status among CI systems.\n * @param {Requestable.callback} cb - will receive the updated commit back\n * @return {Promise} - the promise for the http request\n */\n updateStatus(commitSHA, options, cb) {\n return this._request('POST', `/repos/${this.__fullname}/statuses/${commitSHA}`, options, cb);\n }\n\n /**\n * Update repository information\n * @see https://developer.github.com/v3/repos/#edit\n * @param {object} options - New parameters that will be set to the repository\n * @param {string} options.name - Name of the repository\n * @param {string} [options.description] - A short description of the repository\n * @param {string} [options.homepage] - A URL with more information about the repository\n * @param {boolean} [options.private] - Either true to make the repository private, or false to make it public.\n * @param {boolean} [options.has_issues] - Either true to enable issues for this repository, false to disable them.\n * @param {boolean} [options.has_wiki] - Either true to enable the wiki for this repository, false to disable it.\n * @param {boolean} [options.has_downloads] - Either true to enable downloads, false to disable them.\n * @param {string} [options.default_branch] - Updates the default branch for this repository.\n * @param {Requestable.callback} cb - will receive the updated repository back\n * @return {Promise} - the promise for the http request\n */\n updateRepository(options, cb) {\n return this._request('PATCH', `/repos/${this.__fullname}`, options, cb);\n }\n\n /**\n * Get information about the repository\n * @see https://developer.github.com/v3/repos/#get\n * @param {Requestable.callback} cb - will receive the information about the repository\n * @return {Promise} - the promise for the http request\n */\n getDetails(cb) {\n return this._request('GET', `/repos/${this.__fullname}`, null, cb);\n }\n\n /**\n * List the contributors to the repository\n * @see https://developer.github.com/v3/repos/#list-contributors\n * @param {Requestable.callback} cb - will receive the list of contributors\n * @return {Promise} - the promise for the http request\n */\n getContributors(cb) {\n return this._request('GET', `/repos/${this.__fullname}/contributors`, null, cb);\n }\n\n /**\n * List the contributor stats to the repository\n * @see https://developer.github.com/v3/repos/#list-contributors\n * @param {Requestable.callback} cb - will receive the list of contributors\n * @return {Promise} - the promise for the http request\n */\n getContributorStats(cb) {\n return this._request('GET', `/repos/${this.__fullname}/stats/contributors`, null, cb);\n }\n\n /**\n * List the users who are collaborators on the repository. The currently authenticated user must have\n * push access to use this method\n * @see https://developer.github.com/v3/repos/collaborators/#list-collaborators\n * @param {Requestable.callback} cb - will receive the list of collaborators\n * @return {Promise} - the promise for the http request\n */\n getCollaborators(cb) {\n return this._request('GET', `/repos/${this.__fullname}/collaborators`, null, cb);\n }\n\n /**\n * Check if a user is a collaborator on the repository\n * @see https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator\n * @param {string} username - the user to check\n * @param {Requestable.callback} cb - will receive true if the user is a collaborator and false if they are not\n * @return {Promise} - the promise for the http request {Boolean} [description]\n */\n isCollaborator(username, cb) {\n return this._request('GET', `/repos/${this.__fullname}/collaborators/${username}`, null, cb);\n }\n\n /**\n * Get the contents of a repository\n * @see https://developer.github.com/v3/repos/contents/#get-contents\n * @param {string} ref - the ref to check\n * @param {string} path - the path containing the content to fetch\n * @param {boolean} raw - `true` if the results should be returned raw instead of GitHub's normalized format\n * @param {Requestable.callback} cb - will receive the fetched data\n * @return {Promise} - the promise for the http request\n */\n getContents(ref, path, raw, cb) {\n path = path ? `${encodeURI(path)}` : '';\n return this._request('GET', `/repos/${this.__fullname}/contents/${path}`, {\n ref,\n }, cb, raw);\n }\n\n /**\n * Get the README of a repository\n * @see https://developer.github.com/v3/repos/contents/#get-the-readme\n * @param {string} ref - the ref to check\n * @param {boolean} raw - `true` if the results should be returned raw instead of GitHub's normalized format\n * @param {Requestable.callback} cb - will receive the fetched data\n * @return {Promise} - the promise for the http request\n */\n getReadme(ref, raw, cb) {\n return this._request('GET', `/repos/${this.__fullname}/readme`, {\n ref,\n }, cb, raw);\n }\n\n /**\n * Fork a repository\n * @see https://developer.github.com/v3/repos/forks/#create-a-fork\n * @param {Requestable.callback} cb - will receive the information about the newly created fork\n * @return {Promise} - the promise for the http request\n */\n fork(cb) {\n return this._request('POST', `/repos/${this.__fullname}/forks`, null, cb);\n }\n\n /**\n * Fork a repository to an organization\n * @see https://developer.github.com/v3/repos/forks/#create-a-fork\n * @param {String} org - organization where you'd like to create the fork.\n * @param {Requestable.callback} cb - will receive the information about the newly created fork\n * @return {Promise} - the promise for the http request\n *\n */\n forkToOrg(org, cb) {\n return this._request('POST', `/repos/${this.__fullname}/forks?organization=${org}`, null, cb);\n }\n\n /**\n * List a repository's forks\n * @see https://developer.github.com/v3/repos/forks/#list-forks\n * @param {Requestable.callback} cb - will receive the list of repositories forked from this one\n * @return {Promise} - the promise for the http request\n */\n listForks(cb) {\n return this._request('GET', `/repos/${this.__fullname}/forks`, null, cb);\n }\n\n /**\n * Create a new branch from an existing branch.\n * @param {string} [oldBranch=master] - the name of the existing branch\n * @param {string} newBranch - the name of the new branch\n * @param {Requestable.callback} cb - will receive the commit data for the head of the new branch\n * @return {Promise} - the promise for the http request\n */\n createBranch(oldBranch, newBranch, cb) {\n if (typeof newBranch === 'function') {\n cb = newBranch;\n newBranch = oldBranch;\n oldBranch = 'master';\n }\n\n return this.getRef(`heads/${oldBranch}`)\n .then((response) => {\n let sha = response.data.object.sha;\n return this.createRef({\n sha,\n ref: `refs/heads/${newBranch}`,\n }, cb);\n });\n }\n\n /**\n * Create a new pull request\n * @see https://developer.github.com/v3/pulls/#create-a-pull-request\n * @param {Object} options - the pull request description\n * @param {Requestable.callback} cb - will receive the new pull request\n * @return {Promise} - the promise for the http request\n */\n createPullRequest(options, cb) {\n return this._request('POST', `/repos/${this.__fullname}/pulls`, options, cb);\n }\n\n /**\n * Update a pull request\n * @see https://developer.github.com/v3/pulls/#update-a-pull-request\n * @param {number|string} number - the number of the pull request to update\n * @param {Object} options - the pull request description\n * @param {Requestable.callback} [cb] - will receive the pull request information\n * @return {Promise} - the promise for the http request\n */\n updatePullRequest(number, options, cb) {\n return this._request('PATCH', `/repos/${this.__fullname}/pulls/${number}`, options, cb);\n }\n\n /**\n * List the hooks for the repository\n * @see https://developer.github.com/v3/repos/hooks/#list-hooks\n * @param {Requestable.callback} cb - will receive the list of hooks\n * @return {Promise} - the promise for the http request\n */\n listHooks(cb) {\n return this._request('GET', `/repos/${this.__fullname}/hooks`, null, cb);\n }\n\n /**\n * Get a hook for the repository\n * @see https://developer.github.com/v3/repos/hooks/#get-single-hook\n * @param {number} id - the id of the webook\n * @param {Requestable.callback} cb - will receive the details of the webook\n * @return {Promise} - the promise for the http request\n */\n getHook(id, cb) {\n return this._request('GET', `/repos/${this.__fullname}/hooks/${id}`, null, cb);\n }\n\n /**\n * Add a new hook to the repository\n * @see https://developer.github.com/v3/repos/hooks/#create-a-hook\n * @param {Object} options - the configuration describing the new hook\n * @param {Requestable.callback} cb - will receive the new webhook\n * @return {Promise} - the promise for the http request\n */\n createHook(options, cb) {\n return this._request('POST', `/repos/${this.__fullname}/hooks`, options, cb);\n }\n\n /**\n * Edit an existing webhook\n * @see https://developer.github.com/v3/repos/hooks/#edit-a-hook\n * @param {number} id - the id of the webhook\n * @param {Object} options - the new description of the webhook\n * @param {Requestable.callback} cb - will receive the updated webhook\n * @return {Promise} - the promise for the http request\n */\n updateHook(id, options, cb) {\n return this._request('PATCH', `/repos/${this.__fullname}/hooks/${id}`, options, cb);\n }\n\n /**\n * Delete a webhook\n * @see https://developer.github.com/v3/repos/hooks/#delete-a-hook\n * @param {number} id - the id of the webhook to be deleted\n * @param {Requestable.callback} cb - will receive true if the call is successful\n * @return {Promise} - the promise for the http request\n */\n deleteHook(id, cb) {\n return this._request('DELETE', `/repos/${this.__fullname}/hooks/${id}`, null, cb);\n }\n\n /**\n * List the deploy keys for the repository\n * @see https://developer.github.com/v3/repos/keys/#list-deploy-keys\n * @param {Requestable.callback} cb - will receive the list of deploy keys\n * @return {Promise} - the promise for the http request\n */\n listKeys(cb) {\n return this._request('GET', `/repos/${this.__fullname}/keys`, null, cb);\n }\n\n /**\n * Get a deploy key for the repository\n * @see https://developer.github.com/v3/repos/keys/#get-a-deploy-key\n * @param {number} id - the id of the deploy key\n * @param {Requestable.callback} cb - will receive the details of the deploy key\n * @return {Promise} - the promise for the http request\n */\n getKey(id, cb) {\n return this._request('GET', `/repos/${this.__fullname}/keys/${id}`, null, cb);\n }\n\n /**\n * Add a new deploy key to the repository\n * @see https://developer.github.com/v3/repos/keys/#add-a-new-deploy-key\n * @param {Object} options - the configuration describing the new deploy key\n * @param {Requestable.callback} cb - will receive the new deploy key\n * @return {Promise} - the promise for the http request\n */\n createKey(options, cb) {\n return this._request('POST', `/repos/${this.__fullname}/keys`, options, cb);\n }\n\n /**\n * Delete a deploy key\n * @see https://developer.github.com/v3/repos/keys/#remove-a-deploy-key\n * @param {number} id - the id of the deploy key to be deleted\n * @param {Requestable.callback} cb - will receive true if the call is successful\n * @return {Promise} - the promise for the http request\n */\n deleteKey(id, cb) {\n return this._request('DELETE', `/repos/${this.__fullname}/keys/${id}`, null, cb);\n }\n\n /**\n * Delete a file from a branch\n * @see https://developer.github.com/v3/repos/contents/#delete-a-file\n * @param {string} branch - the branch to delete from, or the default branch if not specified\n * @param {string} path - the path of the file to remove\n * @param {Requestable.callback} cb - will receive the commit in which the delete occurred\n * @return {Promise} - the promise for the http request\n */\n deleteFile(branch, path, cb) {\n return this.getSha(branch, path)\n .then((response) => {\n const deleteCommit = {\n message: `Delete the file at '${path}'`,\n sha: response.data.sha,\n branch,\n };\n return this._request('DELETE', `/repos/${this.__fullname}/contents/${path}`, deleteCommit, cb);\n });\n }\n\n /**\n * Change all references in a repo from oldPath to new_path\n * @param {string} branch - the branch to carry out the reference change, or the default branch if not specified\n * @param {string} oldPath - original path\n * @param {string} newPath - new reference path\n * @param {Requestable.callback} cb - will receive the commit in which the move occurred\n * @return {Promise} - the promise for the http request\n */\n move(branch, oldPath, newPath, cb) {\n let oldSha;\n return this.getRef(`heads/${branch}`)\n .then(({data: {object}}) => this.getTree(`${object.sha}?recursive=true`))\n .then(({data: {tree, sha}}) => {\n oldSha = sha;\n let newTree = tree.map((ref) => {\n if (ref.path === oldPath) {\n ref.path = newPath;\n }\n if (ref.type === 'tree') {\n delete ref.sha;\n }\n return ref;\n });\n return this.createTree(newTree);\n })\n .then(({data: tree}) => this.commit(oldSha, tree.sha, `Renamed '${oldPath}' to '${newPath}'`))\n .then(({data: commit}) => this.updateHead(`heads/${branch}`, commit.sha, true, cb));\n }\n\n /**\n * Write a file to the repository\n * @see https://developer.github.com/v3/repos/contents/#update-a-file\n * @param {string} branch - the name of the branch\n * @param {string} path - the path for the file\n * @param {string} content - the contents of the file\n * @param {string} message - the commit message\n * @param {Object} [options] - commit options\n * @param {Object} [options.author] - the author of the commit\n * @param {Object} [options.commiter] - the committer\n * @param {boolean} [options.encode] - true if the content should be base64 encoded\n * @param {Requestable.callback} cb - will receive the new commit\n * @return {Promise} - the promise for the http request\n */\n writeFile(branch, path, content, message, options, cb) {\n options = options || {};\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n let filePath = path ? encodeURI(path) : '';\n let shouldEncode = options.encode !== false;\n let commit = {\n branch,\n message,\n author: options.author,\n committer: options.committer,\n content: shouldEncode ? Base64.encode(content) : content,\n };\n\n return this.getSha(branch, filePath)\n .then((response) => {\n commit.sha = response.data.sha;\n return this._request('PUT', `/repos/${this.__fullname}/contents/${filePath}`, commit, cb);\n }, () => {\n return this._request('PUT', `/repos/${this.__fullname}/contents/${filePath}`, commit, cb);\n });\n }\n\n /**\n * Check if a repository is starred by you\n * @see https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository\n * @param {Requestable.callback} cb - will receive true if the repository is starred and false if the repository\n * is not starred\n * @return {Promise} - the promise for the http request {Boolean} [description]\n */\n isStarred(cb) {\n return this._request204or404(`/user/starred/${this.__fullname}`, null, cb);\n }\n\n /**\n * Star a repository\n * @see https://developer.github.com/v3/activity/starring/#star-a-repository\n * @param {Requestable.callback} cb - will receive true if the repository is starred\n * @return {Promise} - the promise for the http request\n */\n star(cb) {\n return this._request('PUT', `/user/starred/${this.__fullname}`, null, cb);\n }\n\n /**\n * Unstar a repository\n * @see https://developer.github.com/v3/activity/starring/#unstar-a-repository\n * @param {Requestable.callback} cb - will receive true if the repository is unstarred\n * @return {Promise} - the promise for the http request\n */\n unstar(cb) {\n return this._request('DELETE', `/user/starred/${this.__fullname}`, null, cb);\n }\n\n /**\n * Create a new release\n * @see https://developer.github.com/v3/repos/releases/#create-a-release\n * @param {Object} options - the description of the release\n * @param {Requestable.callback} cb - will receive the newly created release\n * @return {Promise} - the promise for the http request\n */\n createRelease(options, cb) {\n return this._request('POST', `/repos/${this.__fullname}/releases`, options, cb);\n }\n\n /**\n * Edit a release\n * @see https://developer.github.com/v3/repos/releases/#edit-a-release\n * @param {string} id - the id of the release\n * @param {Object} options - the description of the release\n * @param {Requestable.callback} cb - will receive the modified release\n * @return {Promise} - the promise for the http request\n */\n updateRelease(id, options, cb) {\n return this._request('PATCH', `/repos/${this.__fullname}/releases/${id}`, options, cb);\n }\n\n /**\n * Get information about all releases\n * @see https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository\n * @param {Requestable.callback} cb - will receive the release information\n * @return {Promise} - the promise for the http request\n */\n listReleases(cb) {\n return this._request('GET', `/repos/${this.__fullname}/releases`, null, cb);\n }\n\n /**\n * Get information about a release\n * @see https://developer.github.com/v3/repos/releases/#get-a-single-release\n * @param {string} id - the id of the release\n * @param {Requestable.callback} cb - will receive the release information\n * @return {Promise} - the promise for the http request\n */\n getRelease(id, cb) {\n return this._request('GET', `/repos/${this.__fullname}/releases/${id}`, null, cb);\n }\n\n /**\n * Delete a release\n * @see https://developer.github.com/v3/repos/releases/#delete-a-release\n * @param {string} id - the release to be deleted\n * @param {Requestable.callback} cb - will receive true if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n deleteRelease(id, cb) {\n return this._request('DELETE', `/repos/${this.__fullname}/releases/${id}`, null, cb);\n }\n\n /**\n * Merge a pull request\n * @see https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button\n * @param {number|string} number - the number of the pull request to merge\n * @param {Object} options - the merge options for the pull request\n * @param {Requestable.callback} [cb] - will receive the merge information if the operation is successful\n * @return {Promise} - the promise for the http request\n */\n mergePullRequest(number, options, cb) {\n return this._request('PUT', `/repos/${this.__fullname}/pulls/${number}/merge`, options, cb);\n }\n\n /**\n * Get information about all projects\n * @see https://developer.github.com/v3/projects/#list-repository-projects\n * @param {Requestable.callback} [cb] - will receive the list of projects\n * @return {Promise} - the promise for the http request\n */\n listProjects(cb) {\n return this._requestAllPages(`/repos/${this.__fullname}/projects`, {AcceptHeader: 'inertia-preview'}, cb);\n }\n\n /**\n * Create a new project\n * @see https://developer.github.com/v3/projects/#create-a-repository-project\n * @param {Object} options - the description of the project\n * @param {Requestable.callback} cb - will receive the newly created project\n * @return {Promise} - the promise for the http request\n */\n createProject(options, cb) {\n options = options || {};\n options.AcceptHeader = 'inertia-preview';\n return this._request('POST', `/repos/${this.__fullname}/projects`, options, cb);\n }\n\n}\n\nmodule.exports = Repository;\n","/**\n * @file\n * @copyright 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport axios from 'axios';\nimport debug from 'debug';\nimport {Base64} from 'js-base64';\n\nconst log = debug('github:request');\n\n/**\n * The error structure returned when a network call fails\n */\nclass ResponseError extends Error {\n /**\n * Construct a new ResponseError\n * @param {string} message - an message to return instead of the the default error message\n * @param {string} path - the requested path\n * @param {Object} response - the object returned by Axios\n */\n constructor(message, path, response) {\n super(message);\n this.path = path;\n this.request = response.config;\n this.response = (response || {}).response || response;\n this.status = response.status;\n }\n}\n\n/**\n * Requestable wraps the logic for making http requests to the API\n */\nclass Requestable {\n /**\n * Either a username and password or an oauth token for Github\n * @typedef {Object} Requestable.auth\n * @prop {string} [username] - the Github username\n * @prop {string} [password] - the user's password\n * @prop {token} [token] - an OAuth token\n */\n /**\n * Initialize the http internals.\n * @param {Requestable.auth} [auth] - the credentials to authenticate to Github. If auth is\n * not provided request will be made unauthenticated\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n * @param {string} [AcceptHeader=v3] - the accept header for the requests\n */\n constructor(auth, apiBase, AcceptHeader) {\n this.__apiBase = apiBase || 'https://api.github.com';\n this.__auth = {\n token: auth.token,\n username: auth.username,\n password: auth.password,\n };\n this.__AcceptHeader = AcceptHeader || 'v3';\n\n if (auth.token) {\n this.__authorizationHeader = 'token ' + auth.token;\n } else if (auth.username && auth.password) {\n this.__authorizationHeader = 'Basic ' + Base64.encode(auth.username + ':' + auth.password);\n }\n }\n\n /**\n * Compute the URL to use to make a request.\n * @private\n * @param {string} path - either a URL relative to the API base or an absolute URL\n * @return {string} - the URL to use\n */\n __getURL(path) {\n let url = path;\n\n if (path.indexOf('//') === -1) {\n url = this.__apiBase + path;\n }\n\n let newCacheBuster = 'timestamp=' + new Date().getTime();\n return url.replace(/(timestamp=\\d+)/, newCacheBuster);\n }\n\n /**\n * Compute the headers required for an API request.\n * @private\n * @param {boolean} raw - if the request should be treated as JSON or as a raw request\n * @param {string} AcceptHeader - the accept header for the request\n * @return {Object} - the headers to use in the request\n */\n __getRequestHeaders(raw, AcceptHeader) {\n let headers = {\n 'Content-Type': 'application/json;charset=UTF-8',\n 'Accept': 'application/vnd.github.' + (AcceptHeader || this.__AcceptHeader),\n };\n\n if (raw) {\n headers.Accept += '.raw';\n }\n headers.Accept += '+json';\n\n if (this.__authorizationHeader) {\n headers.Authorization = this.__authorizationHeader;\n }\n\n return headers;\n }\n\n /**\n * Sets the default options for API requests\n * @protected\n * @param {Object} [requestOptions={}] - the current options for the request\n * @return {Object} - the options to pass to the request\n */\n _getOptionsWithDefaults(requestOptions = {}) {\n if (!(requestOptions.visibility || requestOptions.affiliation)) {\n requestOptions.type = requestOptions.type || 'all';\n }\n requestOptions.sort = requestOptions.sort || 'updated';\n requestOptions.per_page = requestOptions.per_page || '100'; // eslint-disable-line\n\n return requestOptions;\n }\n\n /**\n * if a `Date` is passed to this function it will be converted to an ISO string\n * @param {*} date - the object to attempt to coerce into an ISO date string\n * @return {string} - the ISO representation of `date` or whatever was passed in if it was not a date\n */\n _dateToISO(date) {\n if (date && (date instanceof Date)) {\n date = date.toISOString();\n }\n\n return date;\n }\n\n /**\n * A function that receives the result of the API request.\n * @callback Requestable.callback\n * @param {Requestable.Error} error - the error returned by the API or `null`\n * @param {(Object|true)} result - the data returned by the API or `true` if the API returns `204 No Content`\n * @param {Object} request - the raw {@linkcode https://github.com/mzabriskie/axios#response-schema Response}\n */\n /**\n * Make a request.\n * @param {string} method - the method for the request (GET, PUT, POST, DELETE)\n * @param {string} path - the path for the request\n * @param {*} [data] - the data to send to the server. For HTTP methods that don't have a body the data\n * will be sent as query parameters\n * @param {Requestable.callback} [cb] - the callback for the request\n * @param {boolean} [raw=false] - if the request should be sent as raw. If this is a falsy value then the\n * request will be made as JSON\n * @return {Promise} - the Promise for the http request\n */\n _request(method, path, data, cb, raw) {\n const url = this.__getURL(path);\n\n const AcceptHeader = (data || {}).AcceptHeader;\n if (AcceptHeader) {\n delete data.AcceptHeader;\n }\n const headers = this.__getRequestHeaders(raw, AcceptHeader);\n\n let queryParams = {};\n\n const shouldUseDataAsParams = data && (typeof data === 'object') && methodHasNoBody(method);\n if (shouldUseDataAsParams) {\n queryParams = data;\n data = undefined;\n }\n\n const config = {\n url: url,\n method: method,\n headers: headers,\n params: queryParams,\n data: data,\n responseType: raw ? 'text' : 'json',\n };\n\n log(`${config.method} to ${config.url}`);\n const requestPromise = axios(config).catch(callbackErrorOrThrow(cb, path));\n\n if (cb) {\n requestPromise.then((response) => {\n if (response.data && Object.keys(response.data).length > 0) {\n // When data has results\n cb(null, response.data, response);\n } else if (config.method !== 'GET' && Object.keys(response.data).length < 1) {\n // True when successful submit a request and receive a empty object\n cb(null, (response.status < 300), response);\n } else {\n cb(null, response.data, response);\n }\n });\n }\n\n return requestPromise;\n }\n\n /**\n * Make a request to an endpoint the returns 204 when true and 404 when false\n * @param {string} path - the path to request\n * @param {Object} data - any query parameters for the request\n * @param {Requestable.callback} cb - the callback that will receive `true` or `false`\n * @param {method} [method=GET] - HTTP Method to use\n * @return {Promise} - the promise for the http request\n */\n _request204or404(path, data, cb, method = 'GET') {\n return this._request(method, path, data)\n .then(function success(response) {\n if (cb) {\n cb(null, true, response);\n }\n return true;\n }, function failure(response) {\n if (response.response.status === 404) {\n if (cb) {\n cb(null, false, response);\n }\n return false;\n }\n\n if (cb) {\n cb(response);\n }\n throw response;\n });\n }\n\n /**\n * Make a request and fetch all the available data. Github will paginate responses so for queries\n * that might span multiple pages this method is preferred to {@link Requestable#request}\n * @param {string} path - the path to request\n * @param {Object} options - the query parameters to include\n * @param {Requestable.callback} [cb] - the function to receive the data. The returned data will always be an array.\n * @param {Object[]} results - the partial results. This argument is intended for internal use only.\n * @return {Promise} - a promise which will resolve when all pages have been fetched\n * @deprecated This will be folded into {@link Requestable#_request} in the 2.0 release.\n */\n _requestAllPages(path, options, cb, results) {\n results = results || [];\n\n return this._request('GET', path, options)\n .then((response) => {\n let thisGroup;\n if (response.data instanceof Array) {\n thisGroup = response.data;\n } else if (response.data.items instanceof Array) {\n thisGroup = response.data.items;\n } else {\n let message = `cannot figure out how to append ${response.data} to the result set`;\n throw new ResponseError(message, path, response);\n }\n results.push(...thisGroup);\n\n const nextUrl = getNextPage(response.headers.link);\n if(nextUrl) {\n if (!options) {\n options = {};\n }\n options.page = parseInt(\n nextUrl.match(/([&\\?]page=[0-9]*)/g)\n .shift()\n .split('=')\n .pop()\n );\n if (!(options && typeof options.page !== 'number')) {\n log(`getting next page: ${nextUrl}`);\n return this._requestAllPages(nextUrl, options, cb, results);\n }\n }\n\n if (cb) {\n cb(null, results, response);\n }\n\n response.data = results;\n return response;\n }).catch(callbackErrorOrThrow(cb, path));\n }\n}\n\nmodule.exports = Requestable;\n\n// ////////////////////////// //\n// Private helper functions //\n// ////////////////////////// //\nconst METHODS_WITH_NO_BODY = ['GET', 'HEAD', 'DELETE'];\nfunction methodHasNoBody(method) {\n return METHODS_WITH_NO_BODY.indexOf(method) !== -1;\n}\n\nfunction getNextPage(linksHeader = '') {\n const links = linksHeader.split(/\\s*,\\s*/); // splits and strips the urls\n return links.reduce(function(nextUrl, link) {\n if (link.search(/rel=\"next\"/) !== -1) {\n return (link.match(/<(.*)>/) || [])[1];\n }\n\n return nextUrl;\n }, undefined);\n}\n\nfunction callbackErrorOrThrow(cb, path) {\n return function handler(object) {\n let error;\n if (object.hasOwnProperty('config')) {\n const {response: {status, statusText}, config: {method, url}} = object;\n let message = (`${status} error making request ${method} ${url}: \"${statusText}\"`);\n error = new ResponseError(message, path, object);\n log(`${message} ${JSON.stringify(object.data)}`);\n } else {\n error = object;\n }\n if (cb) {\n log('going to error callback');\n cb(error);\n } else {\n log('throwing error');\n throw error;\n }\n };\n}\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\nimport debug from 'debug';\nconst log = debug('github:search');\n\n/**\n * Wrap the Search API\n */\nclass Search extends Requestable {\n /**\n * Create a Search\n * @param {Object} defaults - defaults for the search\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(defaults, auth, apiBase) {\n super(auth, apiBase);\n this.__defaults = this._getOptionsWithDefaults(defaults);\n }\n\n /**\n * Available search options\n * @see https://developer.github.com/v3/search/#parameters\n * @typedef {Object} Search.Params\n * @param {string} q - the query to make\n * @param {string} sort - the sort field, one of `stars`, `forks`, or `updated`.\n * Default is [best match](https://developer.github.com/v3/search/#ranking-search-results)\n * @param {string} order - the ordering, either `asc` or `desc`\n */\n /**\n * Perform a search on the GitHub API\n * @private\n * @param {string} path - the scope of the search\n * @param {Search.Params} [withOptions] - additional parameters for the search\n * @param {Requestable.callback} [cb] - will receive the results of the search\n * @return {Promise} - the promise for the http request\n */\n _search(path, withOptions = {}, cb = undefined) {\n let requestOptions = {};\n Object.keys(this.__defaults).forEach((prop) => {\n requestOptions[prop] = this.__defaults[prop];\n });\n Object.keys(withOptions).forEach((prop) => {\n requestOptions[prop] = withOptions[prop];\n });\n\n log(`searching ${path} with options:`, requestOptions);\n return this._requestAllPages(`/search/${path}`, requestOptions, cb);\n }\n\n /**\n * Search for repositories\n * @see https://developer.github.com/v3/search/#search-repositories\n * @param {Search.Params} [options] - additional parameters for the search\n * @param {Requestable.callback} [cb] - will receive the results of the search\n * @return {Promise} - the promise for the http request\n */\n forRepositories(options, cb) {\n return this._search('repositories', options, cb);\n }\n\n /**\n * Search for code\n * @see https://developer.github.com/v3/search/#search-code\n * @param {Search.Params} [options] - additional parameters for the search\n * @param {Requestable.callback} [cb] - will receive the results of the search\n * @return {Promise} - the promise for the http request\n */\n forCode(options, cb) {\n return this._search('code', options, cb);\n }\n\n /**\n * Search for issues\n * @see https://developer.github.com/v3/search/#search-issues\n * @param {Search.Params} [options] - additional parameters for the search\n * @param {Requestable.callback} [cb] - will receive the results of the search\n * @return {Promise} - the promise for the http request\n */\n forIssues(options, cb) {\n return this._search('issues', options, cb);\n }\n\n /**\n * Search for users\n * @see https://developer.github.com/v3/search/#search-users\n * @param {Search.Params} [options] - additional parameters for the search\n * @param {Requestable.callback} [cb] - will receive the results of the search\n * @return {Promise} - the promise for the http request\n */\n forUsers(options, cb) {\n return this._search('users', options, cb);\n }\n}\n\nmodule.exports = Search;\n","/**\n * @file\n * @copyright 2016 Matt Smith (Development Seed)\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\nimport debug from 'debug';\nconst log = debug('github:team');\n\n/**\n * A Team allows scoping of API requests to a particular Github Organization Team.\n */\nclass Team extends Requestable {\n /**\n * Create a Team.\n * @param {string} [teamId] - the id for the team\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(teamId, auth, apiBase) {\n super(auth, apiBase);\n this.__teamId = teamId;\n }\n\n /**\n * Get Team information\n * @see https://developer.github.com/v3/orgs/teams/#get-team\n * @param {Requestable.callback} [cb] - will receive the team\n * @return {Promise} - the promise for the http request\n */\n getTeam(cb) {\n log(`Fetching Team ${this.__teamId}`);\n return this._request('Get', `/teams/${this.__teamId}`, undefined, cb);\n }\n\n /**\n * List the Team's repositories\n * @see https://developer.github.com/v3/orgs/teams/#list-team-repos\n * @param {Requestable.callback} [cb] - will receive the list of repositories\n * @return {Promise} - the promise for the http request\n */\n listRepos(cb) {\n log(`Fetching repositories for Team ${this.__teamId}`);\n return this._requestAllPages(`/teams/${this.__teamId}/repos`, undefined, cb);\n }\n\n /**\n * Edit Team information\n * @see https://developer.github.com/v3/orgs/teams/#edit-team\n * @param {object} options - Parameters for team edit\n * @param {string} options.name - The name of the team\n * @param {string} [options.description] - Team description\n * @param {string} [options.repo_names] - Repos to add the team to\n * @param {string} [options.privacy=secret] - The level of privacy the team should have. Can be either one\n * of: `secret`, or `closed`\n * @param {Requestable.callback} [cb] - will receive the updated team\n * @return {Promise} - the promise for the http request\n */\n editTeam(options, cb) {\n log(`Editing Team ${this.__teamId}`);\n return this._request('PATCH', `/teams/${this.__teamId}`, options, cb);\n }\n\n /**\n * List the users who are members of the Team\n * @see https://developer.github.com/v3/orgs/teams/#list-team-members\n * @param {object} options - Parameters for listing team users\n * @param {string} [options.role=all] - can be one of: `all`, `maintainer`, or `member`\n * @param {Requestable.callback} [cb] - will receive the list of users\n * @return {Promise} - the promise for the http request\n */\n listMembers(options, cb) {\n log(`Getting members of Team ${this.__teamId}`);\n return this._requestAllPages(`/teams/${this.__teamId}/members`, options, cb);\n }\n\n /**\n * Get Team membership status for a user\n * @see https://developer.github.com/v3/orgs/teams/#get-team-membership\n * @param {string} username - can be one of: `all`, `maintainer`, or `member`\n * @param {Requestable.callback} [cb] - will receive the membership status of a user\n * @return {Promise} - the promise for the http request\n */\n getMembership(username, cb) {\n log(`Getting membership of user ${username} in Team ${this.__teamId}`);\n return this._request('GET', `/teams/${this.__teamId}/memberships/${username}`, undefined, cb);\n }\n\n /**\n * Add a member to the Team\n * @see https://developer.github.com/v3/orgs/teams/#add-team-membership\n * @param {string} username - can be one of: `all`, `maintainer`, or `member`\n * @param {object} options - Parameters for adding a team member\n * @param {string} [options.role=member] - The role that this user should have in the team. Can be one\n * of: `member`, or `maintainer`\n * @param {Requestable.callback} [cb] - will receive the membership status of added user\n * @return {Promise} - the promise for the http request\n */\n addMembership(username, options, cb) {\n log(`Adding user ${username} to Team ${this.__teamId}`);\n return this._request('PUT', `/teams/${this.__teamId}/memberships/${username}`, options, cb);\n }\n\n /**\n * Get repo management status for team\n * @see https://developer.github.com/v3/orgs/teams/#remove-team-membership\n * @param {string} owner - Organization name\n * @param {string} repo - Repo name\n * @param {Requestable.callback} [cb] - will receive the membership status of added user\n * @return {Promise} - the promise for the http request\n */\n isManagedRepo(owner, repo, cb) {\n log(`Getting repo management by Team ${this.__teamId} for repo ${owner}/${repo}`);\n return this._request204or404(`/teams/${this.__teamId}/repos/${owner}/${repo}`, undefined, cb);\n }\n\n /**\n * Add or Update repo management status for team\n * @see https://developer.github.com/v3/orgs/teams/#add-or-update-team-repository\n * @param {string} owner - Organization name\n * @param {string} repo - Repo name\n * @param {object} options - Parameters for adding or updating repo management for the team\n * @param {string} [options.permission] - The permission to grant the team on this repository. Can be one\n * of: `pull`, `push`, or `admin`\n * @param {Requestable.callback} [cb] - will receive the membership status of added user\n * @return {Promise} - the promise for the http request\n */\n manageRepo(owner, repo, options, cb) {\n log(`Adding or Updating repo management by Team ${this.__teamId} for repo ${owner}/${repo}`);\n return this._request204or404(`/teams/${this.__teamId}/repos/${owner}/${repo}`, options, cb, 'PUT');\n }\n\n /**\n * Remove repo management status for team\n * @see https://developer.github.com/v3/orgs/teams/#remove-team-repository\n * @param {string} owner - Organization name\n * @param {string} repo - Repo name\n * @param {Requestable.callback} [cb] - will receive the membership status of added user\n * @return {Promise} - the promise for the http request\n */\n unmanageRepo(owner, repo, cb) {\n log(`Remove repo management by Team ${this.__teamId} for repo ${owner}/${repo}`);\n return this._request204or404(`/teams/${this.__teamId}/repos/${owner}/${repo}`, undefined, cb, 'DELETE');\n }\n\n /**\n * Delete Team\n * @see https://developer.github.com/v3/orgs/teams/#delete-team\n * @param {Requestable.callback} [cb] - will receive the list of repositories\n * @return {Promise} - the promise for the http request\n */\n deleteTeam(cb) {\n log(`Deleting Team ${this.__teamId}`);\n return this._request204or404(`/teams/${this.__teamId}`, undefined, cb, 'DELETE');\n }\n}\n\nmodule.exports = Team;\n","/**\n * @file\n * @copyright 2013 Michael Aufreiter (Development Seed) and 2016 Yahoo Inc.\n * @license Licensed under {@link https://spdx.org/licenses/BSD-3-Clause-Clear.html BSD-3-Clause-Clear}.\n * Github.js is freely distributable.\n */\n\nimport Requestable from './Requestable';\nimport debug from 'debug';\nconst log = debug('github:user');\n\n/**\n * A User allows scoping of API requests to a particular Github user.\n */\nclass User extends Requestable {\n /**\n * Create a User.\n * @param {string} [username] - the user to use for user-scoped queries\n * @param {Requestable.auth} [auth] - information required to authenticate to Github\n * @param {string} [apiBase=https://api.github.com] - the base Github API URL\n */\n constructor(username, auth, apiBase) {\n super(auth, apiBase);\n this.__user = username;\n }\n\n /**\n * Get the url for the request. (dependent on if we're requesting for the authenticated user or not)\n * @private\n * @param {string} endpoint - the endpoint being requested\n * @return {string} - the resolved endpoint\n */\n __getScopedUrl(endpoint) {\n if (this.__user) {\n return endpoint ?\n `/users/${this.__user}/${endpoint}` :\n `/users/${this.__user}`\n ;\n\n } else { // eslint-disable-line\n switch (endpoint) {\n case '':\n return '/user';\n\n case 'notifications':\n case 'gists':\n return `/${endpoint}`;\n\n default:\n return `/user/${endpoint}`;\n }\n }\n }\n\n /**\n * List the user's repositories\n * @see https://developer.github.com/v3/repos/#list-user-repositories\n * @param {Object} [options={}] - any options to refine the search\n * @param {Requestable.callback} [cb] - will receive the list of repositories\n * @return {Promise} - the promise for the http request\n */\n listRepos(options, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options = this._getOptionsWithDefaults(options);\n\n log(`Fetching repositories with options: ${JSON.stringify(options)}`);\n return this._requestAllPages(this.__getScopedUrl('repos'), options, cb);\n }\n\n /**\n * List the orgs that the user belongs to\n * @see https://developer.github.com/v3/orgs/#list-user-organizations\n * @param {Requestable.callback} [cb] - will receive the list of organizations\n * @return {Promise} - the promise for the http request\n */\n listOrgs(cb) {\n return this._request('GET', this.__getScopedUrl('orgs'), null, cb);\n }\n\n /**\n * List followers of a user\n * @see https://developer.github.com/v3/users/followers/#list-followers-of-a-user\n * @param {Requestable.callback} [cb] - will receive the list of followers\n * @return {Promise} - the promise for the http request\n */\n listFollowers(cb) {\n return this._request('GET', this.__getScopedUrl('followers'), null, cb);\n }\n\n /**\n * List users followed by another user\n * @see https://developer.github.com/v3/users/followers/#list-users-followed-by-another-user\n * @param {Requestable.callback} [cb] - will receive the list of who a user is following\n * @return {Promise} - the promise for the http request\n */\n listFollowing(cb) {\n return this._request('GET', this.__getScopedUrl('following'), null, cb);\n }\n\n /**\n * List the user's gists\n * @see https://developer.github.com/v3/gists/#list-a-users-gists\n * @param {Requestable.callback} [cb] - will receive the list of gists\n * @return {Promise} - the promise for the http request\n */\n listGists(cb) {\n return this._request('GET', this.__getScopedUrl('gists'), null, cb);\n }\n\n /**\n * List the user's notifications\n * @see https://developer.github.com/v3/activity/notifications/#list-your-notifications\n * @param {Object} [options={}] - any options to refine the search\n * @param {Requestable.callback} [cb] - will receive the list of repositories\n * @return {Promise} - the promise for the http request\n */\n listNotifications(options, cb) {\n options = options || {};\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n options.since = this._dateToISO(options.since);\n options.before = this._dateToISO(options.before);\n\n return this._request('GET', this.__getScopedUrl('notifications'), options, cb);\n }\n\n /**\n * Show the user's profile\n * @see https://developer.github.com/v3/users/#get-a-single-user\n * @param {Requestable.callback} [cb] - will receive the user's information\n * @return {Promise} - the promise for the http request\n */\n getProfile(cb) {\n return this._request('GET', this.__getScopedUrl(''), null, cb);\n }\n\n /**\n * Gets the list of starred repositories for the user\n * @see https://developer.github.com/v3/activity/starring/#list-repositories-being-starred\n * @param {Requestable.callback} [cb] - will receive the list of starred repositories\n * @return {Promise} - the promise for the http request\n */\n listStarredRepos(cb) {\n let requestOptions = this._getOptionsWithDefaults();\n return this._requestAllPages(this.__getScopedUrl('starred'), requestOptions, cb);\n }\n\n /**\n * Gets the list of starred gists for the user\n * @see https://developer.github.com/v3/gists/#list-starred-gists\n * @param {Object} [options={}] - any options to refine the search\n * @param {Requestable.callback} [cb] - will receive the list of gists\n * @return {Promise} - the promise for the http request\n */\n listStarredGists(options, cb) {\n options = options || {};\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n options.since = this._dateToISO(options.since);\n return this._request('GET', '/gists/starred', options, cb);\n }\n\n /**\n * List email addresses for a user\n * @see https://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user\n * @param {Requestable.callback} [cb] - will receive the list of emails\n * @return {Promise} - the promise for the http request\n */\n getEmails(cb) {\n return this._request('GET', '/user/emails', null, cb);\n }\n\n /**\n * Have the authenticated user follow this user\n * @see https://developer.github.com/v3/users/followers/#follow-a-user\n * @param {string} username - the user to follow\n * @param {Requestable.callback} [cb] - will receive true if the request succeeds\n * @return {Promise} - the promise for the http request\n */\n follow(username, cb) {\n return this._request('PUT', `/user/following/${username}`, null, cb);\n }\n\n /**\n * Have the currently authenticated user unfollow this user\n * @see https://developer.github.com/v3/users/followers/#follow-a-user\n * @param {string} username - the user to unfollow\n * @param {Requestable.callback} [cb] - receives true if the request succeeds\n * @return {Promise} - the promise for the http request\n */\n unfollow(username, cb) {\n return this._request('DELETE', `/user/following/${username}`, null, cb);\n }\n\n /**\n * Create a new repository for the currently authenticated user\n * @see https://developer.github.com/v3/repos/#create\n * @param {object} options - the repository definition\n * @param {Requestable.callback} [cb] - will receive the API response\n * @return {Promise} - the promise for the http request\n */\n createRepo(options, cb) {\n return this._request('POST', '/user/repos', options, cb);\n }\n}\n\nmodule.exports = User;\n"]}
\No newline at end of file