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

Method getGasCode

src/gas/script-api.js:81–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79 }
80
81 getGasCode() {
82 return this.updateToken()
83 .then(() => {
84 return new Promise((resolve, reject) => {
85 $.getJSON(
86 `${API_URL}/${getId()}/content`, {
87 access_token: context.gapiToken
88 }
89 )
90 .then(resolve)
91 .fail(reject)
92 })
93 })
94 .then(content => {
95 const code = content.files.reduce((hash, elem) => {
96 if (elem) {
97 let type;
98 switch (elem.type) {
99 case "HTML":
100 type = ".html"
101 break;
102 case "JSON":
103 type = ".json"
104 break;
105 case "SERVER_JS":
106 type = getConfig().filetype
107 break;
108 }
109 hash[elem.name + type] = elem.source;
110 }
111 return hash;
112 }, {});
113 return code;
114 });
115 }
116
117 updateGas() {
118 return new Promise((resolve, reject) => {

Callers 1

prepareCodeFunction · 0.80

Calls 3

updateTokenMethod · 0.95
getIdFunction · 0.85
getConfigFunction · 0.85

Tested by

no test coverage detected