From a4244a63f5d3b7b9b04fd09bbe58cdda5836d09e Mon Sep 17 00:00:00 2001 From: "Mike P. Sinn" Date: Thu, 12 Dec 2019 20:59:05 -0600 Subject: [PATCH] docs --- .gitignore | 59 ++++++++++++++++++++++++----------------------- gulpfile.js | 32 +++++++++++++++++++++---- index.html | 1 + package-lock.json | 39 +++++++++++++++++++++++++++++++ package.json | 2 ++ 5 files changed, 100 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index c6f1974..6389465 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,30 @@ - -scripts/quantimodo_v1_skds\.zip -silex-PHP-server-generated/ -slim-server-generated/ -*.zip - -slim-server-generated\.zip - -silex-PHP-server-generated/SwaggerServer/ - - -/.idea/* -!/.idea/dictionaries/ -!/.idea/dictionaries/* - -node_modules/ -sdks-unzipped/ - -sdk-repos/ -*.exe -swagger/example-post-bodies/ -swagger/example-response-bodies/ - -npm-debug\.log -responses/*.json -codegen/ -oax/ -swagger-ui/ -/swagger-codegen-cli* + +scripts/quantimodo_v1_skds\.zip +silex-PHP-server-generated/ +slim-server-generated/ +*.zip + +slim-server-generated\.zip + +silex-PHP-server-generated/SwaggerServer/ + + +/.idea/* +!/.idea/dictionaries/ +!/.idea/dictionaries/* + +node_modules/ +sdks-unzipped/ + +sdk-repos/ +*.exe +swagger/example-post-bodies/ +swagger/example-response-bodies/ + +npm-debug\.log +responses/*.json +codegen/ +oax/ +swagger-ui/ +/swagger-codegen-cli* +tmp \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 7f5b638..942088d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -201,9 +201,14 @@ function getZipPathForLanguage(language) { return path.resolve(sdksZippedRelativePath + '/' + getSdkNameForLanguage(language) + '.zip'); } function writeToFile(filePath, stringContents, callback) { + var mkdirp = require('mkdirp'); + var fs = require('fs'); + var getDirName = require('path').dirname; logDebug("Writing to " + filePath); - if(typeof stringContents !== "string"){stringContents = JSON.stringify(stringContents);} - return fs.writeFile(filePath, stringContents, {}, callback); + mkdirp(getDirName(filePath), function (err) { + if(typeof stringContents !== "string"){stringContents = JSON.stringify(stringContents);} + return fs.writeFile(filePath, stringContents, {}, callback); + }); } function getSdkNameForLanguage(languageName) { return 'quantimodo-sdk-' + languageName; @@ -876,7 +881,7 @@ gulp.task('JS-SDK-UPDATE', function(callback){ }); }); function downloadAndExtractJavascriptClient(language, cb){ - let jsSdkFolder = getRepoRelativePathForSdkLanguage('javascript'); + let jsSdkFolder = getRepoRelativePathForSdkLanguage(language); let clientFolder = jsSdkFolder+'/' + language + '-client'; const rimraf = require('rimraf') rimraf(clientFolder, function(){ @@ -925,7 +930,7 @@ function executeSynchronously(cmd, catchExceptions, cb){ function generateLocally(language, options){ executeSynchronously(`java -jar ${jar} generate -i swagger/swagger.json -l ${language} -o sdks-unzipped/${language} ${options}`) } -gulp.task('js-node-angular-react-typescript', function(cb){ +gulp.task('_typescript', function(cb){ downloadAndExtractJavascriptClient('typescript-node', function(){ downloadAndExtractJavascriptClient('typescript-angular', function(){ downloadAndExtractJavascriptClient('typescript-angularjs', function(){ @@ -934,4 +939,23 @@ gulp.task('js-node-angular-react-typescript', function(cb){ }); }); //return downloadSdk('typescript-node', true); +}); +gulp.task('_typescript-fetch', function(cb){ + downloadAndExtractJavascriptClient('typescript-fetch', cb); +}); + +gulp.task('upload-file', function(cb){ + var tsClient = require('./sdk-repos/quantimodo-sdk-typescript-fetch/typescript-fetch-client'); + var time = Math.floor(Date.now() / 1000); + var filePath = "./tmp/test-files/"+time + writeToFile(filePath, time, function(){ + var data = fs.readFileSync(filePath); + var config = new tsClient.Configuration({accessToken: "demo"}); + var FileApi = new tsClient.FileApi(config); + FileApi.postFile(data, "note", {accessToke: "demo"}).then(function(res){ + FileApi.getFile(1, time, "demo",{accessToke: "demo"}).then(function(res){ + console.log(res) + }) + }) + }); }); \ No newline at end of file diff --git a/index.html b/index.html index 26fc73a..07179d3 100644 --- a/index.html +++ b/index.html @@ -63,6 +63,7 @@ url = document.location.origin + "/api/docs/swagger/swagger.json?access_token=demo"; } if(window.location.host === "docs.quantimo.do"){url = "https://docs.quantimo.do/swagger/swagger.json?access_token=demo"} + if(window.location.host === "dev-docs.quantimo.do"){url = "https://dev-docs.quantimo.do/swagger/swagger.json?access_token=demo"} window.ui = SwaggerUIBundle({ url: url, dom_id: '#swagger-ui', diff --git a/package-lock.json b/package-lock.json index f09465c..bd8932e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1140,6 +1140,14 @@ } } }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "requires": { + "iconv-lite": "~0.4.13" + } + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -2314,6 +2322,14 @@ "sshpk": "^1.7.0" } }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "ieee754": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", @@ -3062,6 +3078,15 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" }, + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "requires": { + "encoding": "^0.1.11", + "is-stream": "^1.0.1" + } + }, "node-fingerprint": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/node-fingerprint/-/node-fingerprint-0.0.2.tgz", @@ -3381,6 +3406,15 @@ "extend-shallow": "^3.0.2" } }, + "portable-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/portable-fetch/-/portable-fetch-3.0.0.tgz", + "integrity": "sha1-PL9KptvFpXNLQcBBnJJzMTv9mtg=", + "requires": { + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" + } + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -4818,6 +4852,11 @@ "foreachasync": "^3.0.0" } }, + "whatwg-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index 943d826..491a093 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "gulp-ignore": "latest", "gulp-rename": "latest", "gulp-unzip": "latest", + "mkdirp": "^0.5.1", + "portable-fetch": "^3.0.0", "q": "^1.4.1", "quantimodo": "5.11.111615", "request-promise": "latest",