MCPcopy
hub / github.com/leonhartX/gas-github / getGistCode

Method getGistCode

src/scm/github.js:269–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

267 }
268
269 getGistCode() {
270 return new Promise((resolve, reject) => {
271 getGitHubJSON(`${this.baseUrl}/gists/${getBranch()}`, this.accessToken)
272 .then(resolve)
273 .fail(reject);
274 })
275 .then((response) => {
276 const promises = Object.keys(response.files).map((filename) => {
277 let file = response.files[filename];
278 return new Promise((resolve, reject) => {
279 if (file.truncated) {
280 getGitHubJSON(file.raw_url, this.accessToken)
281 .then((content) => {
282 resolve({
283 file: filename,
284 content: content
285 });
286 })
287 .fail(reject)
288 } else {
289 resolve({
290 file: filename,
291 content: file.content
292 });
293 }
294 });
295 });
296 return Promise.all(promises);
297 });
298 }
299
300 getRepos() {
301 return getAllItems(

Callers 1

getCodeMethod · 0.95

Calls 2

getGitHubJSONFunction · 0.85
getBranchFunction · 0.85

Tested by

no test coverage detected