diff --git a/.gitignore b/.gitignore index 8cc98ef5e5b..396ec1b735f 100644 --- a/.gitignore +++ b/.gitignore @@ -157,7 +157,8 @@ samples/client/petstore/typescript-node/npm/node_modules samples/client/petstore/typescript-node/**/typings samples/client/petstore/typescript-angular/**/typings samples/client/petstore/typescript-fetch/**/dist/ -samples/client/petstore/typescript-fetch/**/typings +samples/client/petstore/typescript-fetch/**/npm-debug.log +samples/client/petstore/typescript-fetch/**/node_modules/ samples/client/petstore/typescript-angular2/npm/npm-debug.log samples/client/petstore/typescript-node/npm/npm-debug.log diff --git a/.travis.yml b/.travis.yml index b1880348c76..f533859c220 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,9 @@ cache: - $HOME/samples/client/petstore/python/.venv/ - $HOME/samples/client/petstore/typescript-node/npm/node_modules - $HOME/samples/client/petstore/typescript-node/npm/typings/ - - $HOME/samples/client/petstore/typescript-fetch/tests/default/node_modules - - $HOME/samples/client/petstore/typescript-fetch/tests/default/typings - - $HOME/samples/client/petstore/typescript-fetch/builds/default/node_modules - - $HOME/samples/client/petstore/typescript-fetch/builds/default/typings - - $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/node_modules - - $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/typings - - $HOME/samples/client/petstore/typescript-fetch/builds/with-npm-version/node_modules - - $HOME/samples/client/petstore/typescript-fetch/npm/with-npm-version/typings + - $HOME/samples/client/petstore/typescript-fetch/builds/es6/node_modules + - $HOME/samples/client/petstore/typescript-fetch/builds/npm/node_modules + - $HOME/samples/client/petstore/typescript-fetch/tests/npm/node_modules - $HOME/samples/client/petstore/typescript-angular/node_modules - $HOME/samples/client/petstore/typescript-angular/typings - $HOME/.cocoapods/repos/master diff --git a/bin/jaxrs-resteasy-eap-java8-petstore-server.sh b/bin/jaxrs-resteasy-eap-java8-petstore-server.sh old mode 100755 new mode 100644 diff --git a/bin/swift3-petstore-unwraprequired.sh b/bin/swift3-petstore-unwraprequired.sh old mode 100755 new mode 100644 diff --git a/bin/typescript-angular4-petstore-with-npm.sh b/bin/typescript-angular4-petstore-with-npm.sh old mode 100755 new mode 100644 diff --git a/bin/typescript-fetch-petstore-all.sh b/bin/typescript-fetch-petstore-all.sh deleted file mode 100755 index 6365b9032a6..00000000000 --- a/bin/typescript-fetch-petstore-all.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./bin/typescript-fetch-petstore-target-es6.sh -./bin/typescript-fetch-petstore-with-npm-version.sh -./bin/typescript-fetch-petstore.sh diff --git a/bin/typescript-fetch-petstore-target-es6.sh b/bin/typescript-fetch-petstore-default.sh old mode 100755 new mode 100644 similarity index 82% rename from bin/typescript-fetch-petstore-target-es6.sh rename to bin/typescript-fetch-petstore-default.sh index 391859c4d4b..4c7fef3c1c2 --- a/bin/typescript-fetch-petstore-target-es6.sh +++ b/bin/typescript-fetch-petstore-default.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-fetch -c bin/typescript-fetch-petstore-target-es6.json -o samples/client/petstore/typescript-fetch/builds/es6-target" + +echo "Typescript-Fetch Petstore API client (default)" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -o samples/client/petstore/typescript-fetch/builds/default" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-es6.json b/bin/typescript-fetch-petstore-es6.json new file mode 100644 index 00000000000..b341515be1b --- /dev/null +++ b/bin/typescript-fetch-petstore-es6.json @@ -0,0 +1,7 @@ +{ + "npmName": "@swagger/typescript-fetch-petstore", + "npmVersion": "0.0.1", + "npmRepository" : "https://skimdb.npmjs.com/registry", + "snapshot" : false, + "supportsES6": true +} diff --git a/bin/typescript-fetch-petstore-with-npm-version.sh b/bin/typescript-fetch-petstore-es6.sh old mode 100755 new mode 100644 similarity index 79% rename from bin/typescript-fetch-petstore-with-npm-version.sh rename to bin/typescript-fetch-petstore-es6.sh index 7d5706f657e..9035e157024 --- a/bin/typescript-fetch-petstore-with-npm-version.sh +++ b/bin/typescript-fetch-petstore-es6.sh @@ -26,6 +26,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-fetch -c bin/typescript-fetch-petstore-with-npm-version.json -o samples/client/petstore/typescript-fetch/builds/with-npm-version" + +echo "Typescript-Fetch Petstore API client (ES6)" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -c bin/typescript-fetch-petstore-es6.json -o samples/client/petstore/typescript-fetch/builds/es6" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-npm.json b/bin/typescript-fetch-petstore-npm.json new file mode 100644 index 00000000000..141e376d408 --- /dev/null +++ b/bin/typescript-fetch-petstore-npm.json @@ -0,0 +1,6 @@ +{ + "npmName": "@swagger/typescript-fetch-petstore", + "npmVersion": "0.0.1", + "npmRepository" : "https://skimdb.npmjs.com/registry", + "snapshot" : false +} diff --git a/bin/typescript-fetch-petstore-npm.sh b/bin/typescript-fetch-petstore-npm.sh new file mode 100644 index 00000000000..08af3fc702f --- /dev/null +++ b/bin/typescript-fetch-petstore-npm.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" + +echo "Typescript-Fetch Petstore API client (NPM version)" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-fetch -c bin/typescript-fetch-petstore-npm.json -o samples/client/petstore/typescript-fetch/builds/npm" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-target-es6.json b/bin/typescript-fetch-petstore-target-es6.json deleted file mode 100644 index 83914bd569c..00000000000 --- a/bin/typescript-fetch-petstore-target-es6.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "supportsES6": true -} diff --git a/bin/typescript-fetch-petstore-with-npm-version.json b/bin/typescript-fetch-petstore-with-npm-version.json deleted file mode 100644 index b8193c8fa74..00000000000 --- a/bin/typescript-fetch-petstore-with-npm-version.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "npmName": "@swagger/typescript-fetch-petstore", - "npmVersion": "0.0.1" -} diff --git a/bin/typescript-fetch-petstore.sh b/bin/typescript-fetch-petstore.sh index 241258c4071..30963fc4691 100755 --- a/bin/typescript-fetch-petstore.sh +++ b/bin/typescript-fetch-petstore.sh @@ -1,31 +1,6 @@ #!/bin/sh -SCRIPT="$0" +./bin/typescript-fetch-petstore-default.sh +./bin/typescript-fetch-petstore-es6.sh +./bin/typescript-fetch-petstore-npm.sh -while [ -h "$SCRIPT" ] ; do - ls=`ls -ld "$SCRIPT"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - SCRIPT="$link" - else - SCRIPT=`dirname "$SCRIPT"`/"$link" - fi -done - -if [ ! -d "${APP_DIR}" ]; then - APP_DIR=`dirname "$SCRIPT"`/.. - APP_DIR=`cd "${APP_DIR}"; pwd` -fi - -executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" - -if [ ! -f "$executable" ] -then - mvn clean package -fi - -# if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-fetch -o samples/client/petstore/typescript-fetch/builds/default" - -java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/python2-flask-petstore.bat b/bin/windows/python2-flask-petstore.bat old mode 100755 new mode 100644 diff --git a/bin/windows/python3-flask-petstore.bat b/bin/windows/python3-flask-petstore.bat old mode 100755 new mode 100644 diff --git a/bin/windows/typescript-angular2-petstore-all.bat b/bin/windows/typescript-angular2-petstore-all.bat old mode 100755 new mode 100644 diff --git a/bin/windows/typescript-fetch.bat b/bin/windows/typescript-fetch-petstore-default.bat old mode 100755 new mode 100644 similarity index 78% rename from bin/windows/typescript-fetch.bat rename to bin/windows/typescript-fetch-petstore-default.bat index a2b45b39901..80f036b4bfe --- a/bin/windows/typescript-fetch.bat +++ b/bin/windows/typescript-fetch-petstore-default.bat @@ -1,3 +1,4 @@ +@ECHO OFF set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar If Not Exist %executable% ( @@ -5,6 +6,8 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -o samples\client\petstore\typescript-fetch + +echo Typescript-Fetch Petstore API client (default) +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -o samples\client\petstore\typescript-fetch\builds\default java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore-es6.bat b/bin/windows/typescript-fetch-petstore-es6.bat new file mode 100644 index 00000000000..a87850e5dcc --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-es6.bat @@ -0,0 +1,13 @@ +@ECHO OFF +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M + +echo Typescript-Fetch Petstore API client (ES6) +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -c bin\typescript-fetch-petstore-es6.json -o samples\client\petstore\typescript-fetch\builds\es6 + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore-npm.bat b/bin/windows/typescript-fetch-petstore-npm.bat new file mode 100644 index 00000000000..25b6188bc16 --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-npm.bat @@ -0,0 +1,13 @@ +@ECHO OFF +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M + +echo Typescript-Fetch Petstore API client (NPM version) +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l typescript-fetch -c bin/typescript-fetch-petstore-npm.json -o samples\client\petstore\typescript-fetch\builds\npm + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore-tsoa.bat b/bin/windows/typescript-fetch-petstore-tsoa.bat new file mode 100644 index 00000000000..64ff1dc67f3 --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-tsoa.bat @@ -0,0 +1,13 @@ +@ECHO OFF +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M + +echo Typescript-Fetch Petstore API client (NPM version) +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\swagger.json -l typescript-fetch -c bin/typescript-fetch-petstore-npm.json -o samples\client\petstore\typescript-fetch\tsoa + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore.bat b/bin/windows/typescript-fetch-petstore.bat new file mode 100644 index 00000000000..80ab7ef7507 --- /dev/null +++ b/bin/windows/typescript-fetch-petstore.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +call bin\windows\typescript-fetch-petstore-default.bat +call bin\windows\typescript-fetch-petstore-es6.bat +call bin\windows\typescript-fetch-petstore-npm.bat \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java index a5a3470fdc3..4cbeb942221 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptFetchClientCodegen.java @@ -1,22 +1,37 @@ package io.swagger.codegen.languages; -import io.swagger.codegen.CliOption; -import io.swagger.codegen.CodegenModel; -import io.swagger.codegen.CodegenProperty; -import io.swagger.codegen.SupportingFile; - import java.io.File; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.TreeSet; +import io.swagger.codegen.CliOption; +import io.swagger.codegen.CodegenModel; +import io.swagger.codegen.CodegenOperation; +import io.swagger.codegen.SupportingFile; +import io.swagger.models.ModelImpl; +import io.swagger.models.properties.RefProperty; +import io.swagger.models.properties.ArrayProperty; +import io.swagger.models.properties.BooleanProperty; +import io.swagger.models.properties.FileProperty; +import io.swagger.models.properties.MapProperty; +import io.swagger.models.properties.ObjectProperty; +import io.swagger.models.properties.Property; +import sun.rmi.runtime.Log; + public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodegen { + private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm"); public static final String NPM_NAME = "npmName"; public static final String NPM_VERSION = "npmVersion"; + public static final String NPM_REPOSITORY = "npmRepository"; + public static final String SNAPSHOT = "snapshot"; protected String npmName = null; protected String npmVersion = "1.0.0"; + protected String npmRepository = null; public TypeScriptFetchClientCodegen() { super(); @@ -29,21 +44,27 @@ public TypeScriptFetchClientCodegen() { embeddedTemplateDir = templateDir = "TypeScript-Fetch"; this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); + this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); + this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); + } + + @Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { + codegenModel.additionalPropertiesType = getTypeDeclaration(swaggerModel.getAdditionalProperties()); + addImport(codegenModel, codegenModel.additionalPropertiesType); } @Override public void processOpts() { super.processOpts(); supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts")); - supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); - supportingFiles.add(new SupportingFile("README.md", "", "README.md")); - supportingFiles.add(new SupportingFile("package.json.mustache", "", "package.json")); - supportingFiles.add(new SupportingFile("typings.json.mustache", "", "typings.json")); - supportingFiles.add(new SupportingFile("tsconfig.json.mustache", "", "tsconfig.json")); - supportingFiles.add(new SupportingFile("tslint.json.mustache", "", "tslint.json")); - supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + if(additionalProperties.containsKey(NPM_NAME)) { + addNpmPackageGeneration(); + } + } supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts")); + private void addNpmPackageGeneration() { if(additionalProperties.containsKey(NPM_NAME)) { this.setNpmName(additionalProperties.get(NPM_NAME).toString()); } @@ -51,6 +72,39 @@ public void processOpts() { if (additionalProperties.containsKey(NPM_VERSION)) { this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); } + + if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) { + this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date())); + } + additionalProperties.put(NPM_VERSION, npmVersion); + + if (additionalProperties.containsKey(NPM_REPOSITORY)) { + this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); + } + + //Files for building our lib + supportingFiles.add(new SupportingFile("README.md.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("package.json.mustache", "", "package.json")); + supportingFiles.add(new SupportingFile("tsconfig.json.mustache", "", "tsconfig.json")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + } + + @Override + public String getTypeDeclaration(Property p) { + if (p instanceof ArrayProperty) { + ArrayProperty ap = (ArrayProperty) p; + Property inner = ap.getItems(); + return this.getSwaggerType(p) + "<" + this.getTypeDeclaration(inner) + ">"; + } else if (p instanceof MapProperty) { + MapProperty mp = (MapProperty) p; + Property inner = mp.getAdditionalProperties(); + return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; + } else if (p instanceof FileProperty || p instanceof ObjectProperty) { + return "any"; + } else { + return super.getTypeDeclaration(p); + } } @Override @@ -79,24 +133,11 @@ public void setNpmVersion(String npmVersion) { this.npmVersion = npmVersion; } - @Override - public Map postProcessModels(Map objs) { - // process enum in models - List models = (List) postProcessModelsEnum(objs).get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - cm.imports = new TreeSet(cm.imports); - for (CodegenProperty var : cm.vars) { - // name enum with model name, e.g. StatuEnum => PetStatusEnum - if (Boolean.TRUE.equals(var.isEnum)) { - var.datatypeWithEnum = var.datatypeWithEnum.replace(var.enumName, cm.classname + var.enumName); - var.enumName = cm.classname + var.enumName; - } - } - } - - return objs; + public String getNpmRepository() { + return npmRepository; } + public void setNpmRepository(String npmRepository) { + this.npmRepository = npmRepository; + } } diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md deleted file mode 100644 index 664e1755933..00000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# TypeScript-Fetch - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Installation ### - -`swagger-codegen` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`. - -CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`. - -#### NPM #### -You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). - -You can also use `npm link` to link the module. However, this would not modify `package.json` of the installing project, as such you would need to relink every time you deploy that project. - -You can also directly install the module using `npm install file_path`. If you do `npm install file_path --save`, NPM will save relative path to `package.json`. In this case, `npm install` and `npm shrinkwrap` may misbehave. You would need to manually edit `package.json` and replace it with absolute path. - -Regardless of which method you deployed your NPM module, the ES6 module syntaxes are as follows: -``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); -``` - -#### Direct copy/symlink #### -You may also simply copy or symlink the generated module into a directory under your project. The syntax of this is as follows: - -With ES6 module syntax, the following syntaxes are supported: -``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; -``` diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md.mustache new file mode 100644 index 00000000000..edc73942542 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/README.md.mustache @@ -0,0 +1,45 @@ +## {{npmName}}@{{npmVersion}} + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build an compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### publishing + +First build the package than run ```npm publish``` + +### consuming + +navigate to the folder of your consuming project and run one of next commando's. + +_published:_ + +``` +npm install {{npmName}}@{{npmVersion}} --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache index deb227d02fd..a1fa7faee07 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache @@ -1,71 +1,59 @@ +// tslint:disable {{>licenseInfo}} -import * as querystring from "querystring"; -import * as url from "url"; -import * as isomorphicFetch from "isomorphic-fetch"; -{{^supportsES6}} -import * as assign from "core-js/library/fn/object/assign"; -{{/supportsES6}} - -import { Configuration } from "./configuration"; - -interface Dictionary { [index: string]: T; } -export interface FetchAPI { (url: string, init?: any): Promise; } +import * as url from "url"; +import * as isomorphicFetch from "isomorphic-fetch"; const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); +/** + * + * @export + * @interface FetchAPI + */ +export interface FetchAPI { + (url: string, init?: any): Promise; +} + +/** + * + * @export + * @interface FetchArgs + */ export interface FetchArgs { url: string; options: any; } +/** + * + * @export + * @class BaseAPI + */ export class BaseAPI { - basePath: string; - fetch: FetchAPI; - public configuration: Configuration; - - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(public basePath: string = BASE_PATH, public fetch: FetchAPI = isomorphicFetch) { } }; -{{#models}} -{{#model}} -{{#description}} /** - * {{{description}}} + * + * @export + * @class RequiredError + * @extends {Error} */ -{{/description}} -{{^isEnum}} -export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ -{{/isEnum}} -{{#isEnum}} -export type {{{classname}}} = {{#allowableValues}}{{#values}}"{{{.}}}"{{^-last}} | {{/-last}}{{/values}}{{/allowableValues}}; -{{/isEnum}} -{{#vars}} -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - "{{name}}"{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; -{{/vars}} -{{^isEnum}} +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } } -{{/isEnum}} - -{{#hasEnums}} -{{#vars}} -{{#isEnum}} -export type {{{enumName}}} = {{#allowableValues}}{{#values}}"{{{.}}}"{{^-last}} | {{/-last}}{{/values}}{{/allowableValues}}; -{{/isEnum}} -{{/vars}} -{{/hasEnums}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}} {{/model}} -{{/models}} +{{/models}} {{#apiInfo}} {{#apis}} {{#operations}} @@ -82,94 +70,117 @@ export const {{classname}}FetchParamCreator = { * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{paramName}} {{description}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - {{nickname}}({{#hasParams}}params: { {{#allParams}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}{{#hasAuthMethods}}configuration: Configuration, {{/hasAuthMethods}}options: any = {}): FetchArgs { + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): FetchArgs { {{#allParams}} {{#required}} - // verify required parameter "{{paramName}}" is set - if (params["{{paramName}}"] == null) { - throw new Error("Missing required parameter {{paramName}} when calling {{nickname}}"); + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); } {{/required}} {{/allParams}} - const baseUrl = `{{{path}}}`{{#pathParams}} - .replace(`{${"{{baseName}}"}}`, `${ params["{{paramName}}"] }`){{/pathParams}}; - let urlObj = url.parse(baseUrl, true); + const path = `{{{path}}}`{{#pathParams}} + .replace(`{${"{{baseName}}"}}`, String({{paramName}})){{/pathParams}}; + const urlObj = url.parse(path, true); + const headers = {} as any; {{#hasQueryParams}} - urlObj.query = {{#supportsES6}}Object.{{/supportsES6}}assign({}, urlObj.query, { - {{#queryParams}} - "{{baseName}}": params["{{paramName}}"], - {{/queryParams}} - }); + const queryParameters = {} as any; {{/hasQueryParams}} - let fetchOptions: RequestInit = {{#supportsES6}}Object.{{/supportsES6}}assign({}, { method: "{{httpMethod}}" }, options); - - let contentTypeHeader: Dictionary = {}; {{#hasFormParams}} - contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; - fetchOptions.body = querystring.stringify({ - {{#formParams}} - "{{baseName}}": params["{{paramName}}"], - {{/formParams}} - }); + const formParams = new url.URLSearchParams(); {{/hasFormParams}} -{{#hasBodyParam}} - contentTypeHeader = { "Content-Type": "application/json" };{{#bodyParam}} - if (params["{{paramName}}"]) { - fetchOptions.body = JSON.stringify(params["{{paramName}}"] || {}); - }{{/bodyParam}} -{{/hasBodyParam}} -{{#hasHeaderParams}} - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ - {{#headerParams}}"{{baseName}}": params["{{paramName}}"],{{/headerParams}} - }, contentTypeHeader, fetchOptions.headers); -{{/hasHeaderParams}} -{{^hasHeaderParams}} - if (contentTypeHeader) { - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({}, contentTypeHeader, fetchOptions.headers); + +{{#queryParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + queryParameters['{{baseName}}'] = {{paramName}} as any; + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + queryParameters['{{baseName}}'] = {{paramName}}.join(','); + {{/isCollectionFormatMulti}} } -{{/hasHeaderParams}} -{{#authMethods}} - // authentication ({{name}}) required -{{#isApiKey}} -{{#isKeyInHeader}} - if (configuration.apiKey && configuration.apiKey.{{keyParamName}}) { - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ - "{{keyParamName}}": configuration.apiKey.{{keyParamName}}, - }, contentTypeHeader); + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + {{#isDateTime}} + queryParameters['{{baseName}}'] = ({{paramName}} as any).toISOString(); + {{/isDateTime}} + {{^isDateTime}} + {{#isDate}} + queryParameters['{{baseName}}'] = ({{paramName}} as any).toISOString(); + {{/isDate}} + {{^isDate}} + queryParameters['{{baseName}}'] = {{paramName}} as any; + {{/isDate}} + {{/isDateTime}} } -{{/isKeyInHeader}} -{{#isKeyInQuery}} - if (configuration.apiKey && configuration.apiKey.{{keyParamName}}) { - urlObj.query = {{#supportsES6}}Object.{{/supportsES6}}assign({}, urlObj.query, { - "{{keyParamName}}": configuration.apiKey.{{keyParamName}}, - }); + {{/isListContainer}} +{{/queryParams}} +{{#hasQueryParams}} + urlObj.query = Object.assign({}, urlObj.query, queryParameters); +{{/hasQueryParams}} +{{#headerParams}} + {{#isListContainer}} + if ({{paramName}}) { + headers['{{baseName}}'] = {{paramName}}.join(','); } -{{/isKeyInQuery}} -{{/isApiKey}} -{{#isBasic}} - // http basic authentication required - if (configuration.username || configuration.password) { - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ - "Authorization": "Basic " + btoa(configuration.username + ":" + configuration.password), - }, contentTypeHeader); + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + headers['{{baseName}}'] = String({{paramName}}); } -{{/isBasic}} -{{#isOAuth}} - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + {{/isListContainer}} +{{/headerParams}} +{{#formParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + formParams.append('{{baseName}}', element); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + formParams.set('{{baseName}}', {{paramName}}.join(',')); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + formParams.set('{{baseName}}', {{paramName}}); + } + {{/isListContainer}} + +{{/formParams}} +{{#hasFormParams}} + headers['Content-Type'] = 'application/x-www-form-urlencoded'; +{{/hasFormParams}} +{{#bodyParam}} + headers['Content-Type'] = 'application/json'; +{{/bodyParam}} + + let requestOptions = { + method: '{{httpMethod}}', + headers: headers, +{{#bodyParam}} + body: {{paramName}} === null ? '' : JSON.stringify({{paramName}}), +{{/bodyParam}} +{{#hasFormParams}} + body: formParams.toString(), +{{/hasFormParams}} + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } -{{/isOAuth}} -{{/authMethods}} return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, {{/operation}} @@ -177,7 +188,7 @@ export const {{classname}}FetchParamCreator = { /** * {{classname}} - functional programming interface{{#description}} - * {{&description}}{{/description}} + * {{{description}}}{{/description}} */ export const {{classname}}Fp = { {{#operation}} @@ -187,11 +198,13 @@ export const {{classname}}Fp = { * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{paramName}} {{description}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - {{nickname}}({{#hasParams}}params: { {{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} }, {{/hasParams}}{{#hasAuthMethods}}configuration: Configuration, {{/hasAuthMethods}}options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> { - const fetchArgs = {{classname}}FetchParamCreator.{{nickname}}({{#hasParams}}params, {{/hasParams}}{{#hasAuthMethods}}configuration, {{/hasAuthMethods}}options); + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> { + const fetchArgs = {{classname}}FetchParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -207,7 +220,10 @@ export const {{classname}}Fp = { /** * {{classname}} - object-oriented interface{{#description}} - * {{&description}}{{/description}} + * {{{description}}}{{/description}} + * @export + * @class {{classname}} + * @extends {BaseAPI} */ export class {{classname}} extends BaseAPI { {{#operation}} @@ -217,11 +233,14 @@ export class {{classname}} extends BaseAPI { * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{paramName}} {{description}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}} */ - {{nickname}}({{#hasParams}}params: { {{#allParams}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}options: any = {}) { - return {{classname}}Fp.{{nickname}}({{#hasParams}}params, {{/hasParams}}{{#hasAuthMethods}}this.configuration, {{/hasAuthMethods}}options)(this.fetch, this.basePath); + public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { + return {{classname}}Fp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.fetch, this.basePath); } {{/operation}} }; @@ -239,11 +258,13 @@ export const {{classname}}Factory = function (fetch?: FetchAPI, basePath?: strin * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{paramName}} {{description}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - {{nickname}}({{#hasParams}}params: { {{#allParams}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}{{#hasAuthMethods}}configuration: Configuration, {{/hasAuthMethods}}options: any = {}) { - return {{classname}}Fp.{{nickname}}({{#hasParams}}params, {{/hasParams}}{{#hasAuthMethods}}configuration, {{/hasAuthMethods}}options)(fetch, basePath); + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { + return {{classname}}Fp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(fetch, basePath); }, {{/operation}} }; @@ -251,4 +272,4 @@ export const {{classname}}Factory = function (fetch?: FetchAPI, basePath?: strin {{/operations}} {{/apis}} -{{/apiInfo}} +{{/apiInfo}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/modelEnum.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/modelEnum.mustache new file mode 100644 index 00000000000..dca2746d79b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/modelEnum.mustache @@ -0,0 +1,12 @@ +/** + * {{{description}}} + * @export + * @enum {string} + */ +export enum {{classname}} { +{{#allowableValues}} +{{#enumVars}} + {{{name}}} = {{{value}}}{{^-last}},{{/-last}} +{{/enumVars}} +{{/allowableValues}} +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/modelGeneric.mustache new file mode 100644 index 00000000000..b1937f66c86 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/modelGeneric.mustache @@ -0,0 +1,41 @@ +/** + * {{{description}}} + * @export + * @interface {{classname}} + */ +export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#additionalPropertiesType}} + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + +{{/additionalPropertiesType}} +{{#vars}} + /** + * {{{description}}} + * @type {{=<% %>=}}{<%datatype%>}<%={{ }}=%> + * @memberof {{classname}} + */ + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; +{{/vars}} +}{{#hasEnums}} + +/** + * @export + * @namespace {{classname}} + */ +export namespace {{classname}} { +{{#vars}} + {{#isEnum}} + /** + * @export + * @enum {string} + */ + export enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + } + {{/isEnum}} +{{/vars}} +}{{/hasEnums}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache index 05aec69d7ec..46d99b4c92f 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache @@ -1,21 +1,32 @@ { - "name": "{{#npmName}}{{{npmName}}}{{/npmName}}{{^npmName}}typescript-fetch-api{{/npmName}}", - "version": "{{#npmVersion}}{{{npmVersion}}}{{/npmVersion}}{{^npmVersion}}0.0.0{{/npmVersion}}", + "name": "{{npmName}}", + "version": "{{npmVersion}}", + "description": "swagger client for {{npmName}}", + "author": "Swagger Codegen Contributors", + "keywords": [ + "fetch", + "typescript", + "swagger-client", + "{{npmName}}" + ], "license": "Unlicense", "main": "./dist/api.js", - "browser": "./dist/api.js", "typings": "./dist/api.d.ts", - "dependencies": { - {{^supportsES6}}"core-js": "^2.4.0", - {{/supportsES6}}"isomorphic-fetch": "^2.2.1" - }, "scripts" : { - "prepublish" : "typings install && tsc", - "test": "tslint api.ts" + "build": "tsc --outDir dist/", + "postinstall": "npm run build" + }, + "dependencies": { + "isomorphic-fetch": "^2.2.1", + "@types/isomorphic-fetch": "0.0.33", + "@types/node": "^8.0.9" }, "devDependencies": { - "tslint": "^3.15.1", - "typescript": "^1.8.10", - "typings": "^1.0.4" + "typescript": "^2.0" + }{{#npmRepository}},{{/npmRepository}} +{{#npmRepository}} + "publishConfig":{ + "registry":"{{npmRepository}}" } +{{/npmRepository}} } diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache index 25f414e9840..347fffb1288 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache @@ -5,13 +5,14 @@ "module": "commonjs", "noImplicitAny": true, "outDir": "dist", - "rootDir": "." + "rootDir": "."{{^supportsES6}}, + "lib": [ + "es6" + ] + {{/supportsES6}} }, "exclude": [ "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" + "node_modules" ] } diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tslint.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tslint.json.mustache deleted file mode 100644 index 6eb02acec8c..00000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tslint.json.mustache +++ /dev/null @@ -1,101 +0,0 @@ -{ - "jsRules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - }, - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache deleted file mode 100644 index e5bd78f06fe..00000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/typings.json.mustache +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": false, - "dependencies": {}, - "globalDependencies": { {{^supportsES6}} - "core-js": "registry:dt/core-js#0.0.0+20160317120654",{{/supportsES6}} - "node": "registry:dt/node#4.0.0+20160423143914", - "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" - } -} diff --git a/modules/swagger-codegen/src/main/resources/tizen/generateDocumentation.mustache b/modules/swagger-codegen/src/main/resources/tizen/generateDocumentation.mustache old mode 100755 new mode 100644 diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java index f7c222c1e06..014a1b12cb7 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -13,6 +13,7 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase"; private static final String NMP_NAME = "npmName"; private static final String NMP_VERSION = "1.0.0"; + private static final String NPM_REPOSITORY = "https://registry.npmjs.org"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; @@ -30,6 +31,8 @@ public Map createOptions() { .put(CodegenConstants.SUPPORTS_ES6, String.valueOf(SUPPORTS_ES6_VALUE)) .put(TypeScriptFetchClientCodegen.NPM_NAME, NMP_NAME) .put(TypeScriptFetchClientCodegen.NPM_VERSION, NMP_VERSION) + .put(TypeScriptFetchClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) + .put(TypeScriptFetchClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .build(); } diff --git a/pom.xml b/pom.xml index 5504ecaab2d..0bd87bdaaa2 100644 --- a/pom.xml +++ b/pom.xml @@ -613,7 +613,7 @@ - typescript-fetch-client-tests-default + typescript-fetch-client-tests-npm env @@ -621,23 +621,11 @@ - samples/client/petstore/typescript-fetch/tests/default - - - - typescript-fetch-client-builds-default - - - env - java - - - - samples/client/petstore/typescript-fetch/builds/default + samples/client/petstore/typescript-fetch/tests/npm - typescript-fetch-client-builds-es6-target + typescript-fetch-client-builds-npm env @@ -645,11 +633,11 @@ - samples/client/petstore/typescript-fetch/builds/es6-target + samples/client/petstore/typescript-fetch/builds/npm - typescript-fetch-client-builds-with-npm-version + typescript-fetch-client-builds-es6 env @@ -657,7 +645,7 @@ - samples/client/petstore/typescript-fetch/builds/with-npm-version + samples/client/petstore/typescript-fetch/builds/es6 diff --git a/pom.xml.circleci b/pom.xml.circleci index d6d39e83d81..1549f786cd3 100644 --- a/pom.xml.circleci +++ b/pom.xml.circleci @@ -608,7 +608,7 @@ - typescript-fetch-client-tests-default + typescript-fetch-client-tests-npm env @@ -616,11 +616,11 @@ - samples/client/petstore/typescript-fetch/tests/default + samples/client/petstore/typescript-fetch/tests/npm - typescript-fetch-client-builds-default + typescript-fetch-client-builds-npm env @@ -628,11 +628,11 @@ - samples/client/petstore/typescript-fetch/builds/default + samples/client/petstore/typescript-fetch/builds/npm - typescript-fetch-client-builds-es6-target + typescript-fetch-client-builds-es6 env @@ -640,19 +640,7 @@ - samples/client/petstore/typescript-fetch/builds/es6-target - - - - typescript-fetch-client-builds-with-npm-version - - - env - java - - - - samples/client/petstore/typescript-fetch/builds/with-npm-version + samples/client/petstore/typescript-fetch/builds/es6 diff --git a/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION b/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION new file mode 100644 index 00000000000..6b4d1577382 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3 \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-fetch/LICENSE b/samples/client/petstore-security-test/typescript-fetch/LICENSE deleted file mode 100644 index 8dada3edaf5..00000000000 --- a/samples/client/petstore-security-test/typescript-fetch/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/samples/client/petstore-security-test/typescript-fetch/README.md b/samples/client/petstore-security-test/typescript-fetch/README.md deleted file mode 100644 index 664e1755933..00000000000 --- a/samples/client/petstore-security-test/typescript-fetch/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# TypeScript-Fetch - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Installation ### - -`swagger-codegen` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`. - -CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`. - -#### NPM #### -You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). - -You can also use `npm link` to link the module. However, this would not modify `package.json` of the installing project, as such you would need to relink every time you deploy that project. - -You can also directly install the module using `npm install file_path`. If you do `npm install file_path --save`, NPM will save relative path to `package.json`. In this case, `npm install` and `npm shrinkwrap` may misbehave. You would need to manually edit `package.json` and replace it with absolute path. - -Regardless of which method you deployed your NPM module, the ES6 module syntaxes are as follows: -``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); -``` - -#### Direct copy/symlink #### -You may also simply copy or symlink the generated module into a directory under your project. The syntax of this is as follows: - -With ES6 module syntax, the following syntaxes are supported: -``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; -``` diff --git a/samples/client/petstore-security-test/typescript-fetch/api.ts b/samples/client/petstore-security-test/typescript-fetch/api.ts index 4fe998131e6..5c8ff83c2fd 100644 --- a/samples/client/petstore-security-test/typescript-fetch/api.ts +++ b/samples/client/petstore-security-test/typescript-fetch/api.ts @@ -1,3 +1,4 @@ +// tslint:disable /** * Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- @@ -10,73 +11,104 @@ * Do not edit the class manually. */ -import * as querystring from "querystring"; -import * as url from "url"; -import * as isomorphicFetch from "isomorphic-fetch"; -import * as assign from "core-js/library/fn/object/assign"; - -import { Configuration } from "./configuration"; - -interface Dictionary { [index: string]: T; } -export interface FetchAPI { (url: string, init?: any): Promise; } +import * as url from "url"; +import * as isomorphicFetch from "isomorphic-fetch"; const BASE_PATH = "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r".replace(/\/+$/, ""); +/** + * + * @export + * @interface FetchAPI + */ +export interface FetchAPI { + (url: string, init?: any): Promise; +} + +/** + * + * @export + * @interface FetchArgs + */ export interface FetchArgs { url: string; options: any; } +/** + * + * @export + * @class BaseAPI + */ export class BaseAPI { - basePath: string; - fetch: FetchAPI; - public configuration: Configuration; - - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(public basePath: string = BASE_PATH, public fetch: FetchAPI = isomorphicFetch) { } }; +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } +} + /** * Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r + * @export + * @interface ModelReturn */ export interface ModelReturn { /** * property description *_/ ' \" =end -- \\r\\n \\n \\r + * @type {number} + * @memberof ModelReturn */ - "return"?: number; + return?: number; } - /** * FakeApi - fetch parameter creator */ export const FakeApiFetchParamCreator = { - /** - * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + /** + * + * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - testCodeInjectEndRnNR(params: { test code inject * ' " =end rn n r?: string; }, options: any = {}): FetchArgs { - const baseUrl = `/fake`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; - fetchOptions.body = querystring.stringify({ - "test code inject */ ' " =end -- \r\n \n \r": params["test code inject * ' " =end rn n r"], - }); - if (contentTypeHeader) { - fetchOptions.headers = contentTypeHeader; + testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any): FetchArgs { + const path = `/fake`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (test code inject * ' " =end rn n r !== undefined) { + formParams.set('test code inject */ ' " =end -- \r\n \n \r', test code inject * ' " =end rn n r); + } + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, }; @@ -85,12 +117,15 @@ export const FakeApiFetchParamCreator = { * FakeApi - functional programming interface */ export const FakeApiFp = { - /** - * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + /** + * + * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - testCodeInjectEndRnNR(params: { test code inject * ' " =end rn n r?: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = FakeApiFetchParamCreator.testCodeInjectEndRnNR(params, options); + testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = FakeApiFetchParamCreator.testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -105,14 +140,21 @@ export const FakeApiFp = { /** * FakeApi - object-oriented interface + * @export + * @class FakeApi + * @extends {BaseAPI} */ export class FakeApi extends BaseAPI { - /** - * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + /** + * + * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi */ - testCodeInjectEndRnNR(params: { test code inject * ' " =end rn n r?: string; }, options: any = {}) { - return FakeApiFp.testCodeInjectEndRnNR(params, options)(this.fetch, this.basePath); + public testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any) { + return FakeApiFp.testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options)(this.fetch, this.basePath); } }; @@ -121,12 +163,15 @@ export class FakeApi extends BaseAPI { */ export const FakeApiFactory = function (fetch?: FetchAPI, basePath?: string) { return { - /** - * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + /** + * + * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - testCodeInjectEndRnNR(params: { test code inject * ' " =end rn n r?: string; }, options: any = {}) { - return FakeApiFp.testCodeInjectEndRnNR(params, options)(fetch, basePath); + testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any) { + return FakeApiFp.testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options)(fetch, basePath); }, }; }; diff --git a/samples/client/petstore-security-test/typescript-fetch/package.json b/samples/client/petstore-security-test/typescript-fetch/package.json deleted file mode 100644 index 0204e3c39c9..00000000000 --- a/samples/client/petstore-security-test/typescript-fetch/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "typescript-fetch-api", - "version": "0.0.0", - "license": "Unlicense", - "main": "./dist/api.js", - "browser": "./dist/api.js", - "typings": "./dist/api.d.ts", - "dependencies": { - "core-js": "^2.4.0", - "isomorphic-fetch": "^2.2.1" - }, - "scripts" : { - "prepublish" : "typings install && tsc", - "test": "tslint api.ts" - }, - "devDependencies": { - "tslint": "^3.15.1", - "typescript": "^1.8.10", - "typings": "^1.0.4" - } -} diff --git a/samples/client/petstore-security-test/typescript-fetch/tsconfig.json b/samples/client/petstore-security-test/typescript-fetch/tsconfig.json deleted file mode 100644 index 72ff2567206..00000000000 --- a/samples/client/petstore-security-test/typescript-fetch/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "target": "es5", - "module": "commonjs", - "noImplicitAny": true, - "outDir": "dist", - "rootDir": "." - }, - "exclude": [ - "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" - ] -} diff --git a/samples/client/petstore-security-test/typescript-fetch/tslint.json b/samples/client/petstore-security-test/typescript-fetch/tslint.json deleted file mode 100644 index 6eb02acec8c..00000000000 --- a/samples/client/petstore-security-test/typescript-fetch/tslint.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "jsRules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - }, - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/samples/client/petstore-security-test/typescript-fetch/typings.json b/samples/client/petstore-security-test/typescript-fetch/typings.json deleted file mode 100644 index a82ea152b4a..00000000000 --- a/samples/client/petstore-security-test/typescript-fetch/typings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": false, - "dependencies": {}, - "globalDependencies": { - "core-js": "registry:dt/core-js#0.0.0+20160317120654", - "node": "registry:dt/node#4.0.0+20160423143914", - "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/default/README.md b/samples/client/petstore/typescript-fetch/builds/default/README.md deleted file mode 100644 index 664e1755933..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# TypeScript-Fetch - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Installation ### - -`swagger-codegen` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`. - -CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`. - -#### NPM #### -You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). - -You can also use `npm link` to link the module. However, this would not modify `package.json` of the installing project, as such you would need to relink every time you deploy that project. - -You can also directly install the module using `npm install file_path`. If you do `npm install file_path --save`, NPM will save relative path to `package.json`. In this case, `npm install` and `npm shrinkwrap` may misbehave. You would need to manually edit `package.json` and replace it with absolute path. - -Regardless of which method you deployed your NPM module, the ES6 module syntaxes are as follows: -``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); -``` - -#### Direct copy/symlink #### -You may also simply copy or symlink the generated module into a directory under your project. The syntax of this is as follows: - -With ES6 module syntax, the following syntaxes are supported: -``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; -``` diff --git a/samples/client/petstore/typescript-fetch/builds/default/api.ts b/samples/client/petstore/typescript-fetch/builds/default/api.ts index ffd2fc8eccf..0e01c3ca21c 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/api.ts @@ -1,3 +1,4 @@ +// tslint:disable /** * Swagger Petstore * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. @@ -10,112 +11,297 @@ * Do not edit the class manually. */ -import * as querystring from "querystring"; -import * as url from "url"; -import * as isomorphicFetch from "isomorphic-fetch"; -import * as assign from "core-js/library/fn/object/assign"; - -import { Configuration } from "./configuration"; - -interface Dictionary { [index: string]: T; } -export interface FetchAPI { (url: string, init?: any): Promise; } +import * as url from "url"; +import * as isomorphicFetch from "isomorphic-fetch"; const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); +/** + * + * @export + * @interface FetchAPI + */ +export interface FetchAPI { + (url: string, init?: any): Promise; +} + +/** + * + * @export + * @interface FetchArgs + */ export interface FetchArgs { url: string; options: any; } +/** + * + * @export + * @class BaseAPI + */ export class BaseAPI { - basePath: string; - fetch: FetchAPI; - public configuration: Configuration; - - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(public basePath: string = BASE_PATH, public fetch: FetchAPI = isomorphicFetch) { } }; +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } +} + /** * Describes the result of uploading an image resource + * @export + * @interface ApiResponse */ export interface ApiResponse { - "code"?: number; - "type"?: string; - "message"?: string; + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; } /** * A category for a pet + * @export + * @interface Category */ export interface Category { - "id"?: number; - "name"?: string; + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; } /** * An order for a pets from the pet store + * @export + * @interface Order */ export interface Order { - "id"?: number; - "petId"?: number; - "quantity"?: number; - "shipDate"?: Date; + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; /** * Order Status + * @type {string} + * @memberof Order */ - "status"?: OrderStatusEnum; - "complete"?: boolean; + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } } -export type OrderStatusEnum = "placed" | "approved" | "delivered"; /** * A pet for sale in the pet store + * @export + * @interface Pet */ export interface Pet { - "id"?: number; - "category"?: Category; - "name": string; - "photoUrls": Array; - "tags"?: Array; + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array<string>} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array<Tag>} + * @memberof Pet + */ + tags?: Array; /** * pet status in the store + * @type {string} + * @memberof Pet */ - "status"?: PetStatusEnum; + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } } -export type PetStatusEnum = "available" | "pending" | "sold"; /** * A tag for a pet + * @export + * @interface Tag */ export interface Tag { - "id"?: number; - "name"?: string; + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; } /** * A User who is purchasing from the pet store + * @export + * @interface User */ export interface User { - "id"?: number; - "username"?: string; - "firstName"?: string; - "lastName"?: string; - "email"?: string; - "password"?: string; - "phone"?: string; + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; /** * User Status + * @type {number} + * @memberof User */ - "userStatus"?: number; + userStatus?: number; } - /** * PetApi - fetch parameter creator */ @@ -123,281 +309,289 @@ export const PetApiFetchParamCreator = { /** * * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - addPet(params: { body: Pet; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling addPet"); - } - const baseUrl = `/pet`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); + addPet(body: Pet, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + const path = `/pet`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deletePet(params: { petId: number; apiKey?: string; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "petId" is set - if (params["petId"] == null) { - throw new Error("Missing required parameter petId when calling deletePet"); + deletePet(petId: number, apiKey?: string, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - - let contentTypeHeader: Dictionary = {}; - fetchOptions.headers = assign({ - "api_key": params["apiKey"], - }, contentTypeHeader, fetchOptions.headers); - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + if (apiKey !== undefined && apiKey !== null) { + headers['api_key'] = String(apiKey); + } + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param status Status values that need to be considered for filter + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - findPetsByStatus(params: { status: Array; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "status" is set - if (params["status"] == null) { - throw new Error("Missing required parameter status when calling findPetsByStatus"); + findPetsByStatus(status: Array, options?: any): FetchArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); } - const baseUrl = `/pet/findByStatus`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query, { - "status": params["status"], - }); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/pet/findByStatus`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (status) { + queryParameters['status'] = status.join(','); } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param tags Tags to filter by + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - findPetsByTags(params: { tags: Array; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "tags" is set - if (params["tags"] == null) { - throw new Error("Missing required parameter tags when calling findPetsByTags"); + findPetsByTags(tags: Array, options?: any): FetchArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); } - const baseUrl = `/pet/findByTags`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query, { - "tags": params["tags"], - }); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/pet/findByTags`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (tags) { + queryParameters['tags'] = tags.join(','); } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * Returns a single pet * @summary Find pet by ID - * @param petId ID of pet to return + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getPetById(params: { petId: number; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "petId" is set - if (params["petId"] == null) { - throw new Error("Missing required parameter petId when calling getPetById"); + getPetById(petId: number, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (api_key) required - if (configuration.apiKey && configuration.apiKey.api_key) { - fetchOptions.headers = assign({ - "api_key": configuration.apiKey.api_key, - }, contentTypeHeader); + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Update an existing pet - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updatePet(params: { body: Pet; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling updatePet"); - } - const baseUrl = `/pet`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); + updatePet(body: Pet, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + const path = `/pet`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Updates a pet in the store with form data - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet - */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "petId" is set - if (params["petId"] == null) { - throw new Error("Missing required parameter petId when calling updatePetWithForm"); + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; - fetchOptions.body = querystring.stringify({ - "name": params["name"], - "status": params["status"], - }); - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (name !== undefined) { + formParams.set('name', name); } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + + if (status !== undefined) { + formParams.set('status', status); + } + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, configuration: Configuration, options: any = {}): FetchArgs { - // verify required parameter "petId" is set - if (params["petId"] == null) { - throw new Error("Missing required parameter petId when calling uploadFile"); + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const path = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (additionalMetadata !== undefined) { + formParams.set('additionalMetadata', additionalMetadata); } - const baseUrl = `/pet/{petId}/uploadImage` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; - fetchOptions.body = querystring.stringify({ - "additionalMetadata": params["additionalMetadata"], - "file": params["file"], - }); - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + + if (file !== undefined) { + formParams.set('file', file); } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, }; @@ -409,10 +603,12 @@ export const PetApiFp = { /** * * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - addPet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.addPet(params, configuration, options); + addPet(body: Pet, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.addPet(body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -426,11 +622,13 @@ export const PetApiFp = { /** * * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deletePet(params: { petId: number; apiKey?: string; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.deletePet(params, configuration, options); + deletePet(petId: number, apiKey?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.deletePet(petId, apiKey, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -444,10 +642,12 @@ export const PetApiFp = { /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param status Status values that need to be considered for filter + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - findPetsByStatus(params: { status: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(params, configuration, options); + findPetsByStatus(status: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(status, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -461,10 +661,12 @@ export const PetApiFp = { /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param tags Tags to filter by + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - findPetsByTags(params: { tags: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByTags(params, configuration, options); + findPetsByTags(tags: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const fetchArgs = PetApiFetchParamCreator.findPetsByTags(tags, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -478,10 +680,12 @@ export const PetApiFp = { /** * Returns a single pet * @summary Find pet by ID - * @param petId ID of pet to return + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getPetById(params: { petId: number; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.getPetById(params, configuration, options); + getPetById(petId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.getPetById(petId, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -495,10 +699,12 @@ export const PetApiFp = { /** * * @summary Update an existing pet - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updatePet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePet(params, configuration, options); + updatePet(body: Pet, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.updatePet(body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -512,12 +718,14 @@ export const PetApiFp = { /** * * @summary Updates a pet in the store with form data - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(params, configuration, options); + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(petId, name, status, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -531,12 +739,14 @@ export const PetApiFp = { /** * * @summary uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.uploadFile(params, configuration, options); + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.uploadFile(petId, additionalMetadata, file, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -551,76 +761,103 @@ export const PetApiFp = { /** * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} */ export class PetApi extends BaseAPI { /** * * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - addPet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.addPet(params, this.configuration, options)(this.fetch, this.basePath); + public addPet(body: Pet, options?: any) { + return PetApiFp.addPet(body, options)(this.fetch, this.basePath); } /** * * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - deletePet(params: { petId: number; apiKey?: string; }, options: any = {}) { - return PetApiFp.deletePet(params, this.configuration, options)(this.fetch, this.basePath); + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp.deletePet(petId, apiKey, options)(this.fetch, this.basePath); } /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param status Status values that need to be considered for filter + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - findPetsByStatus(params: { status: Array; }, options: any = {}) { - return PetApiFp.findPetsByStatus(params, this.configuration, options)(this.fetch, this.basePath); + public findPetsByStatus(status: Array, options?: any) { + return PetApiFp.findPetsByStatus(status, options)(this.fetch, this.basePath); } /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param tags Tags to filter by + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - findPetsByTags(params: { tags: Array; }, options: any = {}) { - return PetApiFp.findPetsByTags(params, this.configuration, options)(this.fetch, this.basePath); + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp.findPetsByTags(tags, options)(this.fetch, this.basePath); } /** * Returns a single pet * @summary Find pet by ID - * @param petId ID of pet to return + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - getPetById(params: { petId: number; }, options: any = {}) { - return PetApiFp.getPetById(params, this.configuration, options)(this.fetch, this.basePath); + public getPetById(petId: number, options?: any) { + return PetApiFp.getPetById(petId, options)(this.fetch, this.basePath); } /** * * @summary Update an existing pet - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - updatePet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.updatePet(params, this.configuration, options)(this.fetch, this.basePath); + public updatePet(body: Pet, options?: any) { + return PetApiFp.updatePet(body, options)(this.fetch, this.basePath); } /** * * @summary Updates a pet in the store with form data - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, options: any = {}) { - return PetApiFp.updatePetWithForm(params, this.configuration, options)(this.fetch, this.basePath); + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp.updatePetWithForm(petId, name, status, options)(this.fetch, this.basePath); } /** * * @summary uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, options: any = {}) { - return PetApiFp.uploadFile(params, this.configuration, options)(this.fetch, this.basePath); + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp.uploadFile(petId, additionalMetadata, file, options)(this.fetch, this.basePath); } }; @@ -632,71 +869,87 @@ export const PetApiFactory = function (fetch?: FetchAPI, basePath?: string) { /** * * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - addPet(params: { body: Pet; }, configuration: Configuration, options: any = {}) { - return PetApiFp.addPet(params, configuration, options)(fetch, basePath); + addPet(body: Pet, options?: any) { + return PetApiFp.addPet(body, options)(fetch, basePath); }, /** * * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deletePet(params: { petId: number; apiKey?: string; }, configuration: Configuration, options: any = {}) { - return PetApiFp.deletePet(params, configuration, options)(fetch, basePath); + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp.deletePet(petId, apiKey, options)(fetch, basePath); }, /** * Multiple status values can be provided with comma separated strings * @summary Finds Pets by status - * @param status Status values that need to be considered for filter + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - findPetsByStatus(params: { status: Array; }, configuration: Configuration, options: any = {}) { - return PetApiFp.findPetsByStatus(params, configuration, options)(fetch, basePath); + findPetsByStatus(status: Array, options?: any) { + return PetApiFp.findPetsByStatus(status, options)(fetch, basePath); }, /** * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags - * @param tags Tags to filter by + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - findPetsByTags(params: { tags: Array; }, configuration: Configuration, options: any = {}) { - return PetApiFp.findPetsByTags(params, configuration, options)(fetch, basePath); + findPetsByTags(tags: Array, options?: any) { + return PetApiFp.findPetsByTags(tags, options)(fetch, basePath); }, /** * Returns a single pet * @summary Find pet by ID - * @param petId ID of pet to return + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getPetById(params: { petId: number; }, configuration: Configuration, options: any = {}) { - return PetApiFp.getPetById(params, configuration, options)(fetch, basePath); + getPetById(petId: number, options?: any) { + return PetApiFp.getPetById(petId, options)(fetch, basePath); }, /** * * @summary Update an existing pet - * @param body Pet object that needs to be added to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updatePet(params: { body: Pet; }, configuration: Configuration, options: any = {}) { - return PetApiFp.updatePet(params, configuration, options)(fetch, basePath); + updatePet(body: Pet, options?: any) { + return PetApiFp.updatePet(body, options)(fetch, basePath); }, /** * * @summary Updates a pet in the store with form data - * @param petId ID of pet that needs to be updated - * @param name Updated name of the pet - * @param status Updated status of the pet + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, configuration: Configuration, options: any = {}) { - return PetApiFp.updatePetWithForm(params, configuration, options)(fetch, basePath); + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp.updatePetWithForm(petId, name, status, options)(fetch, basePath); }, /** * * @summary uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, configuration: Configuration, options: any = {}) { - return PetApiFp.uploadFile(params, configuration, options)(fetch, basePath); + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp.uploadFile(petId, additionalMetadata, file, options)(fetch, basePath); }, }; }; @@ -709,104 +962,120 @@ export const StoreApiFetchParamCreator = { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID - * @param orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deleteOrder(params: { orderId: string; }, options: any = {}): FetchArgs { - // verify required parameter "orderId" is set - if (params["orderId"] == null) { - throw new Error("Missing required parameter orderId when calling deleteOrder"); + deleteOrder(orderId: string, options?: any): FetchArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, String(orderId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * Returns a map of status codes to quantities * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getInventory(configuration: Configuration, options: any = {}): FetchArgs { - const baseUrl = `/store/inventory`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (api_key) required - if (configuration.apiKey && configuration.apiKey.api_key) { - fetchOptions.headers = assign({ - "api_key": configuration.apiKey.api_key, - }, contentTypeHeader); + getInventory(options?: any): FetchArgs { + const path = `/store/inventory`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getOrderById(params: { orderId: number; }, options: any = {}): FetchArgs { - // verify required parameter "orderId" is set - if (params["orderId"] == null) { - throw new Error("Missing required parameter orderId when calling getOrderById"); + getOrderById(orderId: number, options?: any): FetchArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, String(orderId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Place an order for a pet - * @param body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - placeOrder(params: { body: Order; }, options: any = {}): FetchArgs { - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling placeOrder"); - } - const baseUrl = `/store/order`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); + placeOrder(body: Order, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/store/order`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, }; @@ -818,10 +1087,12 @@ export const StoreApiFp = { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID - * @param orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deleteOrder(params: { orderId: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.deleteOrder(params, options); + deleteOrder(orderId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.deleteOrder(orderId, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -835,9 +1106,11 @@ export const StoreApiFp = { /** * Returns a map of status codes to quantities * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getInventory(configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { - const fetchArgs = StoreApiFetchParamCreator.getInventory(configuration, options); + getInventory(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { + const fetchArgs = StoreApiFetchParamCreator.getInventory(options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -851,10 +1124,12 @@ export const StoreApiFp = { /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getOrderById(params: { orderId: number; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.getOrderById(params, options); + getOrderById(orderId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.getOrderById(orderId, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -868,10 +1143,12 @@ export const StoreApiFp = { /** * * @summary Place an order for a pet - * @param body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - placeOrder(params: { body: Order; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.placeOrder(params, options); + placeOrder(body: Order, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.placeOrder(body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -886,38 +1163,53 @@ export const StoreApiFp = { /** * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} */ export class StoreApi extends BaseAPI { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID - * @param orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi */ - deleteOrder(params: { orderId: string; }, options: any = {}) { - return StoreApiFp.deleteOrder(params, options)(this.fetch, this.basePath); + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp.deleteOrder(orderId, options)(this.fetch, this.basePath); } /** * Returns a map of status codes to quantities * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi */ - getInventory(options: any = {}) { - return StoreApiFp.getInventory(this.configuration, options)(this.fetch, this.basePath); + public getInventory(options?: any) { + return StoreApiFp.getInventory(options)(this.fetch, this.basePath); } /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi */ - getOrderById(params: { orderId: number; }, options: any = {}) { - return StoreApiFp.getOrderById(params, options)(this.fetch, this.basePath); + public getOrderById(orderId: number, options?: any) { + return StoreApiFp.getOrderById(orderId, options)(this.fetch, this.basePath); } /** * * @summary Place an order for a pet - * @param body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi */ - placeOrder(params: { body: Order; }, options: any = {}) { - return StoreApiFp.placeOrder(params, options)(this.fetch, this.basePath); + public placeOrder(body: Order, options?: any) { + return StoreApiFp.placeOrder(body, options)(this.fetch, this.basePath); } }; @@ -929,33 +1221,41 @@ export const StoreApiFactory = function (fetch?: FetchAPI, basePath?: string) { /** * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID - * @param orderId ID of the order that needs to be deleted + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deleteOrder(params: { orderId: string; }, options: any = {}) { - return StoreApiFp.deleteOrder(params, options)(fetch, basePath); + deleteOrder(orderId: string, options?: any) { + return StoreApiFp.deleteOrder(orderId, options)(fetch, basePath); }, /** * Returns a map of status codes to quantities * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getInventory(configuration: Configuration, options: any = {}) { - return StoreApiFp.getInventory(configuration, options)(fetch, basePath); + getInventory(options?: any) { + return StoreApiFp.getInventory(options)(fetch, basePath); }, /** * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @summary Find purchase order by ID - * @param orderId ID of pet that needs to be fetched + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getOrderById(params: { orderId: number; }, options: any = {}) { - return StoreApiFp.getOrderById(params, options)(fetch, basePath); + getOrderById(orderId: number, options?: any) { + return StoreApiFp.getOrderById(orderId, options)(fetch, basePath); }, /** * * @summary Place an order for a pet - * @param body order placed for purchasing the pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - placeOrder(params: { body: Order; }, options: any = {}) { - return StoreApiFp.placeOrder(params, options)(fetch, basePath); + placeOrder(body: Order, options?: any) { + return StoreApiFp.placeOrder(body, options)(fetch, basePath); }, }; }; @@ -968,221 +1268,265 @@ export const UserApiFetchParamCreator = { /** * This can only be done by the logged in user. * @summary Create user - * @param body Created user object + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUser(params: { body: User; }, options: any = {}): FetchArgs { - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling createUser"); + createUser(body: User, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); } - const baseUrl = `/user`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/user`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}): FetchArgs { - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling createUsersWithArrayInput"); - } - const baseUrl = `/user/createWithArray`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); + createUsersWithArrayInput(body: Array, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/user/createWithArray`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUsersWithListInput(params: { body: Array; }, options: any = {}): FetchArgs { - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling createUsersWithListInput"); + createUsersWithListInput(body: Array, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); } - const baseUrl = `/user/createWithList`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/user/createWithList`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * This can only be done by the logged in user. * @summary Delete user - * @param username The name that needs to be deleted + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deleteUser(params: { username: string; }, options: any = {}): FetchArgs { - // verify required parameter "username" is set - if (params["username"] == null) { - throw new Error("Missing required parameter username when calling deleteUser"); + deleteUser(username: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getUserByName(params: { username: string; }, options: any = {}): FetchArgs { - // verify required parameter "username" is set - if (params["username"] == null) { - throw new Error("Missing required parameter username when calling getUserByName"); + getUserByName(username: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - loginUser(params: { username: string; password: string; }, options: any = {}): FetchArgs { - // verify required parameter "username" is set - if (params["username"] == null) { - throw new Error("Missing required parameter username when calling loginUser"); + loginUser(username: string, password: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); } - // verify required parameter "password" is set - if (params["password"] == null) { - throw new Error("Missing required parameter password when calling loginUser"); + const path = `/user/login`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (username !== undefined) { + queryParameters['username'] = username as any; + } + if (password !== undefined) { + queryParameters['password'] = password as any; } - const baseUrl = `/user/login`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query, { - "username": params["username"], - "password": params["password"], - }); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - logoutUser(options: any = {}): FetchArgs { - const baseUrl = `/user/logout`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + logoutUser(options?: any): FetchArgs { + const path = `/user/logout`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, /** * This can only be done by the logged in user. * @summary Updated user - * @param username name that need to be deleted - * @param body Updated user object + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updateUser(params: { username: string; body: User; }, options: any = {}): FetchArgs { - // verify required parameter "username" is set - if (params["username"] == null) { - throw new Error("Missing required parameter username when calling updateUser"); - } - // verify required parameter "body" is set - if (params["body"] == null) { - throw new Error("Missing required parameter body when calling updateUser"); + updateUser(username: string, body: User, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); } - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); } return { url: url.format(urlObj), - options: fetchOptions, + options: requestOptions, }; }, }; @@ -1194,10 +1538,12 @@ export const UserApiFp = { /** * This can only be done by the logged in user. * @summary Create user - * @param body Created user object + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUser(params: { body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUser(params, options); + createUser(body: User, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUser(body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1211,10 +1557,12 @@ export const UserApiFp = { /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(params, options); + createUsersWithArrayInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1228,10 +1576,12 @@ export const UserApiFp = { /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUsersWithListInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(params, options); + createUsersWithListInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1245,10 +1595,12 @@ export const UserApiFp = { /** * This can only be done by the logged in user. * @summary Delete user - * @param username The name that needs to be deleted + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deleteUser(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.deleteUser(params, options); + deleteUser(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.deleteUser(username, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1262,10 +1614,12 @@ export const UserApiFp = { /** * * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getUserByName(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.getUserByName(params, options); + getUserByName(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.getUserByName(username, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1279,11 +1633,13 @@ export const UserApiFp = { /** * * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - loginUser(params: { username: string; password: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.loginUser(params, options); + loginUser(username: string, password: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.loginUser(username, password, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1297,8 +1653,10 @@ export const UserApiFp = { /** * * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - logoutUser(options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { + logoutUser(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { const fetchArgs = UserApiFetchParamCreator.logoutUser(options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { @@ -1313,11 +1671,13 @@ export const UserApiFp = { /** * This can only be done by the logged in user. * @summary Updated user - * @param username name that need to be deleted - * @param body Updated user object + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updateUser(params: { username: string; body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.updateUser(params, options); + updateUser(username: string, body: User, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.updateUser(username, body, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -1332,72 +1692,99 @@ export const UserApiFp = { /** * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} */ export class UserApi extends BaseAPI { /** * This can only be done by the logged in user. * @summary Create user - * @param body Created user object + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - createUser(params: { body: User; }, options: any = {}) { - return UserApiFp.createUser(params, options)(this.fetch, this.basePath); + public createUser(body: User, options?: any) { + return UserApiFp.createUser(body, options)(this.fetch, this.basePath); } /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithArrayInput(params, options)(this.fetch, this.basePath); + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp.createUsersWithArrayInput(body, options)(this.fetch, this.basePath); } /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - createUsersWithListInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithListInput(params, options)(this.fetch, this.basePath); + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp.createUsersWithListInput(body, options)(this.fetch, this.basePath); } /** * This can only be done by the logged in user. * @summary Delete user - * @param username The name that needs to be deleted + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - deleteUser(params: { username: string; }, options: any = {}) { - return UserApiFp.deleteUser(params, options)(this.fetch, this.basePath); + public deleteUser(username: string, options?: any) { + return UserApiFp.deleteUser(username, options)(this.fetch, this.basePath); } /** * * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - getUserByName(params: { username: string; }, options: any = {}) { - return UserApiFp.getUserByName(params, options)(this.fetch, this.basePath); + public getUserByName(username: string, options?: any) { + return UserApiFp.getUserByName(username, options)(this.fetch, this.basePath); } /** * * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - loginUser(params: { username: string; password: string; }, options: any = {}) { - return UserApiFp.loginUser(params, options)(this.fetch, this.basePath); + public loginUser(username: string, password: string, options?: any) { + return UserApiFp.loginUser(username, password, options)(this.fetch, this.basePath); } /** * * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - logoutUser(options: any = {}) { + public logoutUser(options?: any) { return UserApiFp.logoutUser(options)(this.fetch, this.basePath); } /** * This can only be done by the logged in user. * @summary Updated user - * @param username name that need to be deleted - * @param body Updated user object + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi */ - updateUser(params: { username: string; body: User; }, options: any = {}) { - return UserApiFp.updateUser(params, options)(this.fetch, this.basePath); + public updateUser(username: string, body: User, options?: any) { + return UserApiFp.updateUser(username, body, options)(this.fetch, this.basePath); } }; @@ -1409,67 +1796,83 @@ export const UserApiFactory = function (fetch?: FetchAPI, basePath?: string) { /** * This can only be done by the logged in user. * @summary Create user - * @param body Created user object + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUser(params: { body: User; }, options: any = {}) { - return UserApiFp.createUser(params, options)(fetch, basePath); + createUser(body: User, options?: any) { + return UserApiFp.createUser(body, options)(fetch, basePath); }, /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithArrayInput(params, options)(fetch, basePath); + createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp.createUsersWithArrayInput(body, options)(fetch, basePath); }, /** * * @summary Creates list of users with given input array - * @param body List of user object + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - createUsersWithListInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithListInput(params, options)(fetch, basePath); + createUsersWithListInput(body: Array, options?: any) { + return UserApiFp.createUsersWithListInput(body, options)(fetch, basePath); }, /** * This can only be done by the logged in user. * @summary Delete user - * @param username The name that needs to be deleted + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - deleteUser(params: { username: string; }, options: any = {}) { - return UserApiFp.deleteUser(params, options)(fetch, basePath); + deleteUser(username: string, options?: any) { + return UserApiFp.deleteUser(username, options)(fetch, basePath); }, /** * * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - getUserByName(params: { username: string; }, options: any = {}) { - return UserApiFp.getUserByName(params, options)(fetch, basePath); + getUserByName(username: string, options?: any) { + return UserApiFp.getUserByName(username, options)(fetch, basePath); }, /** * * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - loginUser(params: { username: string; password: string; }, options: any = {}) { - return UserApiFp.loginUser(params, options)(fetch, basePath); + loginUser(username: string, password: string, options?: any) { + return UserApiFp.loginUser(username, password, options)(fetch, basePath); }, /** * * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - logoutUser(options: any = {}) { + logoutUser(options?: any) { return UserApiFp.logoutUser(options)(fetch, basePath); }, /** * This can only be done by the logged in user. * @summary Updated user - * @param username name that need to be deleted - * @param body Updated user object + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} */ - updateUser(params: { username: string; body: User; }, options: any = {}) { - return UserApiFp.updateUser(params, options)(fetch, basePath); + updateUser(username: string, body: User, options?: any) { + return UserApiFp.updateUser(username, body, options)(fetch, basePath); }, }; }; diff --git a/samples/client/petstore/typescript-fetch/builds/default/package.json b/samples/client/petstore/typescript-fetch/builds/default/package.json deleted file mode 100644 index 0204e3c39c9..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "typescript-fetch-api", - "version": "0.0.0", - "license": "Unlicense", - "main": "./dist/api.js", - "browser": "./dist/api.js", - "typings": "./dist/api.d.ts", - "dependencies": { - "core-js": "^2.4.0", - "isomorphic-fetch": "^2.2.1" - }, - "scripts" : { - "prepublish" : "typings install && tsc", - "test": "tslint api.ts" - }, - "devDependencies": { - "tslint": "^3.15.1", - "typescript": "^1.8.10", - "typings": "^1.0.4" - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/default/pom.xml b/samples/client/petstore/typescript-fetch/builds/default/pom.xml deleted file mode 100644 index f7886b3f9aa..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - 4.0.0 - com.wordnik - TypeScriptAngularBuildPestoreClientTests - pom - 1.0-SNAPSHOT - TS Fetch Default Petstore Client - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - npm-install - integration-test - - exec - - - npm - - install - - - - - npm-test - integration-test - - exec - - - npm - - test - - - - - - - - diff --git a/samples/client/petstore/typescript-fetch/builds/default/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/default/tsconfig.json deleted file mode 100644 index 72ff2567206..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "target": "es5", - "module": "commonjs", - "noImplicitAny": true, - "outDir": "dist", - "rootDir": "." - }, - "exclude": [ - "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" - ] -} diff --git a/samples/client/petstore/typescript-fetch/builds/default/tslint.json b/samples/client/petstore/typescript-fetch/builds/default/tslint.json deleted file mode 100644 index 6eb02acec8c..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/tslint.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "jsRules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - }, - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/default/typings.json b/samples/client/petstore/typescript-fetch/builds/default/typings.json deleted file mode 100644 index a82ea152b4a..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/typings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": false, - "dependencies": {}, - "globalDependencies": { - "core-js": "registry:dt/core-js#0.0.0+20160317120654", - "node": "registry:dt/node#4.0.0+20160423143914", - "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/.gitignore b/samples/client/petstore/typescript-fetch/builds/es6-target/.gitignore deleted file mode 100644 index 35e2fb2b02e..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -wwwroot/*.js -node_modules -typings diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/README.md b/samples/client/petstore/typescript-fetch/builds/es6-target/README.md deleted file mode 100644 index 664e1755933..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# TypeScript-Fetch - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Installation ### - -`swagger-codegen` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`. - -CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`. - -#### NPM #### -You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). - -You can also use `npm link` to link the module. However, this would not modify `package.json` of the installing project, as such you would need to relink every time you deploy that project. - -You can also directly install the module using `npm install file_path`. If you do `npm install file_path --save`, NPM will save relative path to `package.json`. In this case, `npm install` and `npm shrinkwrap` may misbehave. You would need to manually edit `package.json` and replace it with absolute path. - -Regardless of which method you deployed your NPM module, the ES6 module syntaxes are as follows: -``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); -``` - -#### Direct copy/symlink #### -You may also simply copy or symlink the generated module into a directory under your project. The syntax of this is as follows: - -With ES6 module syntax, the following syntaxes are supported: -``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; -``` diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/git_push.sh b/samples/client/petstore/typescript-fetch/builds/es6-target/git_push.sh deleted file mode 100644 index ed374619b13..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/package.json b/samples/client/petstore/typescript-fetch/builds/es6-target/package.json deleted file mode 100644 index 9797e3483f9..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "typescript-fetch-api", - "version": "0.0.0", - "license": "Unlicense", - "main": "./dist/api.js", - "browser": "./dist/api.js", - "typings": "./dist/api.d.ts", - "dependencies": { - "isomorphic-fetch": "^2.2.1" - }, - "scripts" : { - "prepublish" : "typings install && tsc", - "test": "tslint api.ts" - }, - "devDependencies": { - "tslint": "^3.15.1", - "typescript": "^1.8.10", - "typings": "^1.0.4" - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/tslint.json b/samples/client/petstore/typescript-fetch/builds/es6-target/tslint.json deleted file mode 100644 index 6eb02acec8c..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/tslint.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "jsRules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - }, - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/typings.json b/samples/client/petstore/typescript-fetch/builds/es6-target/typings.json deleted file mode 100644 index 2ec50862694..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/typings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": false, - "dependencies": {}, - "globalDependencies": { - "node": "registry:dt/node#4.0.0+20160423143914", - "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" - } -} diff --git a/samples/client/petstore-security-test/typescript-fetch/.gitignore b/samples/client/petstore/typescript-fetch/builds/es6/.gitignore similarity index 100% rename from samples/client/petstore-security-test/typescript-fetch/.gitignore rename to samples/client/petstore/typescript-fetch/builds/es6/.gitignore diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen-ignore b/samples/client/petstore/typescript-fetch/builds/es6/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen-ignore rename to samples/client/petstore/typescript-fetch/builds/es6/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-fetch/builds/es6/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/es6/.swagger-codegen/VERSION new file mode 100644 index 00000000000..6b4d1577382 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/es6/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3 \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/es6/README.md b/samples/client/petstore/typescript-fetch/builds/es6/README.md new file mode 100644 index 00000000000..5f980bcb095 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/es6/README.md @@ -0,0 +1,45 @@ +## @swagger/typescript-fetch-petstore@0.0.1-SNAPSHOT.201707180154 + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build an compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### publishing + +First build the package than run ```npm publish``` + +### consuming + +navigate to the folder of your consuming project and run one of next commando's. + +_published:_ + +``` +npm install @swagger/typescript-fetch-petstore@0.0.1-SNAPSHOT.201707180154 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/es6/api.ts b/samples/client/petstore/typescript-fetch/builds/es6/api.ts new file mode 100644 index 00000000000..0e01c3ca21c --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/es6/api.ts @@ -0,0 +1,1879 @@ +// tslint:disable +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +import * as url from "url"; +import * as isomorphicFetch from "isomorphic-fetch"; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + * @interface FetchAPI + */ +export interface FetchAPI { + (url: string, init?: any): Promise; +} + +/** + * + * @export + * @interface FetchArgs + */ +export interface FetchArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + constructor(public basePath: string = BASE_PATH, public fetch: FetchAPI = isomorphicFetch) { + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * Describes the result of uploading an image resource + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * An order for a pets from the pet store + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} + +/** + * A pet for sale in the pet store + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array<string>} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array<Tag>} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * A User who is purchasing from the pet store + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; +} + + +/** + * PetApi - fetch parameter creator + */ +export const PetApiFetchParamCreator = { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(body: Pet, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); + } + const path = `/pet`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); + } + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + if (apiKey !== undefined && apiKey !== null) { + headers['api_key'] = String(apiKey); + } + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array, options?: any): FetchArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); + } + const path = `/pet/findByStatus`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (status) { + queryParameters['status'] = status.join(','); + } + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): FetchArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); + } + const path = `/pet/findByTags`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (tags) { + queryParameters['tags'] = tags.join(','); + } + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); + } + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(body: Pet, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); + } + const path = `/pet`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (name !== undefined) { + formParams.set('name', name); + } + + if (status !== undefined) { + formParams.set('status', status); + } + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const path = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (additionalMetadata !== undefined) { + formParams.set('additionalMetadata', additionalMetadata); + } + + if (file !== undefined) { + formParams.set('file', file); + } + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, +}; + +/** + * PetApi - functional programming interface + */ +export const PetApiFp = { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(body: Pet, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.addPet(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.deletePet(petId, apiKey, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(status, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const fetchArgs = PetApiFetchParamCreator.findPetsByTags(tags, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.getPetById(petId, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(body: Pet, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.updatePet(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(petId, name, status, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.uploadFile(petId, additionalMetadata, file, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, +}; + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(body: Pet, options?: any) { + return PetApiFp.addPet(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp.deletePet(petId, apiKey, options)(this.fetch, this.basePath); + } + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array, options?: any) { + return PetApiFp.findPetsByStatus(status, options)(this.fetch, this.basePath); + } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp.findPetsByTags(tags, options)(this.fetch, this.basePath); + } + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp.getPetById(petId, options)(this.fetch, this.basePath); + } + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(body: Pet, options?: any) { + return PetApiFp.updatePet(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp.updatePetWithForm(petId, name, status, options)(this.fetch, this.basePath); + } + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp.uploadFile(petId, additionalMetadata, file, options)(this.fetch, this.basePath); + } +}; + +/** + * PetApi - factory interface + */ +export const PetApiFactory = function (fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(body: Pet, options?: any) { + return PetApiFp.addPet(body, options)(fetch, basePath); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp.deletePet(petId, apiKey, options)(fetch, basePath); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array, options?: any) { + return PetApiFp.findPetsByStatus(status, options)(fetch, basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp.findPetsByTags(tags, options)(fetch, basePath); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any) { + return PetApiFp.getPetById(petId, options)(fetch, basePath); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(body: Pet, options?: any) { + return PetApiFp.updatePet(body, options)(fetch, basePath); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp.updatePetWithForm(petId, name, status, options)(fetch, basePath); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp.uploadFile(petId, additionalMetadata, file, options)(fetch, basePath); + }, + }; +}; + + +/** + * StoreApi - fetch parameter creator + */ +export const StoreApiFetchParamCreator = { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): FetchArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); + } + const path = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, String(orderId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): FetchArgs { + const path = `/store/inventory`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): FetchArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); + } + const path = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, String(orderId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(body: Order, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); + } + const path = `/store/order`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, +}; + +/** + * StoreApi - functional programming interface + */ +export const StoreApiFp = { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.deleteOrder(orderId, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { + const fetchArgs = StoreApiFetchParamCreator.getInventory(options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.getOrderById(orderId, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(body: Order, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.placeOrder(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, +}; + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp.deleteOrder(orderId, options)(this.fetch, this.basePath); + } + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp.getInventory(options)(this.fetch, this.basePath); + } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp.getOrderById(orderId, options)(this.fetch, this.basePath); + } + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(body: Order, options?: any) { + return StoreApiFp.placeOrder(body, options)(this.fetch, this.basePath); + } +}; + +/** + * StoreApi - factory interface + */ +export const StoreApiFactory = function (fetch?: FetchAPI, basePath?: string) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any) { + return StoreApiFp.deleteOrder(orderId, options)(fetch, basePath); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any) { + return StoreApiFp.getInventory(options)(fetch, basePath); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any) { + return StoreApiFp.getOrderById(orderId, options)(fetch, basePath); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(body: Order, options?: any) { + return StoreApiFp.placeOrder(body, options)(fetch, basePath); + }, + }; +}; + + +/** + * UserApi - fetch parameter creator + */ +export const UserApiFetchParamCreator = { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(body: User, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); + } + const path = `/user`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } + const path = `/user/createWithArray`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); + } + const path = `/user/createWithList`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); + } + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); + } + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); + } + const path = `/user/login`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (username !== undefined) { + queryParameters['username'] = username as any; + } + if (password !== undefined) { + queryParameters['password'] = password as any; + } + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): FetchArgs { + const path = `/user/logout`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, body: User, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); + } + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, +}; + +/** + * UserApi - functional programming interface + */ +export const UserApiFp = { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(body: User, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUser(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.deleteUser(username, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.getUserByName(username, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.loginUser(username, password, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.logoutUser(options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, body: User, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.updateUser(username, body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, +}; + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(body: User, options?: any) { + return UserApiFp.createUser(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp.createUsersWithArrayInput(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp.createUsersWithListInput(body, options)(this.fetch, this.basePath); + } + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp.deleteUser(username, options)(this.fetch, this.basePath); + } + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp.getUserByName(username, options)(this.fetch, this.basePath); + } + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp.loginUser(username, password, options)(this.fetch, this.basePath); + } + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp.logoutUser(options)(this.fetch, this.basePath); + } + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, body: User, options?: any) { + return UserApiFp.updateUser(username, body, options)(this.fetch, this.basePath); + } +}; + +/** + * UserApi - factory interface + */ +export const UserApiFactory = function (fetch?: FetchAPI, basePath?: string) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(body: User, options?: any) { + return UserApiFp.createUser(body, options)(fetch, basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp.createUsersWithArrayInput(body, options)(fetch, basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any) { + return UserApiFp.createUsersWithListInput(body, options)(fetch, basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any) { + return UserApiFp.deleteUser(username, options)(fetch, basePath); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any) { + return UserApiFp.getUserByName(username, options)(fetch, basePath); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any) { + return UserApiFp.loginUser(username, password, options)(fetch, basePath); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any) { + return UserApiFp.logoutUser(options)(fetch, basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, body: User, options?: any) { + return UserApiFp.updateUser(username, body, options)(fetch, basePath); + }, + }; +}; + diff --git a/samples/client/petstore-security-test/typescript-fetch/git_push.sh b/samples/client/petstore/typescript-fetch/builds/es6/git_push.sh similarity index 100% rename from samples/client/petstore-security-test/typescript-fetch/git_push.sh rename to samples/client/petstore/typescript-fetch/builds/es6/git_push.sh diff --git a/samples/client/petstore/typescript-fetch/builds/es6/package.json b/samples/client/petstore/typescript-fetch/builds/es6/package.json new file mode 100644 index 00000000000..1b215122bb7 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/es6/package.json @@ -0,0 +1,30 @@ +{ + "name": "@swagger/typescript-fetch-petstore", + "version": "0.0.1-SNAPSHOT.201707180154", + "description": "swagger client for @swagger/typescript-fetch-petstore", + "author": "Swagger Codegen Contributors", + "keywords": [ + "fetch", + "typescript", + "swagger-client", + "@swagger/typescript-fetch-petstore" + ], + "license": "Unlicense", + "main": "./dist/api.js", + "typings": "./dist/api.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "postinstall": "npm run build" + }, + "dependencies": { + "isomorphic-fetch": "^2.2.1", + "@types/isomorphic-fetch": "0.0.33", + "@types/node": "^8.0.9" + }, + "devDependencies": { + "typescript": "^2.0" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/pom.xml b/samples/client/petstore/typescript-fetch/builds/es6/pom.xml similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/es6-target/pom.xml rename to samples/client/petstore/typescript-fetch/builds/es6/pom.xml diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/es6/tsconfig.json similarity index 61% rename from samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json rename to samples/client/petstore/typescript-fetch/builds/es6/tsconfig.json index 06a8e0437b9..0eb23e488b2 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/builds/es6/tsconfig.json @@ -5,13 +5,9 @@ "module": "commonjs", "noImplicitAny": true, "outDir": "dist", - "rootDir": "." - }, + "rootDir": "." }, "exclude": [ "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" + "node_modules" ] } diff --git a/samples/client/petstore/typescript-fetch/builds/default/.gitignore b/samples/client/petstore/typescript-fetch/builds/npm/.gitignore similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/.gitignore rename to samples/client/petstore/typescript-fetch/builds/npm/.gitignore diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen-ignore b/samples/client/petstore/typescript-fetch/builds/npm/.swagger-codegen-ignore similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen-ignore rename to samples/client/petstore/typescript-fetch/builds/npm/.swagger-codegen-ignore diff --git a/samples/client/petstore/typescript-fetch/builds/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/npm/.swagger-codegen/VERSION new file mode 100644 index 00000000000..6b4d1577382 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/npm/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3 \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/npm/README.md b/samples/client/petstore/typescript-fetch/builds/npm/README.md new file mode 100644 index 00000000000..236109a8d53 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/npm/README.md @@ -0,0 +1,45 @@ +## @swagger/typescript-fetch-petstore@0.0.1 + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build an compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### publishing + +First build the package than run ```npm publish``` + +### consuming + +navigate to the folder of your consuming project and run one of next commando's. + +_published:_ + +``` +npm install @swagger/typescript-fetch-petstore@0.0.1 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/npm/api.ts b/samples/client/petstore/typescript-fetch/builds/npm/api.ts new file mode 100644 index 00000000000..0e01c3ca21c --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/npm/api.ts @@ -0,0 +1,1879 @@ +// tslint:disable +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +import * as url from "url"; +import * as isomorphicFetch from "isomorphic-fetch"; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + * @interface FetchAPI + */ +export interface FetchAPI { + (url: string, init?: any): Promise; +} + +/** + * + * @export + * @interface FetchArgs + */ +export interface FetchArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + constructor(public basePath: string = BASE_PATH, public fetch: FetchAPI = isomorphicFetch) { + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * Describes the result of uploading an image resource + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * An order for a pets from the pet store + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} + +/** + * A pet for sale in the pet store + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array<string>} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array<Tag>} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * A User who is purchasing from the pet store + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; +} + + +/** + * PetApi - fetch parameter creator + */ +export const PetApiFetchParamCreator = { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(body: Pet, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling addPet.'); + } + const path = `/pet`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); + } + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + if (apiKey !== undefined && apiKey !== null) { + headers['api_key'] = String(apiKey); + } + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array, options?: any): FetchArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); + } + const path = `/pet/findByStatus`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (status) { + queryParameters['status'] = status.join(','); + } + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): FetchArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); + } + const path = `/pet/findByTags`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (tags) { + queryParameters['tags'] = tags.join(','); + } + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); + } + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(body: Pet, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updatePet.'); + } + const path = `/pet`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + const path = `/pet/{petId}` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (name !== undefined) { + formParams.set('name', name); + } + + if (status !== undefined) { + formParams.set('status', status); + } + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): FetchArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const path = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, String(petId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + const formParams = new url.URLSearchParams(); + + if (additionalMetadata !== undefined) { + formParams.set('additionalMetadata', additionalMetadata); + } + + if (file !== undefined) { + formParams.set('file', file); + } + + headers['Content-Type'] = 'application/x-www-form-urlencoded'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: formParams.toString(), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, +}; + +/** + * PetApi - functional programming interface + */ +export const PetApiFp = { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(body: Pet, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.addPet(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.deletePet(petId, apiKey, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(status, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise> { + const fetchArgs = PetApiFetchParamCreator.findPetsByTags(tags, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.getPetById(petId, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(body: Pet, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.updatePet(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(petId, name, status, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator.uploadFile(petId, additionalMetadata, file, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, +}; + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(body: Pet, options?: any) { + return PetApiFp.addPet(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp.deletePet(petId, apiKey, options)(this.fetch, this.basePath); + } + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array, options?: any) { + return PetApiFp.findPetsByStatus(status, options)(this.fetch, this.basePath); + } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp.findPetsByTags(tags, options)(this.fetch, this.basePath); + } + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp.getPetById(petId, options)(this.fetch, this.basePath); + } + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(body: Pet, options?: any) { + return PetApiFp.updatePet(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp.updatePetWithForm(petId, name, status, options)(this.fetch, this.basePath); + } + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp.uploadFile(petId, additionalMetadata, file, options)(this.fetch, this.basePath); + } +}; + +/** + * PetApi - factory interface + */ +export const PetApiFactory = function (fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(body: Pet, options?: any) { + return PetApiFp.addPet(body, options)(fetch, basePath); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp.deletePet(petId, apiKey, options)(fetch, basePath); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<string>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array, options?: any) { + return PetApiFp.findPetsByStatus(status, options)(fetch, basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array<string>} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp.findPetsByTags(tags, options)(fetch, basePath); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any) { + return PetApiFp.getPetById(petId, options)(fetch, basePath); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} body Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(body: Pet, options?: any) { + return PetApiFp.updatePet(body, options)(fetch, basePath); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp.updatePetWithForm(petId, name, status, options)(fetch, basePath); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp.uploadFile(petId, additionalMetadata, file, options)(fetch, basePath); + }, + }; +}; + + +/** + * StoreApi - fetch parameter creator + */ +export const StoreApiFetchParamCreator = { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): FetchArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); + } + const path = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, String(orderId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): FetchArgs { + const path = `/store/inventory`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): FetchArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); + } + const path = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, String(orderId)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(body: Order, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling placeOrder.'); + } + const path = `/store/order`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, +}; + +/** + * StoreApi - functional programming interface + */ +export const StoreApiFp = { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.deleteOrder(orderId, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { + const fetchArgs = StoreApiFetchParamCreator.getInventory(options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.getOrderById(orderId, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(body: Order, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator.placeOrder(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, +}; + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp.deleteOrder(orderId, options)(this.fetch, this.basePath); + } + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp.getInventory(options)(this.fetch, this.basePath); + } + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp.getOrderById(orderId, options)(this.fetch, this.basePath); + } + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(body: Order, options?: any) { + return StoreApiFp.placeOrder(body, options)(this.fetch, this.basePath); + } +}; + +/** + * StoreApi - factory interface + */ +export const StoreApiFactory = function (fetch?: FetchAPI, basePath?: string) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any) { + return StoreApiFp.deleteOrder(orderId, options)(fetch, basePath); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any) { + return StoreApiFp.getInventory(options)(fetch, basePath); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any) { + return StoreApiFp.getOrderById(orderId, options)(fetch, basePath); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} body order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(body: Order, options?: any) { + return StoreApiFp.placeOrder(body, options)(fetch, basePath); + }, + }; +}; + + +/** + * UserApi - fetch parameter creator + */ +export const UserApiFetchParamCreator = { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(body: User, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUser.'); + } + const path = `/user`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } + const path = `/user/createWithArray`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUsersWithListInput.'); + } + const path = `/user/createWithList`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'POST', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); + } + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'DELETE', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); + } + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); + } + const path = `/user/login`; + const urlObj = url.parse(path, true); + const headers = {} as any; + const queryParameters = {} as any; + + if (username !== undefined) { + queryParameters['username'] = username as any; + } + if (password !== undefined) { + queryParameters['password'] = password as any; + } + urlObj.query = Object.assign({}, urlObj.query, queryParameters); + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): FetchArgs { + const path = `/user/logout`; + const urlObj = url.parse(path, true); + const headers = {} as any; + + + let requestOptions = { + method: 'GET', + headers: headers, + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, body: User, options?: any): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.'); + } + const path = `/user/{username}` + .replace(`{${"username"}}`, String(username)); + const urlObj = url.parse(path, true); + const headers = {} as any; + + headers['Content-Type'] = 'application/json'; + + let requestOptions = { + method: 'PUT', + headers: headers, + body: body === null ? '' : JSON.stringify(body), + } as any; + if (options) { + requestOptions = Object.assign(requestOptions, options); + } + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, +}; + +/** + * UserApi - functional programming interface + */ +export const UserApiFp = { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(body: User, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUser(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.deleteUser(username, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.getUserByName(username, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.loginUser(username, password, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.logoutUser(options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, body: User, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator.updateUser(username, body, options); + return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { + return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }; + }, +}; + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(body: User, options?: any) { + return UserApiFp.createUser(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp.createUsersWithArrayInput(body, options)(this.fetch, this.basePath); + } + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp.createUsersWithListInput(body, options)(this.fetch, this.basePath); + } + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp.deleteUser(username, options)(this.fetch, this.basePath); + } + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp.getUserByName(username, options)(this.fetch, this.basePath); + } + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp.loginUser(username, password, options)(this.fetch, this.basePath); + } + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp.logoutUser(options)(this.fetch, this.basePath); + } + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, body: User, options?: any) { + return UserApiFp.updateUser(username, body, options)(this.fetch, this.basePath); + } +}; + +/** + * UserApi - factory interface + */ +export const UserApiFactory = function (fetch?: FetchAPI, basePath?: string) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} body Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(body: User, options?: any) { + return UserApiFp.createUser(body, options)(fetch, basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp.createUsersWithArrayInput(body, options)(fetch, basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array<User>} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(body: Array, options?: any) { + return UserApiFp.createUsersWithListInput(body, options)(fetch, basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any) { + return UserApiFp.deleteUser(username, options)(fetch, basePath); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any) { + return UserApiFp.getUserByName(username, options)(fetch, basePath); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any) { + return UserApiFp.loginUser(username, password, options)(fetch, basePath); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any) { + return UserApiFp.logoutUser(options)(fetch, basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} body Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, body: User, options?: any) { + return UserApiFp.updateUser(username, body, options)(fetch, basePath); + }, + }; +}; + diff --git a/samples/client/petstore/typescript-fetch/builds/default/git_push.sh b/samples/client/petstore/typescript-fetch/builds/npm/git_push.sh similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/git_push.sh rename to samples/client/petstore/typescript-fetch/builds/npm/git_push.sh diff --git a/samples/client/petstore/typescript-fetch/builds/npm/package.json b/samples/client/petstore/typescript-fetch/builds/npm/package.json new file mode 100644 index 00000000000..63d62013bab --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/npm/package.json @@ -0,0 +1,30 @@ +{ + "name": "@swagger/typescript-fetch-petstore", + "version": "0.0.1", + "description": "swagger client for @swagger/typescript-fetch-petstore", + "author": "Swagger Codegen Contributors", + "keywords": [ + "fetch", + "typescript", + "swagger-client", + "@swagger/typescript-fetch-petstore" + ], + "license": "Unlicense", + "main": "./dist/api.js", + "typings": "./dist/api.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "postinstall": "npm run build" + }, + "dependencies": { + "isomorphic-fetch": "^2.2.1", + "@types/isomorphic-fetch": "0.0.33", + "@types/node": "^8.0.9" + }, + "devDependencies": { + "typescript": "^2.0" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml b/samples/client/petstore/typescript-fetch/builds/npm/pom.xml similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml rename to samples/client/petstore/typescript-fetch/builds/npm/pom.xml diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/npm/tsconfig.json similarity index 63% rename from samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json rename to samples/client/petstore/typescript-fetch/builds/npm/tsconfig.json index 72ff2567206..8d30e0ab5c7 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/builds/npm/tsconfig.json @@ -5,13 +5,13 @@ "module": "commonjs", "noImplicitAny": true, "outDir": "dist", - "rootDir": "." + "rootDir": ".", + "lib": [ + "es6" + ] }, "exclude": [ "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" + "node_modules" ] } diff --git a/samples/client/petstore/typescript-fetch/builds/npm/yarn.lock b/samples/client/petstore/typescript-fetch/builds/npm/yarn.lock new file mode 100644 index 00000000000..853225c316d --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/npm/yarn.lock @@ -0,0 +1,47 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/isomorphic-fetch@0.0.33": + version "0.0.33" + resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.33.tgz#3ea1b86f8b73e6a7430d01d4dbd5b1f63fd72718" + +"@types/node@^8.0.9": + version "8.0.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.13.tgz#530f0f9254209b0335bf5cc6387822594ef47093" + +encoding@^0.1.11: + version "0.1.12" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + dependencies: + iconv-lite "~0.4.13" + +iconv-lite@~0.4.13: + version "0.4.18" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" + +is-stream@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + +isomorphic-fetch@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + +node-fetch@^1.0.1: + version "1.7.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5" + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + +typescript@^2.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.1.tgz#c3ccb16ddaa0b2314de031e7e6fee89e5ba346bc" + +whatwg-fetch@>=0.10.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.gitignore b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.gitignore deleted file mode 100644 index 35e2fb2b02e..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -wwwroot/*.js -node_modules -typings diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/README.md b/samples/client/petstore/typescript-fetch/builds/with-npm-version/README.md deleted file mode 100644 index 664e1755933..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# TypeScript-Fetch - -This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: - -Environment -* Node.js -* Webpack -* Browserify - -Language level -* ES5 - you must have a Promises/A+ library installed -* ES6 - -Module system -* CommonJS -* ES6 module system - -It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) - -### Installation ### - -`swagger-codegen` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`. - -CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`. - -#### NPM #### -You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope). - -You can also use `npm link` to link the module. However, this would not modify `package.json` of the installing project, as such you would need to relink every time you deploy that project. - -You can also directly install the module using `npm install file_path`. If you do `npm install file_path --save`, NPM will save relative path to `package.json`. In this case, `npm install` and `npm shrinkwrap` may misbehave. You would need to manually edit `package.json` and replace it with absolute path. - -Regardless of which method you deployed your NPM module, the ES6 module syntaxes are as follows: -``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); -``` - -#### Direct copy/symlink #### -You may also simply copy or symlink the generated module into a directory under your project. The syntax of this is as follows: - -With ES6 module syntax, the following syntaxes are supported: -``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; -``` diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/git_push.sh b/samples/client/petstore/typescript-fetch/builds/with-npm-version/git_push.sh deleted file mode 100644 index ed374619b13..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json deleted file mode 100644 index f4c8ca8a162..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@swagger/typescript-fetch-petstore", - "version": "0.0.1", - "license": "Unlicense", - "main": "./dist/api.js", - "browser": "./dist/api.js", - "typings": "./dist/api.d.ts", - "dependencies": { - "core-js": "^2.4.0", - "isomorphic-fetch": "^2.2.1" - }, - "scripts" : { - "prepublish" : "typings install && tsc", - "test": "tslint api.ts" - }, - "devDependencies": { - "tslint": "^3.15.1", - "typescript": "^1.8.10", - "typings": "^1.0.4" - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tslint.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tslint.json deleted file mode 100644 index 6eb02acec8c..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tslint.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "jsRules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - }, - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/typings.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/typings.json deleted file mode 100644 index a82ea152b4a..00000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/typings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": false, - "dependencies": {}, - "globalDependencies": { - "core-js": "registry:dt/core-js#0.0.0+20160317120654", - "node": "registry:dt/node#4.0.0+20160423143914", - "isomorphic-fetch": "registry:dt/isomorphic-fetch#0.0.0+20160505171433" - } -} diff --git a/samples/client/petstore/typescript-fetch/tests/default/typings.json b/samples/client/petstore/typescript-fetch/tests/default/typings.json deleted file mode 100644 index d05709202f7..00000000000 --- a/samples/client/petstore/typescript-fetch/tests/default/typings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "typescript-fetch-test", - "version": false, - "globalDependencies": { - "chai": "registry:dt/chai#3.4.0+20160317120654", - "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", - "mocha": "registry:dt/mocha#2.2.5+20160317120654" - } -} diff --git a/samples/client/petstore/typescript-fetch/tests/default/package.json b/samples/client/petstore/typescript-fetch/tests/npm/package.json similarity index 70% rename from samples/client/petstore/typescript-fetch/tests/default/package.json rename to samples/client/petstore/typescript-fetch/tests/npm/package.json index b95b42bc29e..f4090da2dd3 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/package.json +++ b/samples/client/petstore/typescript-fetch/tests/npm/package.json @@ -1,19 +1,19 @@ { "private": true, "dependencies": { - "chai": "^3.5.0" + "chai": "^3.5.0", + "mocha": "^3.4.2" }, "devDependencies": { + "@types/chai": "^4.0.1", + "@types/mocha": "^2.2.41", "browserify": "^13.0.1", "ts-loader": "^0.8.2", "tsify": "^0.16.0", - "typescript": "^1.8.10", - "typings": "^1.0.4", + "typescript": "2.0.10", "webpack": "^1.13.0" }, "scripts": { - "prepublish": "./scripts/prepublish.sh", - "pretest": "npm install mocha", "test": "mocha" }, "name": "typescript-fetch-test", diff --git a/samples/client/petstore/typescript-fetch/tests/default/pom.xml b/samples/client/petstore/typescript-fetch/tests/npm/pom.xml similarity index 100% rename from samples/client/petstore/typescript-fetch/tests/default/pom.xml rename to samples/client/petstore/typescript-fetch/tests/npm/pom.xml diff --git a/samples/client/petstore/typescript-fetch/tests/default/run_tests_via_browserify.html b/samples/client/petstore/typescript-fetch/tests/npm/run_tests_via_browserify.html similarity index 100% rename from samples/client/petstore/typescript-fetch/tests/default/run_tests_via_browserify.html rename to samples/client/petstore/typescript-fetch/tests/npm/run_tests_via_browserify.html diff --git a/samples/client/petstore/typescript-fetch/tests/default/run_tests_via_webpack.html b/samples/client/petstore/typescript-fetch/tests/npm/run_tests_via_webpack.html similarity index 100% rename from samples/client/petstore/typescript-fetch/tests/default/run_tests_via_webpack.html rename to samples/client/petstore/typescript-fetch/tests/npm/run_tests_via_webpack.html diff --git a/samples/client/petstore/typescript-fetch/tests/default/scripts/prepublish.sh b/samples/client/petstore/typescript-fetch/tests/npm/scripts/prepublish.sh old mode 100755 new mode 100644 similarity index 74% rename from samples/client/petstore/typescript-fetch/tests/default/scripts/prepublish.sh rename to samples/client/petstore/typescript-fetch/tests/npm/scripts/prepublish.sh index 3c0dfb05953..2fcbd19a58d --- a/samples/client/petstore/typescript-fetch/tests/default/scripts/prepublish.sh +++ b/samples/client/petstore/typescript-fetch/tests/npm/scripts/prepublish.sh @@ -1,7 +1,6 @@ #!/bin/bash -npm install ../../builds/default -typings install +npm install ../../builds/npm # Build Node.js tsc diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts b/samples/client/petstore/typescript-fetch/tests/npm/test/PetApi.ts similarity index 65% rename from samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts rename to samples/client/petstore/typescript-fetch/tests/npm/test/PetApi.ts index 528c1c8e32d..17110fb9d63 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/tests/npm/test/PetApi.ts @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {PetApi, Pet, Category} from 'typescript-fetch-api'; +import {PetApi, Pet, Category} from '@swagger/typescript-fetch-petstore'; describe('PetApi', () => { @@ -15,21 +15,21 @@ describe('PetApi', () => { }); it('should add and delete Pet', () => { - return api.addPet({ body: fixture }, requestOptions).then(() => { + return api.addPet(fixture, requestOptions).then(() => { }); }); it('should get Pet by ID', () => { - return api.getPetById({ petId: fixture.id }, requestOptions).then((result: Pet) => { + return api.getPetById(fixture.id, requestOptions).then((result) => { return expect(result).to.deep.equal(fixture); }); }); it('should update Pet by ID', () => { - return api.getPetById({ petId: fixture.id }, requestOptions).then( (result: Pet) => { + return api.getPetById(fixture.id, requestOptions).then( (result) => { result.name = 'newname'; - return api.updatePet({ body: result }, requestOptions).then(() => { - return api.getPetById({ petId: fixture.id }, requestOptions).then( (result: Pet) => { + return api.updatePet(result, requestOptions).then(() => { + return api.getPetById(fixture.id, requestOptions).then( (result) => { return expect(result.name).to.deep.equal('newname'); }); }); @@ -37,13 +37,13 @@ describe('PetApi', () => { }); it('should delete Pet', () => { - return api.deletePet({ petId: fixture.id }, requestOptions); + return api.deletePet(fixture.id, requestOptions); }); it('should not contain deleted Pet', () => { - return api.getPetById({ petId: fixture.id }, requestOptions).then((result: Pet) => { + return api.getPetById(fixture.id, requestOptions).then((result) => { return expect(result).to.not.exist; - }, (err: any) => { + }, (err) => { return expect(err).to.exist; }); }); @@ -71,7 +71,7 @@ function createTestFixture(ts = Date.now()) { 'name': `pet${ts}`, 'category': category, 'photoUrls': ['http://foo.bar.com/1', 'http://foo.bar.com/2'], - 'status': 'available', + 'status': Pet.StatusEnum.Available, 'tags': [] }; diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts b/samples/client/petstore/typescript-fetch/tests/npm/test/PetApiFactory.ts similarity index 52% rename from samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts rename to samples/client/petstore/typescript-fetch/tests/npm/test/PetApiFactory.ts index 87626db5b70..f4c87f3bdbe 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts +++ b/samples/client/petstore/typescript-fetch/tests/npm/test/PetApiFactory.ts @@ -1,22 +1,8 @@ import {expect} from 'chai'; -import {PetApiFactory, Pet, Category} from 'typescript-fetch-api'; -import {Configuration} from 'typescript-fetch-api/dist/configuration'; - -let config: Configuration; - -before(function() { - config = new Configuration(); - config.accessToken = "foobar"; - config.apiKey = { - api_key: "foobar" - }; - config.username = "foo"; - config.password = "bar"; -}); +import {PetApiFactory, Pet, Category} from '@swagger/typescript-fetch-petstore'; describe('PetApiFactory', () => { - function runSuite(description: string, requestOptions?: any): void { describe(description, () => { @@ -24,21 +10,21 @@ describe('PetApiFactory', () => { const fixture: Pet = createTestFixture(); it('should add and delete Pet', () => { - return PetApiFactory().addPet({ body: fixture }, config, requestOptions).then(() => { + return PetApiFactory().addPet(fixture, requestOptions).then(() => { }); }); it('should get Pet by ID', () => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then((result: Pet) => { + return PetApiFactory().getPetById(fixture.id, requestOptions).then((result) => { return expect(result).to.deep.equal(fixture); }); }); it('should update Pet by ID', () => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then( (result: Pet) => { + return PetApiFactory().getPetById(fixture.id, requestOptions).then( (result) => { result.name = 'newname'; - return PetApiFactory().updatePet({ body: result }, config, requestOptions).then(() => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then( (result: Pet) => { + return PetApiFactory().updatePet(result, requestOptions).then(() => { + return PetApiFactory().getPetById(fixture.id, requestOptions).then( (result) => { return expect(result.name).to.deep.equal('newname'); }); }); @@ -46,13 +32,13 @@ describe('PetApiFactory', () => { }); it('should delete Pet', () => { - return PetApiFactory().deletePet({ petId: fixture.id }, config, requestOptions); + return PetApiFactory().deletePet(fixture.id, requestOptions); }); it('should not contain deleted Pet', () => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then((result: Pet) => { + return PetApiFactory().getPetById(fixture.id, requestOptions).then((result) => { return expect(result).to.not.exist; - }, (err: any) => { + }, (err) => { return expect(err).to.exist; }); }); @@ -79,7 +65,7 @@ function createTestFixture(ts = Date.now()) { 'name': `pet${ts}`, 'category': category, 'photoUrls': ['http://foo.bar.com/1', 'http://foo.bar.com/2'], - 'status': 'available', + 'status': Pet.StatusEnum.Available, 'tags': [] }; diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts b/samples/client/petstore/typescript-fetch/tests/npm/test/StoreApi.ts similarity index 91% rename from samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts rename to samples/client/petstore/typescript-fetch/tests/npm/test/StoreApi.ts index 693bb1b2b52..cc228035db5 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/tests/npm/test/StoreApi.ts @@ -1,5 +1,5 @@ import {expect} from 'chai'; -import {StoreApi} from 'typescript-fetch-api'; +import {StoreApi} from '@swagger/typescript-fetch-petstore'; describe('StoreApi', function() { diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts b/samples/client/petstore/typescript-fetch/tests/npm/test/StoreApiFactory.ts similarity index 50% rename from samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts rename to samples/client/petstore/typescript-fetch/tests/npm/test/StoreApiFactory.ts index 1f1fd54b009..b2374b08ca2 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts +++ b/samples/client/petstore/typescript-fetch/tests/npm/test/StoreApiFactory.ts @@ -1,26 +1,16 @@ import {expect} from 'chai'; -import {StoreApiFactory} from 'typescript-fetch-api'; -import {Configuration} from 'typescript-fetch-api/dist/configuration'; - -let config: Configuration; - -before(function() { - config = new Configuration(); - config.accessToken = "foobar"; - config.apiKey = { - api_key: "foobar" - }; - config.username = "foo"; - config.password = "bar"; -}); +import {StoreApiFactory} from '@swagger/typescript-fetch-petstore'; describe('StoreApiFactory', function() { + function runSuite(description: string, requestOptions?: any): void { describe(description, () => { + const requestOptions: any = {credentials: 'include', mode: 'cors'}; + it('should get inventory', function() { - return StoreApiFactory().getInventory(config, requestOptions).then((result: { [key: string]: number }) => { + return StoreApiFactory().getInventory(requestOptions).then((result) => { expect(Object.keys(result)).to.not.be.empty; }); }); diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/index.ts b/samples/client/petstore/typescript-fetch/tests/npm/test/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/tests/default/test/index.ts rename to samples/client/petstore/typescript-fetch/tests/npm/test/index.ts diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/mocha.opts b/samples/client/petstore/typescript-fetch/tests/npm/test/mocha.opts similarity index 100% rename from samples/client/petstore/typescript-fetch/tests/default/test/mocha.opts rename to samples/client/petstore/typescript-fetch/tests/npm/test/mocha.opts diff --git a/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json b/samples/client/petstore/typescript-fetch/tests/npm/tsconfig.json similarity index 55% rename from samples/client/petstore/typescript-fetch/tests/default/tsconfig.json rename to samples/client/petstore/typescript-fetch/tests/npm/tsconfig.json index e47c2647e01..e41ab9ac270 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/tests/npm/tsconfig.json @@ -5,12 +5,16 @@ "noImplicitAny": true, "sourceMap": false, "outDir": "dist", - "rootDir": "." + "rootDir": ".", + "lib": [ + "es6", + "dom" + ], + "types": [ + "mocha" + ] }, "exclude": [ - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" + "node_modules" ] } \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/tests/default/webpack.config.js b/samples/client/petstore/typescript-fetch/tests/npm/webpack.config.js similarity index 100% rename from samples/client/petstore/typescript-fetch/tests/default/webpack.config.js rename to samples/client/petstore/typescript-fetch/tests/npm/webpack.config.js diff --git a/samples/client/petstore/typescript-fetch/tests/npm/yarn.lock b/samples/client/petstore/typescript-fetch/tests/npm/yarn.lock new file mode 100644 index 00000000000..bbc3188e687 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/tests/npm/yarn.lock @@ -0,0 +1,1971 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/chai@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.0.1.tgz#37fea779617cfec3fd2b19a0247e8bbdd5133bf6" + +"@types/mocha@^2.2.41": + version "2.2.41" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608" + +JSONStream@^1.0.3: + version "1.3.1" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.1.tgz#707f761e01dae9e16f1bcf93703b78c70966579a" + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + +abbrev@1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f" + +acorn@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^4.0.3: + version "4.0.13" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + +ajv@^4.9.1: + version "4.11.8" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +anymatch@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" + dependencies: + arrify "^1.0.0" + micromatch "^2.1.5" + +aproba@^1.0.3: + version "1.1.2" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.2.tgz#45c6629094de4e96f693ef7eab74ae079c240fc1" + +are-we-there-yet@~1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + +arr-flatten@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +array-filter@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" + +array-map@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" + +array-reduce@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1, array-uniq@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +assert@^1.1.1, assert@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" + dependencies: + util "0.10.3" + +assertion-error@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" + +astw@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/astw/-/astw-2.2.0.tgz#7bd41784d32493987aeb239b6b4e1c57a873b917" + dependencies: + acorn "^4.0.3" + +async-each@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" + +async@^0.9.0: + version "0.9.2" + resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + +async@^1.3.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +async@~0.2.6: + version "0.2.10" + resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws4@^1.2.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +base64-js@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.1.tgz#a91947da1f4a516ea38e5b4ec0ec3773675e0886" + +bcrypt-pbkdf@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + dependencies: + tweetnacl "^0.14.3" + +big.js@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.1.3.tgz#4cada2193652eb3ca9ec8e55c9015669c9806978" + +binary-extensions@^1.0.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774" + +block-stream@*: + version "0.0.9" + resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + dependencies: + inherits "~2.0.0" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +browser-pack@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.0.2.tgz#f86cd6cef4f5300c8e63e07a4d512f65fbff4531" + dependencies: + JSONStream "^1.0.3" + combine-source-map "~0.7.1" + defined "^1.0.0" + through2 "^2.0.0" + umd "^3.0.0" + +browser-resolve@^1.11.0, browser-resolve@^1.7.0: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +browserify-aes@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-0.4.0.tgz#067149b668df31c4b58533e02d01e806d8608e2c" + dependencies: + inherits "^2.0.1" + +browserify-zlib@^0.1.4, browserify-zlib@~0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" + dependencies: + pako "~0.2.0" + +browserify@^13.0.1: + version "13.3.0" + resolved "https://registry.yarnpkg.com/browserify/-/browserify-13.3.0.tgz#b5a9c9020243f0c70e4675bec8223bc627e415ce" + dependencies: + JSONStream "^1.0.3" + assert "^1.4.0" + browser-pack "^6.0.1" + browser-resolve "^1.11.0" + browserify-zlib "~0.1.2" + buffer "^4.1.0" + cached-path-relative "^1.0.0" + concat-stream "~1.5.1" + console-browserify "^1.1.0" + constants-browserify "~1.0.0" + crypto-browserify "^3.0.0" + defined "^1.0.0" + deps-sort "^2.0.0" + domain-browser "~1.1.0" + duplexer2 "~0.1.2" + events "~1.1.0" + glob "^7.1.0" + has "^1.0.0" + htmlescape "^1.1.0" + https-browserify "~0.0.0" + inherits "~2.0.1" + insert-module-globals "^7.0.0" + labeled-stream-splicer "^2.0.0" + module-deps "^4.0.8" + os-browserify "~0.1.1" + parents "^1.0.1" + path-browserify "~0.0.0" + process "~0.11.0" + punycode "^1.3.2" + querystring-es3 "~0.2.0" + read-only-stream "^2.0.0" + readable-stream "^2.0.2" + resolve "^1.1.4" + shasum "^1.0.0" + shell-quote "^1.6.1" + stream-browserify "^2.0.0" + stream-http "^2.0.0" + string_decoder "~0.10.0" + subarg "^1.0.0" + syntax-error "^1.1.1" + through2 "^2.0.0" + timers-browserify "^1.0.1" + tty-browserify "~0.0.0" + url "~0.11.0" + util "~0.10.1" + vm-browserify "~0.0.1" + xtend "^4.0.0" + +buffer@^4.1.0, buffer@^4.9.0: + version "4.9.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + isarray "^1.0.0" + +builtin-status-codes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + +cached-path-relative@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.1.tgz#d09c4b52800aa4c078e2dd81a869aac90d2e54e7" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chai@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" + dependencies: + assertion-error "^1.0.1" + deep-eql "^0.1.3" + type-detect "^1.0.0" + +chokidar@^1.0.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +clone@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +colors@^1.0.3: + version "1.1.2" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" + +combine-source-map@~0.7.1: + version "0.7.2" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.7.2.tgz#0870312856b307a87cc4ac486f3a9a62aeccc09e" + dependencies: + convert-source-map "~1.1.0" + inline-source-map "~0.6.0" + lodash.memoize "~3.0.3" + source-map "~0.5.3" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@~1.5.0, concat-stream@~1.5.1: + version "1.5.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266" + dependencies: + inherits "~2.0.1" + readable-stream "~2.0.0" + typedarray "~0.0.5" + +console-browserify@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" + dependencies: + date-now "^0.1.4" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + +constants-browserify@^1.0.0, constants-browserify@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + +convert-source-map@^1.1.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" + +convert-source-map@~1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +crypto-browserify@3.3.0, crypto-browserify@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.3.0.tgz#b9fc75bb4a0ed61dcf1cd5dae96eb30c9c3e506c" + dependencies: + browserify-aes "0.4.0" + pbkdf2-compat "2.0.1" + ripemd160 "0.2.0" + sha.js "2.2.6" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + dependencies: + assert-plus "^1.0.0" + +date-now@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" + +debug@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + dependencies: + ms "0.7.2" + +debug@^2.2.0: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + dependencies: + ms "2.0.0" + +decamelize@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +deep-eql@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" + dependencies: + type-detect "0.1.1" + +deep-extend@~0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" + +defined@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + +deps-sort@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.0.tgz#091724902e84658260eb910748cccd1af6e21fb5" + dependencies: + JSONStream "^1.0.3" + shasum "^1.0.0" + subarg "^1.0.0" + through2 "^2.0.0" + +detective@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/detective/-/detective-4.5.0.tgz#6e5a8c6b26e6c7a254b1c6b6d7490d98ec91edd1" + dependencies: + acorn "^4.0.3" + defined "^1.0.0" + +diff@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" + +domain-browser@^1.1.1, domain-browser@~1.1.0: + version "1.1.7" + resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" + +duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + dependencies: + readable-stream "^2.0.2" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.0" + +emojis-list@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" + +enhanced-resolve@^0.9.0, enhanced-resolve@~0.9.0: + version "0.9.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz#4d6e689b3725f86090927ccc86cd9f1635b89e2e" + dependencies: + graceful-fs "^4.1.2" + memory-fs "^0.2.0" + tapable "^0.1.8" + +errno@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" + dependencies: + prr "~0.0.0" + +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + +escape-string-regexp@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +events@^1.0.0, events@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +extend@~3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + +extsprintf@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + +fill-range@^2.1.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^1.1.3" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + dependencies: + for-in "^1.0.1" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + +form-data@~2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +fsevents@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.2.tgz#3282b713fb3ad80ede0e9fcf4611b5aa6fc033f4" + dependencies: + nan "^2.3.0" + node-pre-gyp "^0.6.36" + +fstream-ignore@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" + dependencies: + fstream "^1.0.0" + inherits "2" + minimatch "^3.0.0" + +fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: + version "1.0.11" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" + dependencies: + graceful-fs "^4.1.2" + inherits "~2.0.0" + mkdirp ">=0.5 0" + rimraf "2" + +function-bind@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + dependencies: + assert-plus "^1.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + +glob@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^6.0.1: + version "6.0.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.5, glob@^7.1.0: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globby@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-4.1.0.tgz#080f54549ec1b82a6c60e631fc82e1211dbe95f8" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^6.0.1" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +har-schema@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" + +har-validator@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" + dependencies: + ajv "^4.9.1" + har-schema "^1.0.5" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + +has@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + +hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +htmlescape@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +https-browserify@0.0.1, https-browserify@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" + +ieee754@^1.1.4: + version "1.1.8" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" + +indexof@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +inherits@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + +ini@~1.3.0: + version "1.3.4" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + +inline-source-map@~0.6.0: + version "0.6.2" + resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" + dependencies: + source-map "~0.5.3" + +insert-module-globals@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.1.tgz#c03bf4e01cb086d5b5e5ace8ad0afe7889d638c3" + dependencies: + JSONStream "^1.0.3" + combine-source-map "~0.7.1" + concat-stream "~1.5.1" + is-buffer "^1.1.0" + lexical-scope "^1.2.0" + process "~0.11.0" + through2 "^2.0.0" + xtend "^4.0.0" + +interpret@^0.6.4: + version "0.6.6" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-0.6.6.tgz#fecd7a18e7ce5ca6abfb953e1f86213a49f1625b" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + dependencies: + binary-extensions "^1.0.0" + +is-buffer@^1.1.0, is-buffer@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isarray@~0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json-stable-stringify@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +json5@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsonparse@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + +jsprim@^1.2.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.0.tgz#a3b87e40298d8c380552d8cc7628a0bb95a22918" + dependencies: + assert-plus "1.0.0" + extsprintf "1.0.2" + json-schema "0.2.3" + verror "1.3.6" + +kind-of@^3.0.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + dependencies: + is-buffer "^1.1.5" + +labeled-stream-splicer@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz#a52e1d138024c00b86b1c0c91f677918b8ae0a59" + dependencies: + inherits "^2.0.1" + isarray "~0.0.1" + stream-splicer "^2.0.0" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +lexical-scope@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/lexical-scope/-/lexical-scope-1.2.0.tgz#fcea5edc704a4b3a8796cdca419c3a0afaf22df4" + dependencies: + astw "^2.0.0" + +loader-utils@^0.2.11, loader-utils@^0.2.6: + version "0.2.17" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" + dependencies: + big.js "^3.1.3" + emojis-list "^2.0.0" + json5 "^0.5.0" + object-assign "^4.0.1" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash.memoize@~3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +memory-fs@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290" + +memory-fs@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.3.0.tgz#7bcc6b629e3a43e871d7e29aca6ae8a7f15cbb20" + dependencies: + errno "^0.1.3" + readable-stream "^2.0.1" + +micromatch@^2.1.5: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +mime-db@~1.27.0: + version "1.27.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1" + +mime-types@^2.1.12, mime-types@~2.1.7: + version "2.1.15" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed" + dependencies: + mime-db "~1.27.0" + +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8, minimist@~0.0.1: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.1.0, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.1, mkdirp@~0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@^3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.4.2.tgz#d0ef4d332126dbf18d0d640c9b382dd48be97594" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.6.0" + diff "3.2.0" + escape-string-regexp "1.0.5" + glob "7.1.1" + growl "1.9.2" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +module-deps@^4.0.8: + version "4.1.1" + resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-4.1.1.tgz#23215833f1da13fd606ccb8087b44852dcb821fd" + dependencies: + JSONStream "^1.0.3" + browser-resolve "^1.7.0" + cached-path-relative "^1.0.0" + concat-stream "~1.5.0" + defined "^1.0.0" + detective "^4.0.0" + duplexer2 "^0.1.2" + inherits "^2.0.1" + parents "^1.0.0" + readable-stream "^2.0.2" + resolve "^1.1.3" + stream-combiner2 "^1.1.1" + subarg "^1.0.0" + through2 "^2.0.0" + xtend "^4.0.0" + +ms@0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +nan@^2.3.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" + +node-libs-browser@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-0.7.0.tgz#3e272c0819e308935e26674408d7af0e1491b83b" + dependencies: + assert "^1.1.1" + browserify-zlib "^0.1.4" + buffer "^4.9.0" + console-browserify "^1.1.0" + constants-browserify "^1.0.0" + crypto-browserify "3.3.0" + domain-browser "^1.1.1" + events "^1.0.0" + https-browserify "0.0.1" + os-browserify "^0.2.0" + path-browserify "0.0.0" + process "^0.11.0" + punycode "^1.2.4" + querystring-es3 "^0.2.0" + readable-stream "^2.0.5" + stream-browserify "^2.0.1" + stream-http "^2.3.1" + string_decoder "^0.10.25" + timers-browserify "^2.0.2" + tty-browserify "0.0.0" + url "^0.11.0" + util "^0.10.3" + vm-browserify "0.0.4" + +node-pre-gyp@^0.6.36: + version "0.6.36" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz#db604112cb74e0d477554e9b505b17abddfab786" + dependencies: + mkdirp "^0.5.1" + nopt "^4.0.1" + npmlog "^4.0.2" + rc "^1.1.7" + request "^2.81.0" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^2.2.1" + tar-pack "^3.4.0" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + dependencies: + abbrev "1" + osenv "^0.1.4" + +normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + dependencies: + remove-trailing-separator "^1.0.1" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +oauth-sign@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +object-assign@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-2.1.1.tgz#43c36e5d569ff8e4816c4efa8be02d26967c18aa" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +once@^1.3.0, once@^1.3.3: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +optimist@~0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +os-browserify@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.2.1.tgz#63fc4ccee5d2d7763d26bbf8601078e6c2e0044f" + +os-browserify@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.1.2.tgz#49ca0293e0b19590a5f5de10c7f265a617d8fe54" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +os-tmpdir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +osenv@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +pako@~0.2.0: + version "0.2.9" + resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" + +parents@^1.0.0, parents@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" + dependencies: + path-platform "~0.11.15" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +path-browserify@0.0.0, path-browserify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-platform@~0.11.15: + version "0.11.15" + resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" + +pbkdf2-compat@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz#b6e0c8fa99494d94e0511575802a59a5c142f288" + +performance-now@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +process@^0.11.0, process@~0.11.0: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + +prr@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + +punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@~6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + +querystring-es3@^0.2.0, querystring-es3@~0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" + +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + +randomatic@^1.1.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +rc@^1.1.7: + version "1.2.1" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" + dependencies: + deep-extend "~0.4.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +read-only-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" + dependencies: + readable-stream "^2.0.2" + +readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.6: + version "2.3.3" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" + util-deprecate "~1.0.1" + +readable-stream@~2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readdirp@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" + dependencies: + graceful-fs "^4.1.2" + minimatch "^3.0.2" + readable-stream "^2.0.2" + set-immediate-shim "^1.0.1" + +regex-cache@^0.4.2: + version "0.4.3" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" + dependencies: + is-equal-shallow "^0.1.3" + is-primitive "^2.0.0" + +remove-trailing-separator@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz#69b062d978727ad14dc6b56ba4ab772fd8d70511" + +repeat-element@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +request@^2.81.0: + version "2.81.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~4.2.1" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + performance-now "^0.2.0" + qs "~6.4.0" + safe-buffer "^5.0.1" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "^0.6.0" + uuid "^3.0.0" + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.3, resolve@^1.1.4: + version "1.3.3" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" + dependencies: + path-parse "^1.0.5" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + dependencies: + glob "^7.0.5" + +ripemd160@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-0.2.0.tgz#2bf198bde167cacfa51c0a928e84b68bbe171fce" + +safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + +semver@^5.0.1, semver@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + +set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +set-immediate-shim@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + +setimmediate@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + +sha.js@2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.2.6.tgz#17ddeddc5f722fb66501658895461977867315ba" + +sha.js@~2.4.4: + version "2.4.8" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.8.tgz#37068c2c476b6baf402d14a49c67f597921f634f" + dependencies: + inherits "^2.0.1" + +shasum@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" + dependencies: + json-stable-stringify "~0.0.0" + sha.js "~2.4.4" + +shell-quote@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" + dependencies: + array-filter "~0.0.0" + array-map "~0.0.0" + array-reduce "~0.0.0" + jsonify "~0.0.0" + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +source-list-map@~0.1.7: + version "0.1.8" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" + +source-map@~0.4.1: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + +source-map@~0.5.1, source-map@~0.5.3: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + +sshpk@^1.7.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +stream-browserify@^2.0.0, stream-browserify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" + dependencies: + inherits "~2.0.1" + readable-stream "^2.0.2" + +stream-combiner2@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" + dependencies: + duplexer2 "~0.1.0" + readable-stream "^2.0.2" + +stream-http@^2.0.0, stream-http@^2.3.1: + version "2.7.2" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.7.2.tgz#40a050ec8dc3b53b33d9909415c02c0bf1abfbad" + dependencies: + builtin-status-codes "^3.0.0" + inherits "^2.0.1" + readable-stream "^2.2.6" + to-arraybuffer "^1.0.0" + xtend "^4.0.0" + +stream-splicer@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.0.tgz#1b63be438a133e4b671cc1935197600175910d83" + dependencies: + inherits "^2.0.1" + readable-stream "^2.0.2" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string_decoder@^0.10.25, string_decoder@~0.10.0, string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + dependencies: + safe-buffer "~5.1.0" + +stringstream@~0.0.4: + version "0.0.5" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + dependencies: + is-utf8 "^0.2.0" + +strip-json-comments@^2.0.0, strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +subarg@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" + dependencies: + minimist "^1.1.0" + +supports-color@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^3.1.0: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + +syntax-error@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.3.0.tgz#1ed9266c4d40be75dc55bf9bb1cb77062bb96ca1" + dependencies: + acorn "^4.0.3" + +tapable@^0.1.8, tapable@~0.1.8: + version "0.1.10" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" + +tar-pack@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984" + dependencies: + debug "^2.2.0" + fstream "^1.0.10" + fstream-ignore "^1.0.5" + once "^1.3.3" + readable-stream "^2.1.4" + rimraf "^2.5.1" + tar "^2.2.1" + uid-number "^0.0.6" + +tar@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" + dependencies: + block-stream "*" + fstream "^1.0.2" + inherits "2" + +through2@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" + dependencies: + readable-stream "^2.1.5" + xtend "~4.0.1" + +"through@>=2.2.7 <3": + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +timers-browserify@^1.0.1: + version "1.4.2" + resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d" + dependencies: + process "~0.11.0" + +timers-browserify@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.2.tgz#ab4883cf597dcd50af211349a00fbca56ac86b86" + dependencies: + setimmediate "^1.0.4" + +to-arraybuffer@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" + +tough-cookie@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + dependencies: + punycode "^1.4.1" + +ts-loader@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-0.8.2.tgz#7331296d13d5b3105cd905cebca39143eed2b255" + dependencies: + arrify "^1.0.0" + colors "^1.0.3" + enhanced-resolve "^0.9.0" + loader-utils "^0.2.6" + object-assign "^2.0.0" + semver "^5.0.1" + +tsconfig@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-2.2.0.tgz#7fc16e2790dab70c049bd861c1c532bb770e0837" + dependencies: + array-uniq "^1.0.2" + globby "^4.0.0" + parse-json "^2.2.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + strip-json-comments "^2.0.0" + xtend "^4.0.0" + +tsify@^0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/tsify/-/tsify-0.16.0.tgz#c29a84794bf1d86bb65977113a3b5f03acb84a9f" + dependencies: + commondir "^1.0.1" + convert-source-map "^1.1.0" + through2 "^2.0.0" + tsconfig "^2.2.0" + typescript "~1.8.7" + +tty-browserify@0.0.0, tty-browserify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +type-detect@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" + +type-detect@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" + +typedarray@~0.0.5: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +typescript@2.0.10: + version "2.0.10" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.0.10.tgz#ccdd4ed86fd5550a407101a0814012e1b3fac3dd" + +typescript@~1.8.7: + version "1.8.10" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e" + +uglify-js@~2.7.3: + version "2.7.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" + dependencies: + async "~0.2.6" + source-map "~0.5.1" + uglify-to-browserify "~1.0.0" + yargs "~3.10.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +uid-number@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + +umd@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.1.tgz#8ae556e11011f63c2596708a8837259f01b3d60e" + +url@^0.11.0, url@~0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + dependencies: + punycode "1.3.2" + querystring "0.2.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +util@0.10.3, util@^0.10.3, util@~0.10.1: + version "0.10.3" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + dependencies: + inherits "2.0.1" + +uuid@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + +verror@1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" + dependencies: + extsprintf "1.0.2" + +vm-browserify@0.0.4, vm-browserify@~0.0.1: + version "0.0.4" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" + dependencies: + indexof "0.0.1" + +watchpack@^0.2.1: + version "0.2.9" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-0.2.9.tgz#62eaa4ab5e5ba35fdfc018275626e3c0f5e3fb0b" + dependencies: + async "^0.9.0" + chokidar "^1.0.0" + graceful-fs "^4.1.2" + +webpack-core@~0.6.9: + version "0.6.9" + resolved "https://registry.yarnpkg.com/webpack-core/-/webpack-core-0.6.9.tgz#fc571588c8558da77be9efb6debdc5a3b172bdc2" + dependencies: + source-list-map "~0.1.7" + source-map "~0.4.1" + +webpack@^1.13.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-1.15.0.tgz#4ff31f53db03339e55164a9d468ee0324968fe98" + dependencies: + acorn "^3.0.0" + async "^1.3.0" + clone "^1.0.2" + enhanced-resolve "~0.9.0" + interpret "^0.6.4" + loader-utils "^0.2.11" + memory-fs "~0.3.0" + mkdirp "~0.5.0" + node-libs-browser "^0.7.0" + optimist "~0.6.0" + supports-color "^3.1.0" + tapable "~0.1.8" + uglify-js "~2.7.3" + watchpack "^0.2.1" + webpack-core "~0.6.9" + +wide-align@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" + dependencies: + string-width "^1.0.2" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +xtend@^4.0.0, xtend@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" diff --git a/samples/server/petstore/nodejs/controllers/PetService.js b/samples/server/petstore/nodejs/controllers/PetService.js new file mode 100644 index 00000000000..36f34342741 --- /dev/null +++ b/samples/server/petstore/nodejs/controllers/PetService.js @@ -0,0 +1,166 @@ +'use strict'; + +exports.addPet = function(args, res, next) { + /** + * Add a new pet to the store + * + * + * body Pet Pet object that needs to be added to the store + * no response value expected for this operation + **/ + res.end(); +} + +exports.deletePet = function(args, res, next) { + /** + * Deletes a pet + * + * + * petId Long Pet id to delete + * api_key String (optional) + * no response value expected for this operation + **/ + res.end(); +} + +exports.findPetsByStatus = function(args, res, next) { + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * status List Status values that need to be considered for filter + * returns List + **/ + var examples = {}; + examples['application/json'] = [ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "aeiou", + "id" : 6 + }, + "tags" : [ { + "name" : "aeiou", + "id" : 1 + } ], + "status" : "available" +} ]; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.findPetsByTags = function(args, res, next) { + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * tags List Tags to filter by + * returns List + **/ + var examples = {}; + examples['application/json'] = [ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "aeiou", + "id" : 6 + }, + "tags" : [ { + "name" : "aeiou", + "id" : 1 + } ], + "status" : "available" +} ]; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.getPetById = function(args, res, next) { + /** + * Find pet by ID + * Returns a single pet + * + * petId Long ID of pet to return + * returns Pet + **/ + var examples = {}; + examples['application/json'] = { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", + "id" : 0, + "category" : { + "name" : "aeiou", + "id" : 6 + }, + "tags" : [ { + "name" : "aeiou", + "id" : 1 + } ], + "status" : "available" +}; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.updatePet = function(args, res, next) { + /** + * Update an existing pet + * + * + * body Pet Pet object that needs to be added to the store + * no response value expected for this operation + **/ + res.end(); +} + +exports.updatePetWithForm = function(args, res, next) { + /** + * Updates a pet in the store with form data + * + * + * petId Long ID of pet that needs to be updated + * name String Updated name of the pet (optional) + * status String Updated status of the pet (optional) + * no response value expected for this operation + **/ + res.end(); +} + +exports.uploadFile = function(args, res, next) { + /** + * uploads an image + * + * + * petId Long ID of pet to update + * additionalMetadata String Additional data to pass to server (optional) + * file File file to upload (optional) + * returns ApiResponse + **/ + var examples = {}; + examples['application/json'] = { + "code" : 0, + "type" : "aeiou", + "message" : "aeiou" +}; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + diff --git a/samples/server/petstore/nodejs/controllers/StoreService.js b/samples/server/petstore/nodejs/controllers/StoreService.js new file mode 100644 index 00000000000..be99ec7acbc --- /dev/null +++ b/samples/server/petstore/nodejs/controllers/StoreService.js @@ -0,0 +1,82 @@ +'use strict'; + +exports.deleteOrder = function(args, res, next) { + /** + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * orderId String ID of the order that needs to be deleted + * no response value expected for this operation + **/ + res.end(); +} + +exports.getInventory = function(args, res, next) { + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * + * returns Map + **/ + var examples = {}; + examples['application/json'] = { + "key" : 0 +}; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.getOrderById = function(args, res, next) { + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * orderId Long ID of pet that needs to be fetched + * returns Order + **/ + var examples = {}; + examples['application/json'] = { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" +}; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.placeOrder = function(args, res, next) { + /** + * Place an order for a pet + * + * + * body Order order placed for purchasing the pet + * returns Order + **/ + var examples = {}; + examples['application/json'] = { + "petId" : 6, + "quantity" : 1, + "id" : 0, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : false, + "status" : "placed" +}; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + diff --git a/samples/server/petstore/nodejs/controllers/UserService.js b/samples/server/petstore/nodejs/controllers/UserService.js new file mode 100644 index 00000000000..d15268eee68 --- /dev/null +++ b/samples/server/petstore/nodejs/controllers/UserService.js @@ -0,0 +1,114 @@ +'use strict'; + +exports.createUser = function(args, res, next) { + /** + * Create user + * This can only be done by the logged in user. + * + * body User Created user object + * no response value expected for this operation + **/ + res.end(); +} + +exports.createUsersWithArrayInput = function(args, res, next) { + /** + * Creates list of users with given input array + * + * + * body List List of user object + * no response value expected for this operation + **/ + res.end(); +} + +exports.createUsersWithListInput = function(args, res, next) { + /** + * Creates list of users with given input array + * + * + * body List List of user object + * no response value expected for this operation + **/ + res.end(); +} + +exports.deleteUser = function(args, res, next) { + /** + * Delete user + * This can only be done by the logged in user. + * + * username String The name that needs to be deleted + * no response value expected for this operation + **/ + res.end(); +} + +exports.getUserByName = function(args, res, next) { + /** + * Get user by user name + * + * + * username String The name that needs to be fetched. Use user1 for testing. + * returns User + **/ + var examples = {}; + examples['application/json'] = { + "firstName" : "aeiou", + "lastName" : "aeiou", + "password" : "aeiou", + "userStatus" : 6, + "phone" : "aeiou", + "id" : 0, + "email" : "aeiou", + "username" : "aeiou" +}; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.loginUser = function(args, res, next) { + /** + * Logs user into the system + * + * + * username String The user name for login + * password String The password for login in clear text + * returns String + **/ + var examples = {}; + examples['application/json'] = "aeiou"; + if (Object.keys(examples).length > 0) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); + } else { + res.end(); + } +} + +exports.logoutUser = function(args, res, next) { + /** + * Logs out current logged in user session + * + * + * no response value expected for this operation + **/ + res.end(); +} + +exports.updateUser = function(args, res, next) { + /** + * Updated user + * This can only be done by the logged in user. + * + * username String name that need to be deleted + * body User Updated user object + * no response value expected for this operation + **/ + res.end(); +} +