global swaggerclient

swagger_example
Fabien Benetou 2 years ago
parent d793d0c847
commit 1c8faf91db
  1. 8
      index.html

@ -2294,19 +2294,19 @@ function addDropZone(position="0 1.4 -0.6", callback=setFeedbackHUD, radius=0.11
return el return el
} }
var swaggerclient // global scope to play with it from the console or in jxr
AFRAME.registerComponent('issues-from-swagger', { AFRAME.registerComponent('issues-from-swagger', {
init:function(){ init:function(){
let generatorName = this.attrName let generatorName = this.attrName
var specUrl = 'swagger.v1.json' // from 'https://git.benetou.fr/swagger.v1.json' but copied to bypass CORS let specUrl = 'swagger.v1.json' // from 'https://git.benetou.fr/swagger.v1.json' but copied to bypass CORS
var swaggerClient = new SwaggerClient(specUrl) let swaggerClient = new SwaggerClient(specUrl)
.then(function (swaggerClient) { .then(function (swaggerClient) {
myclient = swaggerClient swaggerclient = swaggerClient
return swaggerClient.apis.issue.issueListIssues({owner: "utopiah", repo: "text-code-xr-engine"}) return swaggerClient.apis.issue.issueListIssues({owner: "utopiah", repo: "text-code-xr-engine"})
}, function (reason) { }, function (reason) {
console.error("failed to load the spec" + reason) console.error("failed to load the spec" + reason)
}) })
.then(function(issuesResult) { .then(function(issuesResult) {
console.log(issuesResult.obj)
res = issuesResult.obj res = issuesResult.obj
res.slice(0,maxItemsFromSources).map( (n,i) => addNewNote( n.title, "0 "+(1+i/10)+" -1.8", ".1 .1 .1", null, generatorName ) ) res.slice(0,maxItemsFromSources).map( (n,i) => addNewNote( n.title, "0 "+(1+i/10)+" -1.8", ".1 .1 .1", null, generatorName ) )
}, function (reason) { }, function (reason) {

Loading…
Cancel
Save