diff --git a/bin/security/typescript-fetch.sh b/bin/security/typescript-fetch-petstore.sh similarity index 85% rename from bin/security/typescript-fetch.sh rename to bin/security/typescript-fetch-petstore.sh index 6b8757a5fb9..17c61cf26ed 100755 --- a/bin/security/typescript-fetch.sh +++ b/bin/security/typescript-fetch-petstore.sh @@ -26,6 +26,6 @@ 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 -t modules/swagger-codegen/src/main/resources/TypeScript-Fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/typescript-fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-target-es6.json b/bin/typescript-fetch-petstore-target-es6.json index 83914bd569c..b87d9e8521d 100644 --- a/bin/typescript-fetch-petstore-target-es6.json +++ b/bin/typescript-fetch-petstore-target-es6.json @@ -1,3 +1,7 @@ { + "npmName": "@swagger/typescript-fetch-petstore", + "npmVersion": "1.0.0", + "npmRepository" : "https://skimdb.npmjs.com/registry", + "snapshot" : false, "supportsES6": true } diff --git a/bin/typescript-fetch-petstore-with-npm-version.json b/bin/typescript-fetch-petstore-with-npm-version.json index b8193c8fa74..40b04115a3f 100644 --- a/bin/typescript-fetch-petstore-with-npm-version.json +++ b/bin/typescript-fetch-petstore-with-npm-version.json @@ -1,4 +1,6 @@ { "npmName": "@swagger/typescript-fetch-petstore", - "npmVersion": "0.0.1" + "npmVersion": "1.0.0", + "npmRepository" : "https://skimdb.npmjs.com/registry", + "snapshot" : false } diff --git a/bin/windows/typescript-fetch-petstore-all.bat b/bin/windows/typescript-fetch-petstore-all.bat new file mode 100644 index 00000000000..ed41df84bb5 --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-all.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +call bin\windows\typescript-fetch-petstore.bat +call bin\windows\typescript-fetch-petstore-target-es6.bat +call bin\windows\typescript-fetch-petstore-with-npm-version.bat diff --git a/bin/windows/typescript-fetch-petstore-target-es6.bat b/bin/windows/typescript-fetch-petstore-target-es6.bat new file mode 100644 index 00000000000..99a1f26429e --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-target-es6.bat @@ -0,0 +1,12 @@ +@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 +set 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 + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch-petstore-with-npm-version.bat b/bin/windows/typescript-fetch-petstore-with-npm-version.bat new file mode 100644 index 00000000000..30cdf1a9d44 --- /dev/null +++ b/bin/windows/typescript-fetch-petstore-with-npm-version.bat @@ -0,0 +1,12 @@ +@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 +set 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 + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-fetch.bat b/bin/windows/typescript-fetch-petstore.bat old mode 100755 new mode 100644 similarity index 87% rename from bin/windows/typescript-fetch.bat rename to bin/windows/typescript-fetch-petstore.bat index a2b45b39901..a2732b88748 --- a/bin/windows/typescript-fetch.bat +++ b/bin/windows/typescript-fetch-petstore.bat @@ -1,3 +1,5 @@ +@ECHO OFF + set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar If Not Exist %executable% ( @@ -5,6 +7,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 +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/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..960b5117e3f 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 @@ -4,19 +4,24 @@ import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.SupportingFile; +import io.swagger.models.ModelImpl; +import io.swagger.models.properties.*; import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; +import java.text.SimpleDateFormat; +import java.util.*; 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(); @@ -26,31 +31,74 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege importMapping.clear(); outputFolder = "generated-code/typescript-fetch"; - embeddedTemplateDir = templateDir = "TypeScript-Fetch"; + 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("index.mustache", "", "index.ts")); 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")); supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); - if(additionalProperties.containsKey(NPM_NAME)) { + if (additionalProperties.containsKey(NPM_NAME)) { + addNpmPackageGeneration(); + } + } + + @Override + public String getTypeDeclaration(Property p) { + Property inner; + if(p instanceof ArrayProperty) { + ArrayProperty mp1 = (ArrayProperty)p; + inner = mp1.getItems(); + return this.getSwaggerType(p) + "<" + this.getTypeDeclaration(inner) + ">"; + } else if(p instanceof MapProperty) { + MapProperty mp = (MapProperty)p; + inner = mp.getAdditionalProperties(); + return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; + } else if(p instanceof FileProperty || p instanceof ObjectProperty) { + return "any"; + } else { + return super.getTypeDeclaration(p); + } + } + + private void addNpmPackageGeneration() { + if (additionalProperties.containsKey(NPM_NAME)) { this.setNpmName(additionalProperties.get(NPM_NAME).toString()); } 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.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); } @Override @@ -79,24 +127,12 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege 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; - } - } - } + public String getNpmRepository() { + return npmRepository; + } - return objs; + 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/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache deleted file mode 100644 index ad6e13e69b9..00000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/api.mustache +++ /dev/null @@ -1,255 +0,0 @@ -{{>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; } - -const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); - -export interface FetchArgs { - url: string; - options: any; -} - -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; - } -}; - -{{#models}} -{{#model}} -{{#description}} -/** - * {{{description}}} - */ -{{/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}} -} -{{/isEnum}} - -{{#hasEnums}} -{{#vars}} -{{#isEnum}} -export type {{{enumName}}} = {{#allowableValues}}{{#values}}"{{{.}}}"{{^-last}} | {{/-last}}{{/values}}{{/allowableValues}}; -{{/isEnum}} -{{/vars}} -{{/hasEnums}} -{{/model}} -{{/models}} - -{{#apiInfo}} -{{#apis}} -{{#operations}} - -/** - * {{classname}} - fetch parameter creator{{#description}} - * {{&description}}{{/description}} - */ -export const {{classname}}FetchParamCreator = { -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{paramName}} {{description}} - {{/allParams}} - */ - {{nickname}}({{#hasParams}}params: { {{#allParams}} {{paramName}}{{^required}}?{{/required}}: {{{dataType}}};{{/allParams}} }, {{/hasParams}}{{#hasAuthMethods}}configuration: Configuration, {{/hasAuthMethods}}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}}"); - } -{{/required}} -{{/allParams}} - const baseUrl = `{{{path}}}`{{#pathParams}} - .replace(`{${"{{baseName}}"}}`, `${ params["{{paramName}}"] }`){{/pathParams}}; - let urlObj = url.parse(baseUrl, true); -{{#hasQueryParams}} - urlObj.query = {{#supportsES6}}Object.{{/supportsES6}}assign({}, urlObj.query); - {{#queryParams}} - if (params["{{paramName}}"] !== undefined) { - urlObj.query["{{baseName}}"] = params["{{paramName}}"]; - } - {{/queryParams}} -{{/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}} - }); -{{/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); - } -{{/hasHeaderParams}} -{{#authMethods}} - // authentication ({{name}}) required -{{#isApiKey}} -{{#isKeyInHeader}} - if (configuration.apiKey && configuration.apiKey.{{keyParamName}}) { - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ - "{{keyParamName}}": configuration.apiKey.{{keyParamName}}, - }, contentTypeHeader); - } -{{/isKeyInHeader}} -{{#isKeyInQuery}} - if (configuration.apiKey && configuration.apiKey.{{keyParamName}}) { - urlObj.query = {{#supportsES6}}Object.{{/supportsES6}}assign({}, urlObj.query, { - "{{keyParamName}}": configuration.apiKey.{{keyParamName}}, - }); - } -{{/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); - } -{{/isBasic}} -{{#isOAuth}} - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = {{#supportsES6}}Object.{{/supportsES6}}assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } -{{/isOAuth}} -{{/authMethods}} - - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, -{{/operation}} -}; - -/** - * {{classname}} - functional programming interface{{#description}} - * {{&description}}{{/description}} - */ -export const {{classname}}Fp = { -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{paramName}} {{description}} - {{/allParams}} - */ - {{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); - 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{{#returnType}}.json(){{/returnType}}; - } else { - throw response; - } - }); - }; - }, -{{/operation}} -}; - -/** - * {{classname}} - object-oriented interface{{#description}} - * {{&description}}{{/description}} - */ -export class {{classname}} extends BaseAPI { -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{paramName}} {{description}} - {{/allParams}} - */ - {{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); - } -{{/operation}} -}; - -/** - * {{classname}} - factory interface{{#description}} - * {{&description}}{{/description}} - */ -export const {{classname}}Factory = function (fetch?: FetchAPI, basePath?: string) { - return { -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{paramName}} {{description}} - {{/allParams}} - */ - {{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); - }, -{{/operation}} - }; -}; - -{{/operations}} -{{/apis}} -{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/configuration.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/configuration.mustache deleted file mode 100644 index f9ef24d8266..00000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/configuration.mustache +++ /dev/null @@ -1,12 +0,0 @@ -export class Configuration { - apiKey: { -{{#authMethods}} -{{#isApiKey}} - {{keyParamName}}: string; -{{/isApiKey}} -{{/authMethods}} - }; - username: string; - password: string; - accessToken: string; -} \ 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 deleted file mode 100644 index 05aec69d7ec..00000000000 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/package.json.mustache +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "{{#npmName}}{{{npmName}}}{{/npmName}}{{^npmName}}typescript-fetch-api{{/npmName}}", - "version": "{{#npmVersion}}{{{npmVersion}}}{{/npmVersion}}{{^npmVersion}}0.0.0{{/npmVersion}}", - "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" - }, - "devDependencies": { - "tslint": "^3.15.1", - "typescript": "^1.8.10", - "typings": "^1.0.4" - } -} 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/typescript-fetch/README.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/README.mustache new file mode 100644 index 00000000000..d339a5933ea --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/README.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 diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache new file mode 100644 index 00000000000..62db1d029c4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/api.mustache @@ -0,0 +1,325 @@ +// tslint:disable +{{>licenseInfo}} + +import * as url from "url"; +import * as isomorphicFetch from "isomorphic-fetch"; +import { Configuration } from "./configuration"; + +const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @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 { + protected configuration: Configuration; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + } +} + +{{#models}} +{{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}{{/model}} +{{/models}} +{{#apiInfo}}{{#apis}}{{#operations}} +/** + * {{classname}} - fetch parameter creator{{#description}} + * {{&description}}{{/description}} + * @export + */ +export const {{classname}}FetchParamCreator = function (configuration?: Configuration) { + return { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: any = {}): FetchArgs { + {{#allParams}} + {{#required}} + // 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 path = `{{{path}}}`{{#pathParams}} + .replace(`{${"{{baseName}}"}}`, String({{paramName}})){{/pathParams}}; + const urlObj = url.parse(path, true); + const requestOptions = Object.assign({ method: '{{httpMethod}}' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + {{#hasFormParams}} + const formParams = new url.URLSearchParams(); + {{/hasFormParams}} + + {{#authMethods}} + // authentication {{name}} required + {{#isApiKey}} + {{#isKeyInHeader}} + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("{{keyParamName}}") + : configuration.apiKey; + headerParameter["{{keyParamName}}"] = apiKeyValue; + } + {{/isKeyInHeader}} + {{#isKeyInQuery}} + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("{{keyParamName}}") + : configuration.apiKey; + queryParameter["{{keyParamName}}"] = apiKeyValue; + } + {{/isKeyInQuery}} + {{/isApiKey}} + {{#isBasic}} + // http basic authentication required + if (configuration && (configuration.username || configuration.password)) { + headerParameter["Authorization"] = "Basic " + btoa(configuration.username + ":" + configuration.password); + } + {{/isBasic}} + {{#isOAuth}} + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + {{/isOAuth}} + + {{/authMethods}} + {{#queryParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + queryParameter['{{baseName}}'] = {{paramName}}; + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + queryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + {{#isDateTime}} + queryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString(); + {{/isDateTime}} + {{^isDateTime}} + {{#isDate}} + queryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString(); + {{/isDate}} + {{^isDate}} + queryParameter['{{baseName}}'] = {{paramName}}; + {{/isDate}} + {{/isDateTime}} + } + {{/isListContainer}} + + {{/queryParams}} + {{#headerParams}} + {{#isListContainer}} + if ({{paramName}}) { + headerParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"])); + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + headerParameter['{{baseName}}'] = String({{paramName}}); + } + {{/isListContainer}} + + {{/headerParams}} + {{#formParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + formParams.append('{{baseName}}', element as any); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + formParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"])); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + formParams.set('{{baseName}}', {{paramName}} as any); + } + {{/isListContainer}} + + {{/formParams}} + {{#hasFormParams}} + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + {{/hasFormParams}} + {{#bodyParam}} + headerParameter['Content-Type'] = 'application/json'; + + {{/bodyParam}} + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + {{#hasFormParams}} + requestOptions.body = formParams.toString(); + {{/hasFormParams}} + {{#bodyParam}} + requestOptions.body = JSON.stringify({{paramName}} || {}); + {{/bodyParam}} + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + {{/operation}} + } +}; + +/** + * {{classname}} - functional programming interface{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export const {{classname}}Fp = function(configuration?: Configuration) { + return { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> { + const fetchArgs = {{classname}}FetchParamCreator(configuration).{{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) { + return response{{#returnType}}.json(){{/returnType}}; + } else { + throw response; + } + }); + }; + }, + {{/operation}} + } +}; + +/** + * {{classname}} - factory interface{{#description}} + * {{&description}}{{/description}} + * @export + */ +export const {{classname}}Factory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { + return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(fetch, basePath); + }, + {{/operation}} + }; +}; + +/** + * {{classname}} - object-oriented interface{{#description}} + * {{{description}}}{{/description}} + * @export + * @class {{classname}} + * @extends {BaseAPI} + */ +export class {{classname}} extends BaseAPI { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%%dataType%%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}} + */ + public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { + return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.fetch, this.basePath); + } + + {{/operation}} +} +{{/operations}}{{/apis}}{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/configuration.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/configuration.mustache new file mode 100644 index 00000000000..5614b839645 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/configuration.mustache @@ -0,0 +1,55 @@ +// tslint:disable +{{>licenseInfo}} + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/git_push.sh.mustache similarity index 99% rename from modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache rename to modules/swagger-codegen/src/main/resources/typescript-fetch/git_push.sh.mustache index e153ce23ecf..4d6b6157f71 100755 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/git_push.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/git_push.sh.mustache @@ -49,4 +49,3 @@ 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/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/gitignore b/modules/swagger-codegen/src/main/resources/typescript-fetch/gitignore similarity index 100% rename from modules/swagger-codegen/src/main/resources/TypeScript-Fetch/gitignore rename to modules/swagger-codegen/src/main/resources/typescript-fetch/gitignore diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/index.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/index.mustache new file mode 100644 index 00000000000..9c8794b3f28 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/index.mustache @@ -0,0 +1,5 @@ +// tslint:disable +{{>licenseInfo}} + +export * from "./api"; +export * from "./configuration"; diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/licenseInfo.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/licenseInfo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/TypeScript-Fetch/licenseInfo.mustache rename to modules/swagger-codegen/src/main/resources/typescript-fetch/licenseInfo.mustache 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..5fa32c28b88 --- /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}} +} 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..4d8bd2f09a1 --- /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}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache new file mode 100644 index 00000000000..a058ae016dd --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache @@ -0,0 +1,32 @@ +{ + "name": "{{npmName}}", + "version": "{{npmVersion}}", + "description": "swagger client for {{npmName}}", + "author": "Swagger Codegen Contributors", + "keywords": [ + "fetch", + "typescript", + "swagger-client", + "{{npmName}}" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "postinstall": "npm run build" + }, + "dependencies": { + "isomorphic-fetch": "^2.2.1" + }, + "devDependencies": { + "@types/isomorphic-fetch": "0.0.34", + "@types/node": "^8.0.9", + "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.mustache similarity index 67% rename from modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache rename to modules/swagger-codegen/src/main/resources/typescript-fetch/tsconfig.mustache index 25f414e9840..6e59886490b 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Fetch/tsconfig.json.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/tsconfig.mustache @@ -5,13 +5,15 @@ "module": "commonjs", "noImplicitAny": true, "outDir": "dist", - "rootDir": "." + "rootDir": "."{{^supportsES6}}, + "lib": [ + "es6", + "dom" + ] + {{/supportsES6}} }, "exclude": [ "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" + "node_modules" ] } 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 class TypeScriptFetchClientOptionsProvider implements OptionsProvider { .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/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..f9f7450d135 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-fetch/api.ts b/samples/client/petstore-security-test/typescript-fetch/api.ts index d4b0fbf3e81..7e8b409725e 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 -- @@ -9,125 +10,188 @@ * https://github.com/swagger-api/swagger-codegen.git * 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; } - const BASE_PATH = "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r".replace(/\/+$/, ""); +const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @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; + protected configuration: Configuration; - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } } }; +/** + * + * @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 */ -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 - */ - 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); +export const FakeApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @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(test code inject * ' " =end rn n r?: string, options: any = {}): FetchArgs { + const path = `/fake`; + const urlObj = url.parse(path, true); + const requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); - 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 = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 as any); + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * FakeApi - functional programming interface + * @export */ -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 - */ - testCodeInjectEndRnNR(params: { test code inject * ' " =end rn n r?: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = FakeApiFetchParamCreator.testCodeInjectEndRnNR(params, 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; - } - }); - }; - }, -}; - -/** - * FakeApi - object-oriented interface - */ -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 - */ - testCodeInjectEndRnNR(params: { test code inject * ' " =end rn n r?: string; }, options: any = {}) { - return FakeApiFp.testCodeInjectEndRnNR(params, options)(this.fetch, this.basePath); +export const FakeApiFp = function(configuration?: Configuration) { + return { + /** + * + * @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(test code inject * ' " =end rn n r?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = FakeApiFetchParamCreator(configuration).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) { + return response; + } else { + throw response; + } + }); + }; + }, } }; /** * FakeApi - factory interface + * @export */ -export const FakeApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const FakeApiFactory = function (configuration?: Configuration, 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(configuration).testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options)(fetch, basePath); }, }; }; +/** + * FakeApi - object-oriented interface + * @export + * @class FakeApi + * @extends {BaseAPI} + */ +export class FakeApi extends BaseAPI { + /** + * + * @summary 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 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any) { + return FakeApiFp(this.configuration).testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options)(this.fetch, this.basePath); + } + +} + diff --git a/samples/client/petstore-security-test/typescript-fetch/configuration.ts b/samples/client/petstore-security-test/typescript-fetch/configuration.ts index 52f849688a6..8dd6dd60c63 100644 --- a/samples/client/petstore-security-test/typescript-fetch/configuration.ts +++ b/samples/client/petstore-security-test/typescript-fetch/configuration.ts @@ -1,8 +1,66 @@ +// 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 -- + * + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r + * + * 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. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; +} + export class Configuration { - apiKey: { - api_key */ ' " =end -- \r\n \n \r: string; - }; - username: string; - password: string; - accessToken: string; -} \ No newline at end of file + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore-security-test/typescript-fetch/git_push.sh b/samples/client/petstore-security-test/typescript-fetch/git_push.sh index ed374619b13..1eb5727f6cd 100644 --- a/samples/client/petstore-security-test/typescript-fetch/git_push.sh +++ b/samples/client/petstore-security-test/typescript-fetch/git_push.sh @@ -49,4 +49,3 @@ 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-security-test/typescript-fetch/index.ts b/samples/client/petstore-security-test/typescript-fetch/index.ts new file mode 100644 index 00000000000..bcb691f7489 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-fetch/index.ts @@ -0,0 +1,16 @@ +// 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 -- + * + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r + * + * 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. + */ + + +export * from "./api"; +export * from "./configuration"; 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 378f912d8a5..858d0469fdb 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,1472 +11,1973 @@ * 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; } - const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @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; + protected configuration: Configuration; - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } } }; +/** + * + * @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 + * @export */ -export const PetApiFetchParamCreator = { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - 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); +export const PetApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - 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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); + headerParameter['Content-Type'] = 'application/json'; - 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); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/pet/findByStatus`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query); - if (params["status"] !== undefined) { - urlObj.query["status"] = params["status"]; - } - let fetchOptions: RequestInit = assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - 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); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/pet/findByTags`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query); - if (params["tags"] !== undefined) { - urlObj.query["tags"] = params["tags"]; - } - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + if (apiKey !== undefined && apiKey !== null) { + headerParameter['api_key'] = String(apiKey); + } - let contentTypeHeader: Dictionary = {}; - 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); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - 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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Update an existing pet - * @param body Pet object that needs to be added to the store - */ - 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); + if (status) { + queryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @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"); - } - const baseUrl = `/pet/{petId}/uploadImage` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); + if (tags) { + queryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + headerParameter["api_key"] = apiKeyValue; + } + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + if (name !== undefined) { + formParams.set('name', name as any); + } + + if (status !== undefined) { + formParams.set('status', status as any); + } + + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + if (additionalMetadata !== undefined) { + formParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + formParams.set('file', file as any); + } + + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * PetApi - functional programming interface + * @export */ -export const PetApiFp = { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - addPet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.addPet(params, configuration, 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 petId Pet id to delete - * @param apiKey - */ - deletePet(params: { petId: number; apiKey?: string; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.deletePet(params, configuration, 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 status Status values that need to be considered for filter - */ - findPetsByStatus(params: { status: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(params, configuration, 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 tags Tags to filter by - */ - findPetsByTags(params: { tags: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByTags(params, configuration, 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 petId ID of pet to return - */ - getPetById(params: { petId: number; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.getPetById(params, configuration, 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 body Pet object that needs to be added to the store - */ - updatePet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePet(params, configuration, 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 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 = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(params, configuration, 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 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 = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.uploadFile(params, configuration, 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 { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - addPet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.addPet(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - deletePet(params: { petId: number; apiKey?: string; }, options: any = {}) { - return PetApiFp.deletePet(params, this.configuration, 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 - */ - findPetsByStatus(params: { status: Array; }, options: any = {}) { - return PetApiFp.findPetsByStatus(params, this.configuration, 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 - */ - findPetsByTags(params: { tags: Array; }, options: any = {}) { - return PetApiFp.findPetsByTags(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - getPetById(params: { petId: number; }, options: any = {}) { - return PetApiFp.getPetById(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * - * @summary Update an existing pet - * @param body Pet object that needs to be added to the store - */ - updatePet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.updatePet(params, this.configuration, 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 - */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, options: any = {}) { - return PetApiFp.updatePetWithForm(params, this.configuration, 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 - */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, options: any = {}) { - return PetApiFp.uploadFile(params, this.configuration, options)(this.fetch, this.basePath); +export const PetApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const PetApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { /** * * @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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).uploadFile(petId, additionalMetadata, file, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(body: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {} petId Pet id to delete + * @param {} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.fetch, this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(body: Pet, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.fetch, this.basePath); + } + +} /** * StoreApi - fetch parameter creator + * @export */ -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 - */ - 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"); - } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); +export const StoreApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - getInventory(configuration: Configuration, options: any = {}): FetchArgs { - const baseUrl = `/store/inventory`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } + // authentication api_key required + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + headerParameter["api_key"] = apiKeyValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Place an order for a pet - * @param body order placed for purchasing the pet - */ - 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); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - 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); - } + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * StoreApi - functional programming interface + * @export */ -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 - */ - deleteOrder(params: { orderId: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.deleteOrder(params, 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 - */ - getInventory(configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { - const fetchArgs = StoreApiFetchParamCreator.getInventory(configuration, 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 orderId ID of pet that needs to be fetched - */ - getOrderById(params: { orderId: number; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.getOrderById(params, 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 body order placed for purchasing the pet - */ - placeOrder(params: { body: Order; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.placeOrder(params, 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 { - /** - * 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 - */ - deleteOrder(params: { orderId: string; }, options: any = {}) { - return StoreApiFp.deleteOrder(params, options)(this.fetch, this.basePath); - } - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - getInventory(options: any = {}) { - return StoreApiFp.getInventory(this.configuration, 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 - */ - getOrderById(params: { orderId: number; }, options: any = {}) { - return StoreApiFp.getOrderById(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Place an order for a pet - * @param body order placed for purchasing the pet - */ - placeOrder(params: { body: Order; }, options: any = {}) { - return StoreApiFp.placeOrder(params, options)(this.fetch, this.basePath); +export const StoreApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const StoreApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, 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 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(configuration).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(configuration).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(configuration).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(configuration).placeOrder(body, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).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(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {} 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(this.configuration).placeOrder(body, options)(this.fetch, this.basePath); + } + +} /** * UserApi - fetch parameter creator + * @export */ -export const UserApiFetchParamCreator = { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - 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"); - } - const baseUrl = `/user`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); +export const UserApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } + headerParameter['Content-Type'] = 'application/json'; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - 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); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - 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); - } + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - 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"); - } - const baseUrl = `/user/createWithList`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); + headerParameter['Content-Type'] = 'application/json'; - 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); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * This can only be done by the logged in user. - * @summary Delete user - * @param username The name that needs to be deleted - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + headerParameter['Content-Type'] = 'application/json'; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text - */ - 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"); - } - // verify required parameter "password" is set - if (params["password"] == null) { - throw new Error("Missing required parameter password when calling loginUser"); - } - const baseUrl = `/user/login`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query); - if (params["username"] !== undefined) { - urlObj.query["username"] = params["username"]; - } - if (params["password"] !== undefined) { - urlObj.query["password"] = params["password"]; - } - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Logs out current logged in user session - */ - logoutUser(options: any = {}): FetchArgs { - const baseUrl = `/user/logout`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); + if (username !== undefined) { + queryParameter['username'] = username; + } - 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); - } + if (password !== undefined) { + queryParameter['password'] = password; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * UserApi - functional programming interface + * @export */ -export const UserApiFp = { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - createUser(params: { body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUser(params, 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 body List of user object - */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(params, 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 body List of user object - */ - createUsersWithListInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(params, 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 username The name that needs to be deleted - */ - deleteUser(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.deleteUser(params, 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 username The name that needs to be fetched. Use user1 for testing. - */ - getUserByName(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.getUserByName(params, 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 username The user name for login - * @param password The password for login in clear text - */ - loginUser(params: { username: string; password: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.loginUser(params, 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 - */ - 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 username name that need to be deleted - * @param body Updated user object - */ - updateUser(params: { username: string; body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.updateUser(params, 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 { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - createUser(params: { body: User; }, options: any = {}) { - return UserApiFp.createUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithArrayInput(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - createUsersWithListInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithListInput(params, 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 - */ - deleteUser(params: { username: string; }, options: any = {}) { - return UserApiFp.deleteUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - getUserByName(params: { username: string; }, options: any = {}) { - return UserApiFp.getUserByName(params, 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 - */ - loginUser(params: { username: string; password: string; }, options: any = {}) { - return UserApiFp.loginUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Logs out current logged in user session - */ - 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 - */ - updateUser(params: { username: string; body: User; }, options: any = {}) { - return UserApiFp.updateUser(params, options)(this.fetch, this.basePath); +export const UserApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const UserApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { /** * 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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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); + logoutUser(options?: any) { + return UserApiFp(configuration).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(configuration).updateUser(username, body, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(body: User, options?: any) { + return UserApiFp(this.configuration).createUser(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).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(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, body: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, body, options)(this.fetch, this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default/configuration.ts b/samples/client/petstore/typescript-fetch/builds/default/configuration.ts index ba410680e28..ca7b7e641b5 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/configuration.ts @@ -1,8 +1,66 @@ +// 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. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; +} + export class Configuration { - apiKey: { - api_key: string; - }; - username: string; - password: string; - accessToken: string; -} \ No newline at end of file + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/default/git_push.sh b/samples/client/petstore/typescript-fetch/builds/default/git_push.sh index ed374619b13..1eb5727f6cd 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/git_push.sh +++ b/samples/client/petstore/typescript-fetch/builds/default/git_push.sh @@ -49,4 +49,3 @@ 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/default/index.ts b/samples/client/petstore/typescript-fetch/builds/default/index.ts new file mode 100644 index 00000000000..052a883aaaa --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/default/index.ts @@ -0,0 +1,16 @@ +// 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. + */ + + +export * from "./api"; +export * from "./configuration"; 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 index f7886b3f9aa..6b36b1d83c4 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/pom.xml +++ b/samples/client/petstore/typescript-fetch/builds/default/pom.xml @@ -21,39 +21,6 @@ - - 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/README.md b/samples/client/petstore/typescript-fetch/builds/es6-target/README.md index 664e1755933..3b95bfd7076 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/README.md +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/README.md @@ -1,6 +1,6 @@ -# TypeScript-Fetch +## @swagger/typescript-fetch-petstore@1.0.0 -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: +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 @@ -17,38 +17,29 @@ 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 ### +### Building -`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: +To build an compile the typescript sources to javascript use: ``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); +npm install +npm run build ``` -#### 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: +### 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:_ -With ES6 module syntax, the following syntaxes are supported: ``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; +npm install @swagger/typescript-fetch-petstore@1.0.0 --save ``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; + +_unPublished (not recommended):_ + ``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts index 657658d1ff4..858d0469fdb 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/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,1471 +11,1973 @@ * Do not edit the class manually. */ -import * as querystring from "querystring"; + import * as url from "url"; - import * as isomorphicFetch from "isomorphic-fetch"; - import { Configuration } from "./configuration"; -interface Dictionary { [index: string]: T; } -export interface FetchAPI { (url: string, init?: any): Promise; } - const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @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; + protected configuration: Configuration; - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } } }; +/** + * + * @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 + * @export */ -export const PetApiFetchParamCreator = { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - 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 = Object.assign({}, { method: "POST" }, options); +export const PetApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - 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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "DELETE" }, options); + headerParameter['Content-Type'] = 'application/json'; - let contentTypeHeader: Dictionary = {}; - fetchOptions.headers = Object.assign({ - "api_key": params["apiKey"], - }, contentTypeHeader, fetchOptions.headers); - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/pet/findByStatus`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = Object.assign({}, urlObj.query); - if (params["status"] !== undefined) { - urlObj.query["status"] = params["status"]; - } - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/pet/findByTags`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = Object.assign({}, urlObj.query); - if (params["tags"] !== undefined) { - urlObj.query["tags"] = params["tags"]; - } - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); + if (apiKey !== undefined && apiKey !== null) { + headerParameter['api_key'] = String(apiKey); + } - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - 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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (api_key) required - if (configuration.apiKey && configuration.apiKey.api_key) { - fetchOptions.headers = Object.assign({ - "api_key": configuration.apiKey.api_key, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Update an existing pet - * @param body Pet object that needs to be added to the store - */ - 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 = Object.assign({}, { method: "PUT" }, options); + if (status) { + queryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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 = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @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"); - } - const baseUrl = `/pet/{petId}/uploadImage` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); + if (tags) { + queryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } - 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 = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = Object.assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + headerParameter["api_key"] = apiKeyValue; + } + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + if (name !== undefined) { + formParams.set('name', name as any); + } + + if (status !== undefined) { + formParams.set('status', status as any); + } + + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + if (additionalMetadata !== undefined) { + formParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + formParams.set('file', file as any); + } + + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * PetApi - functional programming interface + * @export */ -export const PetApiFp = { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - addPet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.addPet(params, configuration, 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 petId Pet id to delete - * @param apiKey - */ - deletePet(params: { petId: number; apiKey?: string; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.deletePet(params, configuration, 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 status Status values that need to be considered for filter - */ - findPetsByStatus(params: { status: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(params, configuration, 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 tags Tags to filter by - */ - findPetsByTags(params: { tags: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByTags(params, configuration, 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 petId ID of pet to return - */ - getPetById(params: { petId: number; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.getPetById(params, configuration, 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 body Pet object that needs to be added to the store - */ - updatePet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePet(params, configuration, 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 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 = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(params, configuration, 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 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 = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.uploadFile(params, configuration, 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 { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - addPet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.addPet(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - deletePet(params: { petId: number; apiKey?: string; }, options: any = {}) { - return PetApiFp.deletePet(params, this.configuration, 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 - */ - findPetsByStatus(params: { status: Array; }, options: any = {}) { - return PetApiFp.findPetsByStatus(params, this.configuration, 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 - */ - findPetsByTags(params: { tags: Array; }, options: any = {}) { - return PetApiFp.findPetsByTags(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - getPetById(params: { petId: number; }, options: any = {}) { - return PetApiFp.getPetById(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * - * @summary Update an existing pet - * @param body Pet object that needs to be added to the store - */ - updatePet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.updatePet(params, this.configuration, 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 - */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, options: any = {}) { - return PetApiFp.updatePetWithForm(params, this.configuration, 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 - */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, options: any = {}) { - return PetApiFp.uploadFile(params, this.configuration, options)(this.fetch, this.basePath); +export const PetApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const PetApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { /** * * @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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).uploadFile(petId, additionalMetadata, file, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(body: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {} petId Pet id to delete + * @param {} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.fetch, this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(body: Pet, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.fetch, this.basePath); + } + +} /** * StoreApi - fetch parameter creator + * @export */ -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 - */ - 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"); - } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "DELETE" }, options); +export const StoreApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - getInventory(configuration: Configuration, options: any = {}): FetchArgs { - const baseUrl = `/store/inventory`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } - // authentication (api_key) required - if (configuration.apiKey && configuration.apiKey.api_key) { - fetchOptions.headers = Object.assign({ - "api_key": configuration.apiKey.api_key, - }, contentTypeHeader); - } + // authentication api_key required + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + headerParameter["api_key"] = apiKeyValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Place an order for a pet - * @param body order placed for purchasing the pet - */ - 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 = Object.assign({}, { method: "POST" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * StoreApi - functional programming interface + * @export */ -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 - */ - deleteOrder(params: { orderId: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.deleteOrder(params, 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 - */ - getInventory(configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { - const fetchArgs = StoreApiFetchParamCreator.getInventory(configuration, 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 orderId ID of pet that needs to be fetched - */ - getOrderById(params: { orderId: number; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.getOrderById(params, 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 body order placed for purchasing the pet - */ - placeOrder(params: { body: Order; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.placeOrder(params, 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 { - /** - * 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 - */ - deleteOrder(params: { orderId: string; }, options: any = {}) { - return StoreApiFp.deleteOrder(params, options)(this.fetch, this.basePath); - } - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - getInventory(options: any = {}) { - return StoreApiFp.getInventory(this.configuration, 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 - */ - getOrderById(params: { orderId: number; }, options: any = {}) { - return StoreApiFp.getOrderById(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Place an order for a pet - * @param body order placed for purchasing the pet - */ - placeOrder(params: { body: Order; }, options: any = {}) { - return StoreApiFp.placeOrder(params, options)(this.fetch, this.basePath); +export const StoreApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const StoreApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, 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 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(configuration).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(configuration).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(configuration).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(configuration).placeOrder(body, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).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(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {} 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(this.configuration).placeOrder(body, options)(this.fetch, this.basePath); + } + +} /** * UserApi - fetch parameter creator + * @export */ -export const UserApiFetchParamCreator = { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - 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"); - } - const baseUrl = `/user`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); +export const UserApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + headerParameter['Content-Type'] = 'application/json'; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - 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 = Object.assign({}, { method: "POST" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - 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"); - } - const baseUrl = `/user/createWithList`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); + headerParameter['Content-Type'] = 'application/json'; - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * This can only be done by the logged in user. - * @summary Delete user - * @param username The name that needs to be deleted - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "DELETE" }, 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + headerParameter['Content-Type'] = 'application/json'; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text - */ - 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"); - } - // verify required parameter "password" is set - if (params["password"] == null) { - throw new Error("Missing required parameter password when calling loginUser"); - } - const baseUrl = `/user/login`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = Object.assign({}, urlObj.query); - if (params["username"] !== undefined) { - urlObj.query["username"] = params["username"]; - } - if (params["password"] !== undefined) { - urlObj.query["password"] = params["password"]; - } - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Logs out current logged in user session - */ - logoutUser(options: any = {}): FetchArgs { - const baseUrl = `/user/logout`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = Object.assign({}, { method: "PUT" }, options); + if (username !== undefined) { + queryParameter['username'] = username; + } - let contentTypeHeader: Dictionary = {}; - contentTypeHeader = { "Content-Type": "application/json" }; - if (params["body"]) { - fetchOptions.body = JSON.stringify(params["body"] || {}); - } - if (contentTypeHeader) { - fetchOptions.headers = Object.assign({}, contentTypeHeader, fetchOptions.headers); - } + if (password !== undefined) { + queryParameter['password'] = password; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * UserApi - functional programming interface + * @export */ -export const UserApiFp = { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - createUser(params: { body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUser(params, 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 body List of user object - */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(params, 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 body List of user object - */ - createUsersWithListInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(params, 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 username The name that needs to be deleted - */ - deleteUser(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.deleteUser(params, 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 username The name that needs to be fetched. Use user1 for testing. - */ - getUserByName(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.getUserByName(params, 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 username The user name for login - * @param password The password for login in clear text - */ - loginUser(params: { username: string; password: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.loginUser(params, 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 - */ - 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 username name that need to be deleted - * @param body Updated user object - */ - updateUser(params: { username: string; body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.updateUser(params, 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 { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - createUser(params: { body: User; }, options: any = {}) { - return UserApiFp.createUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithArrayInput(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - createUsersWithListInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithListInput(params, 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 - */ - deleteUser(params: { username: string; }, options: any = {}) { - return UserApiFp.deleteUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - getUserByName(params: { username: string; }, options: any = {}) { - return UserApiFp.getUserByName(params, 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 - */ - loginUser(params: { username: string; password: string; }, options: any = {}) { - return UserApiFp.loginUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Logs out current logged in user session - */ - 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 - */ - updateUser(params: { username: string; body: User; }, options: any = {}) { - return UserApiFp.updateUser(params, options)(this.fetch, this.basePath); +export const UserApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const UserApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { /** * 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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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); + logoutUser(options?: any) { + return UserApiFp(configuration).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(configuration).updateUser(username, body, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(body: User, options?: any) { + return UserApiFp(this.configuration).createUser(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).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(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, body: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, body, options)(this.fetch, this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/configuration.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/configuration.ts index ba410680e28..ca7b7e641b5 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/configuration.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/configuration.ts @@ -1,8 +1,66 @@ +// 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. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; +} + export class Configuration { - apiKey: { - api_key: string; - }; - username: string; - password: string; - accessToken: string; -} \ No newline at end of file + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} 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 index ed374619b13..1eb5727f6cd 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/git_push.sh +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/git_push.sh @@ -49,4 +49,3 @@ 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/index.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/index.ts new file mode 100644 index 00000000000..052a883aaaa --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/index.ts @@ -0,0 +1,16 @@ +// 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. + */ + + +export * from "./api"; +export * from "./configuration"; diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/package.json b/samples/client/petstore/typescript-fetch/builds/es6-target/package.json index 9797e3483f9..d7f632a76d4 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/package.json +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/package.json @@ -1,20 +1,30 @@ { - "name": "typescript-fetch-api", - "version": "0.0.0", + "name": "@swagger/typescript-fetch-petstore", + "version": "1.0.0", + "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", - "browser": "./dist/api.js", - "typings": "./dist/api.d.ts", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "postinstall": "npm run build" + }, "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" + "@types/isomorphic-fetch": "0.0.34", + "@types/node": "^8.0.9", + "typescript": "^2.0" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" } } diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/es6-target/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-target/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/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/typescript-fetch/builds/with-npm-version/README.md b/samples/client/petstore/typescript-fetch/builds/with-npm-version/README.md index 664e1755933..3b95bfd7076 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/README.md +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/README.md @@ -1,6 +1,6 @@ -# TypeScript-Fetch +## @swagger/typescript-fetch-petstore@1.0.0 -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: +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 @@ -17,38 +17,29 @@ 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 ### +### Building -`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: +To build an compile the typescript sources to javascript use: ``` -import * as localName from 'npmName'; -import {operationId} from 'npmName'; -``` -The CommonJS syntax is as follows: -``` -import localName = require('npmName'); +npm install +npm run build ``` -#### 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: +### 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:_ -With ES6 module syntax, the following syntaxes are supported: ``` -import * as localName from './symlinkDir'; -import {operationId} from './symlinkDir'; +npm install @swagger/typescript-fetch-petstore@1.0.0 --save ``` -The CommonJS syntax is as follows: -``` -import localName = require('./symlinkDir')'; + +_unPublished (not recommended):_ + ``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts index 378f912d8a5..858d0469fdb 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/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,1472 +11,1973 @@ * 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; } - const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @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; + protected configuration: Configuration; - constructor(fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH, configuration: Configuration = new Configuration()) { - this.basePath = basePath; - this.fetch = fetch; - this.configuration = configuration; + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } } }; +/** + * + * @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 + * @export */ -export const PetApiFetchParamCreator = { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - 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); +export const PetApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - 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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); + headerParameter['Content-Type'] = 'application/json'; - 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); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/pet/findByStatus`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query); - if (params["status"] !== undefined) { - urlObj.query["status"] = params["status"]; - } - let fetchOptions: RequestInit = assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - 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); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/pet/findByTags`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query); - if (params["tags"] !== undefined) { - urlObj.query["tags"] = params["tags"]; - } - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + if (apiKey !== undefined && apiKey !== null) { + headerParameter['api_key'] = String(apiKey); + } - let contentTypeHeader: Dictionary = {}; - 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); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - 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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Update an existing pet - * @param body Pet object that needs to be added to the store - */ - 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); + if (status) { + queryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @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"); - } - const baseUrl = `/pet/{petId}` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @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"); - } - const baseUrl = `/pet/{petId}/uploadImage` - .replace(`{${"petId"}}`, `${ params["petId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); + if (tags) { + queryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } - 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); - } - // authentication (petstore_auth) required - // oauth required - if (configuration.accessToken) { - fetchOptions.headers = assign({ - "Authorization": "Bearer " + configuration.accessToken, - }, contentTypeHeader); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + headerParameter["api_key"] = apiKeyValue; + } + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + if (name !== undefined) { + formParams.set('name', name as any); + } + + if (status !== undefined) { + formParams.set('status', status as any); + } + + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + const formParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const accessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + headerParameter["Authorization"] = "Bearer " + accessTokenValue; + } + + if (additionalMetadata !== undefined) { + formParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + formParams.set('file', file as any); + } + + headerParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = formParams.toString(); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * PetApi - functional programming interface + * @export */ -export const PetApiFp = { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - addPet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.addPet(params, configuration, 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 petId Pet id to delete - * @param apiKey - */ - deletePet(params: { petId: number; apiKey?: string; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.deletePet(params, configuration, 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 status Status values that need to be considered for filter - */ - findPetsByStatus(params: { status: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByStatus(params, configuration, 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 tags Tags to filter by - */ - findPetsByTags(params: { tags: Array; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise> { - const fetchArgs = PetApiFetchParamCreator.findPetsByTags(params, configuration, 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 petId ID of pet to return - */ - getPetById(params: { petId: number; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.getPetById(params, configuration, 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 body Pet object that needs to be added to the store - */ - updatePet(params: { body: Pet; }, configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePet(params, configuration, 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 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 = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.updatePetWithForm(params, configuration, 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 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 = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = PetApiFetchParamCreator.uploadFile(params, configuration, 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 { - /** - * - * @summary Add a new pet to the store - * @param body Pet object that needs to be added to the store - */ - addPet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.addPet(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - deletePet(params: { petId: number; apiKey?: string; }, options: any = {}) { - return PetApiFp.deletePet(params, this.configuration, 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 - */ - findPetsByStatus(params: { status: Array; }, options: any = {}) { - return PetApiFp.findPetsByStatus(params, this.configuration, 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 - */ - findPetsByTags(params: { tags: Array; }, options: any = {}) { - return PetApiFp.findPetsByTags(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - getPetById(params: { petId: number; }, options: any = {}) { - return PetApiFp.getPetById(params, this.configuration, options)(this.fetch, this.basePath); - } - /** - * - * @summary Update an existing pet - * @param body Pet object that needs to be added to the store - */ - updatePet(params: { body: Pet; }, options: any = {}) { - return PetApiFp.updatePet(params, this.configuration, 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 - */ - updatePetWithForm(params: { petId: number; name?: string; status?: string; }, options: any = {}) { - return PetApiFp.updatePetWithForm(params, this.configuration, 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 - */ - uploadFile(params: { petId: number; additionalMetadata?: string; file?: any; }, options: any = {}) { - return PetApiFp.uploadFile(params, this.configuration, options)(this.fetch, this.basePath); +export const PetApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = PetApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const PetApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const PetApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { /** * * @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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).uploadFile(petId, additionalMetadata, file, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(body: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {} petId Pet id to delete + * @param {} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.fetch, this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(body: Pet, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.fetch, this.basePath); + } + +} /** * StoreApi - fetch parameter creator + * @export */ -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 - */ - 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"); - } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); +export const StoreApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - getInventory(configuration: Configuration, options: any = {}): FetchArgs { - const baseUrl = `/store/inventory`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } + // authentication api_key required + if (configuration && configuration.apiKey) { + const apiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + headerParameter["api_key"] = apiKeyValue; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/store/order/{orderId}` - .replace(`{${"orderId"}}`, `${ params["orderId"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Place an order for a pet - * @param body order placed for purchasing the pet - */ - 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); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - 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); - } + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * StoreApi - functional programming interface + * @export */ -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 - */ - deleteOrder(params: { orderId: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.deleteOrder(params, 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 - */ - getInventory(configuration: Configuration, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise<{ [key: string]: number; }> { - const fetchArgs = StoreApiFetchParamCreator.getInventory(configuration, 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 orderId ID of pet that needs to be fetched - */ - getOrderById(params: { orderId: number; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.getOrderById(params, 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 body order placed for purchasing the pet - */ - placeOrder(params: { body: Order; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = StoreApiFetchParamCreator.placeOrder(params, 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 { - /** - * 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 - */ - deleteOrder(params: { orderId: string; }, options: any = {}) { - return StoreApiFp.deleteOrder(params, options)(this.fetch, this.basePath); - } - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - getInventory(options: any = {}) { - return StoreApiFp.getInventory(this.configuration, 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 - */ - getOrderById(params: { orderId: number; }, options: any = {}) { - return StoreApiFp.getOrderById(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Place an order for a pet - * @param body order placed for purchasing the pet - */ - placeOrder(params: { body: Order; }, options: any = {}) { - return StoreApiFp.placeOrder(params, options)(this.fetch, this.basePath); +export const StoreApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = StoreApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const StoreApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const StoreApiFactory = function (configuration?: Configuration, 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 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(configuration).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(configuration).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(configuration).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(configuration).placeOrder(body, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).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(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {} 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(this.configuration).placeOrder(body, options)(this.fetch, this.basePath); + } + +} /** * UserApi - fetch parameter creator + * @export */ -export const UserApiFetchParamCreator = { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - 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"); - } - const baseUrl = `/user`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); +export const UserApiFetchParamCreator = function (configuration?: Configuration) { + 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 = {}): 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - 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); - } + headerParameter['Content-Type'] = 'application/json'; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - 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); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - 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); - } + 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - 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"); - } - const baseUrl = `/user/createWithList`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); + headerParameter['Content-Type'] = 'application/json'; - 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); - } + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * This can only be done by the logged in user. - * @summary Delete user - * @param username The name that needs to be deleted - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, 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 requestOptions = Object.assign({ method: 'POST' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + headerParameter['Content-Type'] = 'application/json'; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'DELETE' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text - */ - 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"); - } - // verify required parameter "password" is set - if (params["password"] == null) { - throw new Error("Missing required parameter password when calling loginUser"); - } - const baseUrl = `/user/login`; - let urlObj = url.parse(baseUrl, true); - urlObj.query = assign({}, urlObj.query); - if (params["username"] !== undefined) { - urlObj.query["username"] = params["username"]; - } - if (params["password"] !== undefined) { - urlObj.query["password"] = params["password"]; - } - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * - * @summary Logs out current logged in user session - */ - logoutUser(options: any = {}): FetchArgs { - const baseUrl = `/user/logout`; - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); - let contentTypeHeader: Dictionary = {}; - if (contentTypeHeader) { - fetchOptions.headers = assign({}, contentTypeHeader, fetchOptions.headers); - } + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, - /** - * 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 - */ - 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"); - } - const baseUrl = `/user/{username}` - .replace(`{${"username"}}`, `${ params["username"] }`); - let urlObj = url.parse(baseUrl, true); - let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); + if (username !== undefined) { + queryParameter['username'] = username; + } - 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); - } + if (password !== undefined) { + queryParameter['password'] = password; + } - return { - url: url.format(urlObj), - options: fetchOptions, - }; - }, + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'GET' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + + 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 requestOptions = Object.assign({ method: 'PUT' }, options); + const headerParameter = {} as any; + const queryParameter = {} as any; + + headerParameter['Content-Type'] = 'application/json'; + + urlObj.query = Object.assign({}, urlObj.query, queryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete urlObj.search; + requestOptions.headers = Object.assign({}, headerParameter, options.headers); + requestOptions.body = JSON.stringify(body || {}); + + return { + url: url.format(urlObj), + options: requestOptions, + }; + }, + } }; /** * UserApi - functional programming interface + * @export */ -export const UserApiFp = { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - createUser(params: { body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUser(params, 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 body List of user object - */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithArrayInput(params, 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 body List of user object - */ - createUsersWithListInput(params: { body: Array; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.createUsersWithListInput(params, 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 username The name that needs to be deleted - */ - deleteUser(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.deleteUser(params, 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 username The name that needs to be fetched. Use user1 for testing. - */ - getUserByName(params: { username: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.getUserByName(params, 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 username The user name for login - * @param password The password for login in clear text - */ - loginUser(params: { username: string; password: string; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.loginUser(params, 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 - */ - 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 username name that need to be deleted - * @param body Updated user object - */ - updateUser(params: { username: string; body: User; }, options: any = {}): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = UserApiFetchParamCreator.updateUser(params, 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 { - /** - * This can only be done by the logged in user. - * @summary Create user - * @param body Created user object - */ - createUser(params: { body: User; }, options: any = {}) { - return UserApiFp.createUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - createUsersWithArrayInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithArrayInput(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Creates list of users with given input array - * @param body List of user object - */ - createUsersWithListInput(params: { body: Array; }, options: any = {}) { - return UserApiFp.createUsersWithListInput(params, 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 - */ - deleteUser(params: { username: string; }, options: any = {}) { - return UserApiFp.deleteUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - getUserByName(params: { username: string; }, options: any = {}) { - return UserApiFp.getUserByName(params, 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 - */ - loginUser(params: { username: string; password: string; }, options: any = {}) { - return UserApiFp.loginUser(params, options)(this.fetch, this.basePath); - } - /** - * - * @summary Logs out current logged in user session - */ - 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 - */ - updateUser(params: { username: string; body: User; }, options: any = {}) { - return UserApiFp.updateUser(params, options)(this.fetch, this.basePath); +export const UserApiFp = function(configuration?: Configuration) { + 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): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = UserApiFetchParamCreator(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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 - factory interface + * @export */ -export const UserApiFactory = function (fetch?: FetchAPI, basePath?: string) { +export const UserApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { /** * 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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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(configuration).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); + logoutUser(options?: any) { + return UserApiFp(configuration).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(configuration).updateUser(username, body, options)(fetch, basePath); }, }; }; +/** + * 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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(body: User, options?: any) { + return UserApiFp(this.configuration).createUser(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(body: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(body, options)(this.fetch, this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {} body List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(body: Array, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).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(this.configuration).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 {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, body: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, body, options)(this.fetch, this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/configuration.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/configuration.ts index ba410680e28..ca7b7e641b5 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/configuration.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/configuration.ts @@ -1,8 +1,66 @@ +// 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. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; +} + export class Configuration { - apiKey: { - api_key: string; - }; - username: string; - password: string; - accessToken: string; -} \ No newline at end of file + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} 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 index ed374619b13..1eb5727f6cd 100644 --- 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 @@ -49,4 +49,3 @@ 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/index.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/index.ts new file mode 100644 index 00000000000..052a883aaaa --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/index.ts @@ -0,0 +1,16 @@ +// 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. + */ + + +export * from "./api"; +export * from "./configuration"; 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 index f4c8ca8a162..d7f632a76d4 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json @@ -1,21 +1,30 @@ { "name": "@swagger/typescript-fetch-petstore", - "version": "0.0.1", + "version": "1.0.0", + "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", - "browser": "./dist/api.js", - "typings": "./dist/api.d.ts", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "postinstall": "npm run build" + }, "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" + "@types/isomorphic-fetch": "0.0.34", + "@types/node": "^8.0.9", + "typescript": "^2.0" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" } } diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json index 72ff2567206..50ab7fa3f2f 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json @@ -5,13 +5,14 @@ "module": "commonjs", "noImplicitAny": true, "outDir": "dist", - "rootDir": "." + "rootDir": ".", + "lib": [ + "es6", + "dom" + ] }, "exclude": [ "dist", - "node_modules", - "typings/browser", - "typings/main", - "typings/main.d.ts" + "node_modules" ] } 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/builds/with-npm-version/yarn.lock b/samples/client/petstore/typescript-fetch/builds/with-npm-version/yarn.lock new file mode 100644 index 00000000000..097b098c676 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/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.34": + version "0.0.34" + resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.34.tgz#3c3483e606c041378438e951464f00e4e60706d6" + +"@types/node@^8.0.9": + version "8.0.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.17.tgz#677bc8c118cfb76013febb62ede1f31d2c7222a1" + +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.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844" + +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/tests/default/package-lock.json b/samples/client/petstore/typescript-fetch/tests/default/package-lock.json new file mode 100644 index 00000000000..44e99726237 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/tests/default/package-lock.json @@ -0,0 +1,3762 @@ +{ + "name": "typescript-fetch-test", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@swagger/typescript-fetch-petstore": { + "version": "file:../../builds/with-npm-version", + "requires": { + "isomorphic-fetch": "2.2.1" + }, + "dependencies": { + "encoding": { + "version": "0.1.12", + "bundled": true, + "requires": { + "iconv-lite": "0.4.18" + } + }, + "iconv-lite": { + "version": "0.4.18", + "bundled": true + }, + "is-stream": { + "version": "1.1.0", + "bundled": true + }, + "isomorphic-fetch": { + "version": "2.2.1", + "bundled": true, + "requires": { + "node-fetch": "1.7.1", + "whatwg-fetch": "2.0.3" + } + }, + "node-fetch": { + "version": "1.7.1", + "bundled": true, + "requires": { + "encoding": "0.1.12", + "is-stream": "1.1.0" + } + }, + "whatwg-fetch": { + "version": "2.0.3", + "bundled": true + } + } + }, + "@types/chai": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.0.2.tgz", + "integrity": "sha512-0pHNZTD0SpQhz1kUM4Muhgdn4acxq21kp726pZfWMmKYGbmmv8XkGTt3k/0QDklhTUYBD6hknZ/1YFokyP/G7Q==", + "dev": true + }, + "@types/isomorphic-fetch": { + "version": "0.0.34", + "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.34.tgz", + "integrity": "sha1-PDSD5gbAQTeEOOlRRk8A5OYHBtY=", + "dev": true + }, + "@types/mocha": { + "version": "2.2.41", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.41.tgz", + "integrity": "sha1-4nzwgXFT658nE7LT9saPHhw8pgg=", + "dev": true + }, + "@types/node": { + "version": "8.0.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.19.tgz", + "integrity": "sha512-VRQB+Q0L3YZWs45uRdpN9oWr82meL/8TrJ6faoKT5tp0uub2l/aRMhtm5fo68h7kjYKH60f9/bay1nF7ZpTW5g==", + "dev": true + }, + "abbrev": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "dev": true + }, + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true + }, + "agent-base": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", + "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", + "dev": true, + "requires": { + "extend": "3.0.1", + "semver": "5.0.3" + }, + "dependencies": { + "semver": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", + "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", + "dev": true + } + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "2.1.1" + } + }, + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "requires": { + "color-convert": "1.9.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", + "dev": true + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "2.3.11", + "normalize-path": "2.1.1" + } + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, + "array-map": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, + "asn1.js": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz", + "integrity": "sha1-SLokC0WpKA6UdImQull9IWYX/UA=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + } + }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=" + }, + "astw": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/astw/-/astw-2.2.0.tgz", + "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", + "dev": true, + "requires": { + "acorn": "4.0.13" + } + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base64-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", + "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==", + "dev": true + }, + "big.js": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz", + "integrity": "sha1-TK2iGTZS6zyp7I5VyQFWacmAaXg=", + "dev": true + }, + "binary-extensions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.9.0.tgz", + "integrity": "sha1-ZlBsFs5vTWkopbPNajPKQelB43s=", + "dev": true + }, + "bluebird": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", + "integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=", + "dev": true + }, + "bn.js": { + "version": "4.11.7", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.7.tgz", + "integrity": "sha512-LxFiV5mefv0ley0SzqkOPR1bC4EbpPx8LkOz5vMe/Yi15t5hzwgO/G+tc7wOtL4PZTYjwHu8JnEiSLumuSjSfA==", + "dev": true + }, + "boxen": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.2.1.tgz", + "integrity": "sha1-DxHn/jRO25OXl3/BPt5/ZNlWSB0=", + "dev": true, + "requires": { + "ansi-align": "2.0.0", + "camelcase": "4.1.0", + "chalk": "2.0.1", + "cli-boxes": "1.0.0", + "string-width": "2.1.1", + "term-size": "1.2.0", + "widest-line": "1.0.0" + } + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browser-pack": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.0.2.tgz", + "integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=", + "dev": true, + "requires": { + "combine-source-map": "0.7.2", + "defined": "1.0.0", + "JSONStream": "1.3.1", + "through2": "2.0.3", + "umd": "3.0.1" + } + }, + "browser-resolve": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", + "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", + "dev": true, + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "browserify": { + "version": "14.4.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.4.0.tgz", + "integrity": "sha1-CJo0Y69Y0OSNjNQHCz90ZU1avKk=", + "dev": true, + "requires": { + "assert": "1.4.1", + "browser-pack": "6.0.2", + "browser-resolve": "1.11.2", + "browserify-zlib": "0.1.4", + "buffer": "5.0.7", + "cached-path-relative": "1.0.1", + "concat-stream": "1.5.2", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.11.1", + "defined": "1.0.0", + "deps-sort": "2.0.0", + "domain-browser": "1.1.7", + "duplexer2": "0.1.4", + "events": "1.1.1", + "glob": "7.1.2", + "has": "1.0.1", + "htmlescape": "1.1.1", + "https-browserify": "1.0.0", + "inherits": "2.0.3", + "insert-module-globals": "7.0.1", + "JSONStream": "1.3.1", + "labeled-stream-splicer": "2.0.0", + "module-deps": "4.1.1", + "os-browserify": "0.1.2", + "parents": "1.0.1", + "path-browserify": "0.0.0", + "process": "0.11.10", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "read-only-stream": "2.0.0", + "readable-stream": "2.3.3", + "resolve": "1.4.0", + "shasum": "1.0.2", + "shell-quote": "1.6.1", + "stream-browserify": "2.0.1", + "stream-http": "2.7.2", + "string_decoder": "1.0.3", + "subarg": "1.0.0", + "syntax-error": "1.3.0", + "through2": "2.0.3", + "timers-browserify": "1.4.2", + "tty-browserify": "0.0.0", + "url": "0.11.0", + "util": "0.10.3", + "vm-browserify": "0.0.4", + "xtend": "4.0.1" + } + }, + "browserify-aes": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.6.tgz", + "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", + "dev": true, + "requires": { + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.1.3", + "evp_bytestokey": "1.0.0", + "inherits": "2.0.3" + } + }, + "browserify-cipher": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.0.tgz", + "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", + "dev": true, + "requires": { + "browserify-aes": "1.0.6", + "browserify-des": "1.0.0", + "evp_bytestokey": "1.0.0" + } + }, + "browserify-des": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.0.tgz", + "integrity": "sha1-2qJ3cXRwki7S/hhZQRihdUOXId0=", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "des.js": "1.0.0", + "inherits": "2.0.3" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "randombytes": "2.0.5" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "browserify-rsa": "4.0.1", + "create-hash": "1.1.3", + "create-hmac": "1.1.6", + "elliptic": "6.4.0", + "inherits": "2.0.3", + "parse-asn1": "5.1.0" + } + }, + "browserify-zlib": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "dev": true, + "requires": { + "pako": "0.2.9" + } + }, + "buffer": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.0.7.tgz", + "integrity": "sha512-NeeHXWh5pCbPQCt2/6rLvXqapZfVsqw/YgRgaHpT3H9Uzgs+S0lSg5SQzouIuDvcmlQRqBe8hOO2scKCu3cxrg==", + "dev": true, + "requires": { + "base64-js": "1.2.1", + "ieee754": "1.1.8" + } + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cached-path-relative": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.1.tgz", + "integrity": "sha1-0JxLUoAKpMB44t2BqGmqyQ0uVOc=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "chai": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.0.tgz", + "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", + "requires": { + "assertion-error": "1.0.2", + "check-error": "1.0.2", + "deep-eql": "2.0.2", + "get-func-name": "2.0.0", + "pathval": "1.1.0", + "type-detect": "4.0.3" + } + }, + "chalk": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.0.1.tgz", + "integrity": "sha512-Mp+FXEI+FrwY/XYV45b2YD3E8i3HwnEAoFcM0qlZzq/RZ9RwWitt2Y/c7cqRAz70U7hfekqx6qNYthuKFO6K0g==", + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.2.1" + }, + "dependencies": { + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "supports-color": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", + "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "1.3.2", + "async-each": "1.0.1", + "glob-parent": "2.0.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "2.0.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.1.0" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.1" + } + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "1.0.1" + } + }, + "cli-truncate": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-1.1.0.tgz", + "integrity": "sha512-bAtZo0u82gCfaAGfSNxUdTI9mNyza7D8w4CVCcaOsy7sgwDzvx6ekr6cuWJqY3UGzgnQ1+4wgENup5eIhgxEYA==", + "dev": true, + "requires": { + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + } + } + }, + "clone": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", + "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "columnify": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz", + "integrity": "sha1-Rzfd8ce2mop8NAVweC6UfuyOeLs=", + "dev": true, + "requires": { + "strip-ansi": "3.0.1", + "wcwidth": "1.0.1" + } + }, + "combine-source-map": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.7.2.tgz", + "integrity": "sha1-CHAxKFazB6h8xKxIbzqaYq7MwJ4=", + "dev": true, + "requires": { + "convert-source-map": "1.1.3", + "inline-source-map": "0.6.2", + "lodash.memoize": "3.0.4", + "source-map": "0.5.6" + } + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", + "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.0.6", + "typedarray": "0.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "0.10.31", + "util-deprecate": "1.0.2" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "configstore": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.1.tgz", + "integrity": "sha512-5oNkD/L++l0O6xGXxb1EWS7SivtjfGQlRyxJsYgE0Z495/L81e2h4/d3r969hoPXuFItzNOKMtsXgYG4c7dYvw==", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "graceful-fs": "4.1.11", + "make-dir": "1.0.0", + "unique-string": "1.0.0", + "write-file-atomic": "2.1.0", + "xdg-basedir": "3.0.0" + } + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "0.1.4" + } + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "convert-source-map": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "create-ecdh": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", + "integrity": "sha1-iIxyNZbN92EvZJgjPuvXo1MBc30=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "elliptic": "6.4.0" + } + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "1.0.0" + } + }, + "create-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", + "integrity": "sha1-YGBCrIuSYnUPSDyt2rD1gZFy2P0=", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "inherits": "2.0.3", + "ripemd160": "2.0.1", + "sha.js": "2.4.8" + } + }, + "create-hmac": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.6.tgz", + "integrity": "sha1-rLniIaThe9sHbpBlfEK5PjcmzwY=", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "create-hash": "1.1.3", + "inherits": "2.0.3", + "ripemd160": "2.0.1", + "safe-buffer": "5.1.1", + "sha.js": "2.4.8" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "crypto-browserify": { + "version": "3.11.1", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.11.1.tgz", + "integrity": "sha512-Na7ZlwCOqoaW5RwUK1WpXws2kv8mNhWdTlzob0UXulk6G9BDbyiJaGTYBIX61Ozn9l1EPPJpICZb4DaOpT9NlQ==", + "dev": true, + "requires": { + "browserify-cipher": "1.0.0", + "browserify-sign": "4.0.4", + "create-ecdh": "4.0.0", + "create-hash": "1.1.3", + "create-hmac": "1.1.6", + "diffie-hellman": "5.0.2", + "inherits": "2.0.3", + "pbkdf2": "3.0.13", + "public-encrypt": "4.0.0", + "randombytes": "2.0.5" + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-eql": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", + "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", + "requires": { + "type-detect": "3.0.0" + }, + "dependencies": { + "type-detect": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", + "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=" + } + } + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "dev": true + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "1.0.2" + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "deps-sort": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", + "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", + "dev": true, + "requires": { + "JSONStream": "1.3.1", + "shasum": "1.0.2", + "subarg": "1.0.0", + "through2": "2.0.3" + } + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", + "dev": true + }, + "detective": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.5.0.tgz", + "integrity": "sha1-blqMaybmx6JUsca210kNmOyR7dE=", + "dev": true, + "requires": { + "acorn": "4.0.13", + "defined": "1.0.0" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=" + }, + "diffie-hellman": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz", + "integrity": "sha1-tYNXOScM/ias9jIJn97SoH8gnl4=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "miller-rabin": "4.0.0", + "randombytes": "2.0.5" + } + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=", + "dev": true + }, + "domain-browser": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", + "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", + "dev": true + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "dev": true, + "requires": { + "readable-stream": "2.3.3" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, + "elliptic": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", + "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "brorand": "1.1.0", + "hash.js": "1.1.3", + "hmac-drbg": "1.0.1", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0", + "minimalistic-crypto-utils": "1.0.1" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "enhanced-resolve": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz", + "integrity": "sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "memory-fs": "0.4.1", + "object-assign": "4.1.1", + "tapable": "0.2.8" + } + }, + "errno": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", + "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", + "dev": true, + "requires": { + "prr": "0.0.0" + } + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz", + "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", + "dev": true, + "requires": { + "create-hash": "1.1.3" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "2.2.3" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "form-data": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.2.0.tgz", + "integrity": "sha1-ml47kpX5gLJiPPZPojixTOvKcHs=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.16" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", + "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "dev": true, + "requires": { + "min-document": "2.19.0", + "process": "0.5.2" + }, + "dependencies": { + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=", + "dev": true + } + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "3.0.2", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "unzip-response": "2.0.1", + "url-parse-lax": "1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "dev": true, + "requires": { + "function-bind": "1.1.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha1-ZuodhW206KVHDK32/OI65SRO8uE=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.0" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "1.1.3", + "minimalistic-assert": "1.0.0", + "minimalistic-crypto-utils": "1.0.1" + } + }, + "htmlescape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", + "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", + "dev": true + }, + "http-proxy-agent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-1.0.0.tgz", + "integrity": "sha1-zBzjjkU7+YSg93AtLdWcc9CBKEo=", + "dev": true, + "requires": { + "agent-base": "2.1.1", + "debug": "2.6.8", + "extend": "3.0.1" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "https-proxy-agent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz", + "integrity": "sha1-NffabEjOTdv6JkiRrFk+5f+GceY=", + "dev": true, + "requires": { + "agent-base": "2.1.1", + "debug": "2.6.8", + "extend": "3.0.1" + } + }, + "ieee754": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", + "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "dev": true + }, + "inline-source-map": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", + "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", + "dev": true, + "requires": { + "source-map": "0.5.6" + } + }, + "insert-module-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.1.tgz", + "integrity": "sha1-wDv04BywhtW15azorQr+eInWOMM=", + "dev": true, + "requires": { + "combine-source-map": "0.7.2", + "concat-stream": "1.5.2", + "is-buffer": "1.1.5", + "JSONStream": "1.3.1", + "lexical-scope": "1.2.0", + "process": "0.11.10", + "through2": "2.0.3", + "xtend": "4.0.1" + } + }, + "interpret": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-0.6.6.tgz", + "integrity": "sha1-/s16GOfOXKar+5U+H4YhOknxYls=", + "dev": true + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true, + "requires": { + "loose-envify": "1.3.1" + } + }, + "is-absolute": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.2.6.tgz", + "integrity": "sha1-IN5p89uULvLYe5wto28XIjWxtes=", + "dev": true, + "requires": { + "is-relative": "0.2.1", + "is-windows": "0.2.0" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "1.9.0" + } + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-relative": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.2.1.tgz", + "integrity": "sha1-0n9MfVFtF1+2ENuEu+7yPDvJeqU=", + "dev": true, + "requires": { + "is-unc-path": "0.1.2" + } + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-unc-path": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-0.1.2.tgz", + "integrity": "sha1-arBTpyVzwQJQ/0FqOBTDUXivObk=", + "dev": true, + "requires": { + "unc-path-regex": "0.1.2" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "json-stable-stringify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "JSONStream": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", + "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", + "dev": true, + "requires": { + "jsonparse": "1.3.1", + "through": "2.3.8" + } + }, + "jspm-config": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/jspm-config/-/jspm-config-0.3.4.tgz", + "integrity": "sha1-RMJpAuSujs4jZs7cn/FrEKXzkcY=", + "dev": true, + "requires": { + "any-promise": "1.3.0", + "graceful-fs": "4.1.11", + "make-error-cause": "1.2.2", + "object.pick": "1.2.0", + "parse-json": "2.2.0", + "strip-bom": "3.0.0", + "thenify": "3.3.0", + "throat": "3.2.0", + "xtend": "4.0.1" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + }, + "labeled-stream-splicer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz", + "integrity": "sha1-pS4dE4AkwAuGscDJH2d5GLiuClk=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "isarray": "0.0.1", + "stream-splicer": "2.0.0" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "4.0.1" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true + }, + "lexical-scope": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/lexical-scope/-/lexical-scope-1.2.0.tgz", + "integrity": "sha1-/Ope3HBKSzqHls3KQZw6CvryLfQ=", + "dev": true, + "requires": { + "astw": "2.2.0" + } + }, + "listify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/listify/-/listify-1.0.0.tgz", + "integrity": "sha1-A8p7otFQ1CZ3c/dOV1WNEFPSvuM=", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "3.1.3", + "emojis-list": "2.1.0", + "json5": "0.5.1" + } + }, + "lockfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.3.tgz", + "integrity": "sha1-Jjj8OaAzHpysGgS3F5mTHJxQ33k=", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "dev": true + }, + "log-update": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-1.0.2.tgz", + "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", + "dev": true, + "requires": { + "ansi-escapes": "1.4.0", + "cli-cursor": "1.0.2" + } + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "3.0.2" + } + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "make-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", + "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "make-error": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.0.tgz", + "integrity": "sha1-Uq06M5zPEM5itAQLcI/nByRLi5Y=" + }, + "make-error-cause": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", + "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", + "dev": true, + "requires": { + "make-error": "1.3.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "0.1.4", + "readable-stream": "2.3.3" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.3" + } + }, + "miller-rabin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.0.tgz", + "integrity": "sha1-SmL7HUKTPAVYOYL0xxb2+55sbT0=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "brorand": "1.1.0" + } + }, + "mime-db": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", + "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=", + "dev": true + }, + "mime-types": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz", + "integrity": "sha1-K4WKUuXs1RbbiXrCvodIeDBpjiM=", + "dev": true, + "requires": { + "mime-db": "1.29.0" + } + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "dev": true, + "requires": { + "dom-walk": "0.1.1" + } + }, + "minimalistic-assert": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "mocha": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz", + "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "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" + }, + "dependencies": { + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "module-deps": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz", + "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", + "dev": true, + "requires": { + "browser-resolve": "1.11.2", + "cached-path-relative": "1.0.1", + "concat-stream": "1.5.2", + "defined": "1.0.0", + "detective": "4.5.0", + "duplexer2": "0.1.4", + "inherits": "2.0.3", + "JSONStream": "1.3.1", + "parents": "1.0.1", + "readable-stream": "2.3.3", + "resolve": "1.4.0", + "stream-combiner2": "1.1.1", + "subarg": "1.0.0", + "through2": "2.0.3", + "xtend": "4.0.1" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node-libs-browser": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-0.7.0.tgz", + "integrity": "sha1-PicsCBnjCJNeJmdECNevDhSRuDs=", + "dev": true, + "requires": { + "assert": "1.4.1", + "browserify-zlib": "0.1.4", + "buffer": "4.9.1", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.3.0", + "domain-browser": "1.1.7", + "events": "1.1.1", + "https-browserify": "0.0.1", + "os-browserify": "0.2.1", + "path-browserify": "0.0.0", + "process": "0.11.10", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "readable-stream": "2.3.3", + "stream-browserify": "2.0.1", + "stream-http": "2.7.2", + "string_decoder": "0.10.31", + "timers-browserify": "2.0.3", + "tty-browserify": "0.0.0", + "url": "0.11.0", + "util": "0.10.3", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "browserify-aes": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-0.4.0.tgz", + "integrity": "sha1-BnFJtmjfMcS1hTPgLQHoBthgjiw=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "1.2.1", + "ieee754": "1.1.8", + "isarray": "1.0.0" + } + }, + "crypto-browserify": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.3.0.tgz", + "integrity": "sha1-ufx1u0oO1h3PHNXa6W6zDJw+UGw=", + "dev": true, + "requires": { + "browserify-aes": "0.4.0", + "pbkdf2-compat": "2.0.1", + "ripemd160": "0.2.0", + "sha.js": "2.2.6" + } + }, + "https-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz", + "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", + "dev": true + }, + "os-browserify": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.2.1.tgz", + "integrity": "sha1-Y/xMzuXS13Y9Jrv4YBB45sLgBE8=", + "dev": true + }, + "ripemd160": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-0.2.0.tgz", + "integrity": "sha1-K/GYveFnys+lHAqSjoS2i74XH84=", + "dev": true + }, + "sha.js": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.2.6.tgz", + "integrity": "sha1-F93t3F9yL7ZlAWWIlUYZd4ZzFbo=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "timers-browserify": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.3.tgz", + "integrity": "sha512-+JAqyNgg+M8+gXIrq2EeUr4kZqRz47Ysco7X5QKRGScRE9HIHckyHD1asozSFGeqx2nmPCgA8T5tIGVO0ML7/w==", + "dev": true, + "requires": { + "global": "4.3.2", + "setimmediate": "1.0.5" + } + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1.1.0" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.0.2" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "object.pick": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.2.0.tgz", + "integrity": "sha1-tTkr7peC2m2ft9avr1OXefEjTCs=", + "dev": true, + "requires": { + "isobject": "2.1.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "os-browserify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.1.2.tgz", + "integrity": "sha1-ScoCk+CxlZCl9d4Qx/JlphfY/lQ=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "6.7.1", + "registry-auth-token": "3.3.1", + "registry-url": "3.1.0", + "semver": "5.4.1" + } + }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", + "dev": true + }, + "parents": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", + "dev": true, + "requires": { + "path-platform": "0.11.15" + } + }, + "parse-asn1": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.0.tgz", + "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", + "dev": true, + "requires": { + "asn1.js": "4.9.1", + "browserify-aes": "1.0.6", + "create-hash": "1.1.3", + "evp_bytestokey": "1.0.0", + "pbkdf2": "3.0.13" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-platform": { + "version": "0.11.15", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", + "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" + }, + "pbkdf2": { + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.13.tgz", + "integrity": "sha512-+dCHxDH+djNtjgWmvVC/my3SYBAKpKNqKSjLkp+GtWWYe4XPE+e/PSD2aCanlEZZnqPk2uekTKNC/ccbwd2X2Q==", + "dev": true, + "requires": { + "create-hash": "1.1.3", + "create-hmac": "1.1.6", + "ripemd160": "2.0.1", + "safe-buffer": "5.1.1", + "sha.js": "2.4.8" + } + }, + "pbkdf2-compat": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz", + "integrity": "sha1-tuDI+plJTZTgURV1gCpZpcFC8og=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "popsicle": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/popsicle/-/popsicle-9.1.0.tgz", + "integrity": "sha1-T5APONV6V07BcO2kBJbjZAgr/2Y=", + "dev": true, + "requires": { + "concat-stream": "1.5.2", + "form-data": "2.2.0", + "make-error-cause": "1.2.2", + "tough-cookie": "2.3.2" + } + }, + "popsicle-proxy-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/popsicle-proxy-agent/-/popsicle-proxy-agent-3.0.0.tgz", + "integrity": "sha1-uRM8VdlFdZq37mG3cRNkYg066tw=", + "dev": true, + "requires": { + "http-proxy-agent": "1.0.0", + "https-proxy-agent": "1.0.0" + } + }, + "popsicle-retry": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/popsicle-retry/-/popsicle-retry-3.2.1.tgz", + "integrity": "sha1-4G6GZTO0KnoSPrMwy+Y6fOvLoQw=", + "dev": true, + "requires": { + "any-promise": "1.3.0", + "xtend": "4.0.1" + } + }, + "popsicle-rewrite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/popsicle-rewrite/-/popsicle-rewrite-1.0.0.tgz", + "integrity": "sha1-HdTo6pwxgjUfuCD4eTTZkvf7kAc=", + "dev": true + }, + "popsicle-status": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/popsicle-status/-/popsicle-status-2.0.1.tgz", + "integrity": "sha1-jdcMT+fGlBCa3XhP/oDqysHnso0=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "promise-finally": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/promise-finally/-/promise-finally-3.0.0.tgz", + "integrity": "sha1-3dXQ+JVDKxIGzrjaEnUGTRjnqiM=", + "dev": true + }, + "prr": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", + "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.0.tgz", + "integrity": "sha1-OfaZ86RlYN1eusvKaTyvfGXBjMY=", + "dev": true, + "requires": { + "bn.js": "4.11.7", + "browserify-rsa": "4.0.1", + "create-hash": "1.1.3", + "parse-asn1": "5.1.0", + "randombytes": "2.0.5" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + } + } + }, + "randombytes": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz", + "integrity": "sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "rc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "dev": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + } + }, + "read-only-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", + "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", + "dev": true, + "requires": { + "readable-stream": "2.3.3" + } + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "minimatch": "3.0.4", + "readable-stream": "2.3.3", + "set-immediate-shim": "1.0.1" + } + }, + "regex-cache": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz", + "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3", + "is-primitive": "2.0.0" + } + }, + "registry-auth-token": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", + "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", + "dev": true, + "requires": { + "rc": "1.2.1", + "safe-buffer": "5.1.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "1.2.1" + } + }, + "remove-trailing-separator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz", + "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "1.1.1", + "onetime": "1.1.0" + } + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "requires": { + "align-text": "0.1.4" + } + }, + "rimraf": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "ripemd160": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", + "integrity": "sha1-D0WEKVxTo2KK9+bXmsohzlfRxuc=", + "dev": true, + "requires": { + "hash-base": "2.0.2", + "inherits": "2.0.3" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "5.4.1" + } + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "sha.js": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.8.tgz", + "integrity": "sha1-NwaMLEdra69ALRSknGf1l5IfY08=", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "shasum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", + "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", + "dev": true, + "requires": { + "json-stable-stringify": "0.0.1", + "sha.js": "2.4.8" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shell-quote": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "dev": true, + "requires": { + "array-filter": "0.0.1", + "array-map": "0.0.0", + "array-reduce": "0.0.0", + "jsonify": "0.0.0" + } + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "1.1.0" + } + }, + "source-list-map": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-0.1.8.tgz", + "integrity": "sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY=", + "dev": true + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=" + }, + "source-map-support": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", + "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "requires": { + "source-map": "0.5.6" + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3" + } + }, + "stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", + "dev": true, + "requires": { + "duplexer2": "0.1.4", + "readable-stream": "2.3.3" + } + }, + "stream-http": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.7.2.tgz", + "integrity": "sha512-c0yTD2rbQzXtSsFSVhtpvY/vS6u066PcXOX9kBB3mSO76RiUQzL340uJkGBWnlBg4/HZzqiUXtaVA7wcRcJgEw==", + "dev": true, + "requires": { + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" + } + }, + "stream-splicer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz", + "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "string-template": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", + "integrity": "sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "subarg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "dev": true, + "requires": { + "minimist": "1.2.0" + } + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + }, + "syntax-error": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.3.0.tgz", + "integrity": "sha1-HtkmbE1AvnXcVb+bsct3Biu5bKE=", + "dev": true, + "requires": { + "acorn": "4.0.13" + } + }, + "tapable": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz", + "integrity": "sha1-mTcqXJmb8t8WCvwNdL7U9HlIzSI=", + "dev": true + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "0.7.0" + } + }, + "thenify": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", + "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", + "dev": true, + "requires": { + "any-promise": "1.3.0" + } + }, + "throat": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-3.2.0.tgz", + "integrity": "sha512-/EY8VpvlqJ+sFtLPeOgc8Pl7kQVOWv0woD87KTXVHPIAE842FGT+rokxIhe8xIUP1cfgrkt0as0vDLjDiMtr8w==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.3.3", + "xtend": "4.0.1" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "timers-browserify": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", + "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", + "dev": true, + "requires": { + "process": "0.11.10" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "touch": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-1.0.0.tgz", + "integrity": "sha1-RJy+LbrlqMgDjjDXH6D/RklHxN4=", + "dev": true, + "requires": { + "nopt": "1.0.10" + } + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "ts-loader": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-2.3.2.tgz", + "integrity": "sha512-KcQvWwla5nviCMX1511iKVsLfrx97Hbah6l5awE1HNL6eiyAzb3gSO8b5yasB6fK/qGukLpu9czWcd/AGGFy/g==", + "dev": true, + "requires": { + "chalk": "2.0.1", + "enhanced-resolve": "3.4.1", + "loader-utils": "1.1.0", + "semver": "5.4.1" + } + }, + "ts-node": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz", + "integrity": "sha1-wTxqMCTjC+EYDdUwOPwgkonUv2k=", + "requires": { + "arrify": "1.0.1", + "chalk": "2.0.1", + "diff": "3.2.0", + "make-error": "1.3.0", + "minimist": "1.2.0", + "mkdirp": "0.5.1", + "source-map-support": "0.4.15", + "tsconfig": "6.0.0", + "v8flags": "3.0.0", + "yn": "2.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "tsconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", + "integrity": "sha1-aw6DdgA9evGGT434+J3QBZ/80DI=", + "requires": { + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1" + } + } + } + }, + "tsconfig": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-5.0.3.tgz", + "integrity": "sha1-X0J45wGACWeo/Dg/0ZZIh48qbjo=", + "dev": true, + "requires": { + "any-promise": "1.3.0", + "parse-json": "2.2.0", + "strip-bom": "2.0.0", + "strip-json-comments": "2.0.1" + } + }, + "tsify": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/tsify/-/tsify-3.0.1.tgz", + "integrity": "sha1-I1Cf87TnEQypZW9sJ8oT7IVgVvY=", + "dev": true, + "requires": { + "convert-source-map": "1.1.3", + "fs.realpath": "1.0.0", + "object-assign": "4.1.1", + "semver": "5.4.1", + "through2": "2.0.3", + "tsconfig": "5.0.3" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz", + "integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ=", + "dev": true + }, + "typings": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/typings/-/typings-2.1.1.tgz", + "integrity": "sha1-usxp0lWXCkeOCfdsf2iZddU1p4o=", + "dev": true, + "requires": { + "archy": "1.0.0", + "bluebird": "3.5.0", + "chalk": "1.1.3", + "cli-truncate": "1.1.0", + "columnify": "1.5.4", + "elegant-spinner": "1.0.1", + "has-unicode": "2.0.1", + "listify": "1.0.0", + "log-update": "1.0.2", + "minimist": "1.2.0", + "promise-finally": "3.0.0", + "typings-core": "2.3.3", + "update-notifier": "2.2.0", + "wordwrap": "1.0.0", + "xtend": "4.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "typings-core": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/typings-core/-/typings-core-2.3.3.tgz", + "integrity": "sha1-CexUzVsR3V8e8vwKsx03ACyita0=", + "dev": true, + "requires": { + "array-uniq": "1.0.3", + "configstore": "3.1.1", + "debug": "2.6.8", + "detect-indent": "5.0.0", + "graceful-fs": "4.1.11", + "has": "1.0.1", + "invariant": "2.2.2", + "is-absolute": "0.2.6", + "jspm-config": "0.3.4", + "listify": "1.0.0", + "lockfile": "1.0.3", + "make-error-cause": "1.2.2", + "mkdirp": "0.5.1", + "object.pick": "1.2.0", + "parse-json": "2.2.0", + "popsicle": "9.1.0", + "popsicle-proxy-agent": "3.0.0", + "popsicle-retry": "3.2.1", + "popsicle-rewrite": "1.0.0", + "popsicle-status": "2.0.1", + "promise-finally": "3.0.0", + "rc": "1.2.1", + "rimraf": "2.6.1", + "sort-keys": "1.1.2", + "string-template": "1.0.0", + "strip-bom": "3.0.0", + "thenify": "3.3.0", + "throat": "3.2.0", + "touch": "1.0.0", + "typescript": "2.4.2", + "xtend": "4.0.1", + "zip-object": "0.1.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "uglify-js": { + "version": "2.7.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz", + "integrity": "sha1-RhLAx7qu4rp8SH3kkErhIgefLKg=", + "dev": true, + "requires": { + "async": "0.2.10", + "source-map": "0.5.6", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true + }, + "umd": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.1.tgz", + "integrity": "sha1-iuVW4RAR9jwllnCKiDclnwGz1g4=", + "dev": true + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "1.0.0" + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "update-notifier": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.2.0.tgz", + "integrity": "sha1-G1g3z5DAc22IYncytmHBOPht5y8=", + "dev": true, + "requires": { + "boxen": "1.2.1", + "chalk": "1.1.3", + "configstore": "3.1.1", + "import-lazy": "2.1.0", + "is-npm": "1.0.0", + "latest-version": "3.1.0", + "semver-diff": "2.1.0", + "xdg-basedir": "3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "1.0.4" + } + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=" + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "v8flags": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.0.0.tgz", + "integrity": "sha512-AGl+C+4qpeSu2g3JxCD/mGFFOs/vVZ3XREkD3ibQXEqr4Y4zgIrPWW124/IKJFHOIVFIoH8miWrLf0o84HYjwA==", + "requires": { + "user-home": "1.1.1" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "watchpack": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz", + "integrity": "sha1-Yuqkq15bo1/fwBgnVibjwPXj+ws=", + "dev": true, + "requires": { + "async": "0.9.2", + "chokidar": "1.7.0", + "graceful-fs": "4.1.11" + }, + "dependencies": { + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "dev": true + } + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "1.0.3" + } + }, + "webpack": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-1.15.0.tgz", + "integrity": "sha1-T/MfU9sDM55VFkqdRo7gMklo/pg=", + "dev": true, + "requires": { + "acorn": "3.3.0", + "async": "1.5.2", + "clone": "1.0.2", + "enhanced-resolve": "0.9.1", + "interpret": "0.6.6", + "loader-utils": "0.2.17", + "memory-fs": "0.3.0", + "mkdirp": "0.5.1", + "node-libs-browser": "0.7.0", + "optimist": "0.6.1", + "supports-color": "3.1.2", + "tapable": "0.1.10", + "uglify-js": "2.7.5", + "watchpack": "0.2.9", + "webpack-core": "0.6.9" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + }, + "enhanced-resolve": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz", + "integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "memory-fs": "0.2.0", + "tapable": "0.1.10" + }, + "dependencies": { + "memory-fs": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz", + "integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=", + "dev": true + } + } + }, + "loader-utils": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "3.1.3", + "emojis-list": "2.1.0", + "json5": "0.5.1", + "object-assign": "4.1.1" + } + }, + "memory-fs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.3.0.tgz", + "integrity": "sha1-e8xrYp46Q+hx1+Kaymrop/FcuyA=", + "dev": true, + "requires": { + "errno": "0.1.4", + "readable-stream": "2.3.3" + } + }, + "tapable": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz", + "integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=", + "dev": true + } + } + }, + "webpack-core": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/webpack-core/-/webpack-core-0.6.9.tgz", + "integrity": "sha1-/FcViMhVjad76e+23r3Fo7FyvcI=", + "dev": true, + "requires": { + "source-list-map": "0.1.8", + "source-map": "0.4.4" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + } + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "widest-line": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", + "integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=", + "dev": true, + "requires": { + "string-width": "1.0.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.1.0.tgz", + "integrity": "sha512-0TZ20a+xcIl4u0+Mj5xDH2yOWdmQiXlKf9Hm+TgDXjTMsEYb+gDrmb8e8UNAzMCitX8NBqG4Z/FUQIyzv/R1JQ==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "slide": "1.1.6" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + } + } + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=" + }, + "zip-object": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/zip-object/-/zip-object-0.1.0.tgz", + "integrity": "sha1-waDaBMiMg3dW4khoCgP/kC7D9To=", + "dev": true + } + } +} diff --git a/samples/client/petstore/typescript-fetch/tests/default/package.json b/samples/client/petstore/typescript-fetch/tests/default/package.json index b95b42bc29e..96ac38788f2 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/package.json +++ b/samples/client/petstore/typescript-fetch/tests/default/package.json @@ -1,20 +1,29 @@ { "private": true, "dependencies": { - "chai": "^3.5.0" - }, - "devDependencies": { - "browserify": "^13.0.1", - "ts-loader": "^0.8.2", - "tsify": "^0.16.0", - "typescript": "^1.8.10", - "typings": "^1.0.4", - "webpack": "^1.13.0" + "@swagger/typescript-fetch-petstore": "file:../../builds/with-npm-version", + "chai": "^4.1.0", + "ts-node": "^3.3.0" }, "scripts": { - "prepublish": "./scripts/prepublish.sh", - "pretest": "npm install mocha", - "test": "mocha" + "prepublish": "npm install ../../builds/with-npm-version && npm run build && npm run webpack && npm run browserify", + "test": "mocha test/*.ts --compilers ts:ts-node/register --timeout 10000", + "build": "tsc", + "webpack": "webpack", + "browserify": "browserify test -p [ tsify ] > ./dist/test.browserify-bundle.js" + }, + "devDependencies": { + "@types/chai": "^4.0.1", + "@types/isomorphic-fetch": "0.0.34", + "@types/mocha": "^2.2.41", + "@types/node": "^8.0.14", + "browserify": "^14.4.0", + "mocha": "^3.4.2", + "ts-loader": "^2.3.0", + "tsify": "^3.0.1", + "typescript": "^2.4.1", + "typings": "^2.1.1", + "webpack": "^1.13.0" }, "name": "typescript-fetch-test", "version": "1.0.0", diff --git a/samples/client/petstore/typescript-fetch/tests/default/scripts/prepublish.sh b/samples/client/petstore/typescript-fetch/tests/default/scripts/prepublish.sh deleted file mode 100755 index 3c0dfb05953..00000000000 --- a/samples/client/petstore/typescript-fetch/tests/default/scripts/prepublish.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -npm install ../../builds/default -typings install - -# Build Node.js -tsc - -# Build Webpack -webpack - -# Build browserify -browserify test -p [ tsify ] > ./dist/test.browserify-bundle.js diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts b/samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts index 528c1c8e32d..8c89846d007 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/tests/default/test/PetApi.ts @@ -1,79 +1,79 @@ -import {expect} from 'chai'; -import {PetApi, Pet, Category} from 'typescript-fetch-api'; +import { expect } from 'chai'; +import { PetApi, Pet, Category } from '@swagger/typescript-fetch-petstore'; describe('PetApi', () => { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any): void { - describe(description, () => { + describe(description, () => { - let api: PetApi; - const fixture: Pet = createTestFixture(); + let api: PetApi; + const fixture: Pet = createTestFixture(); - beforeEach(() => { - api = new PetApi(); - }); - - it('should add and delete Pet', () => { - return api.addPet({ body: fixture }, requestOptions).then(() => { - }); - }); - - it('should get Pet by ID', () => { - return api.getPetById({ petId: fixture.id }, requestOptions).then((result: Pet) => { - return expect(result).to.deep.equal(fixture); - }); - }); - - it('should update Pet by ID', () => { - return api.getPetById({ petId: fixture.id }, requestOptions).then( (result: Pet) => { - result.name = 'newname'; - return api.updatePet({ body: result }, requestOptions).then(() => { - return api.getPetById({ petId: fixture.id }, requestOptions).then( (result: Pet) => { - return expect(result.name).to.deep.equal('newname'); + beforeEach(() => { + api = new PetApi(); }); - }); + + it('should add and delete Pet', () => { + return api.addPet(fixture, requestOptions).then(() => { + }); + }); + + it('should get Pet by ID', () => { + return api.getPetById(fixture.id, requestOptions).then((result: Pet) => { + return expect(result).to.deep.equal(fixture); + }); + }); + + it('should update Pet by ID', () => { + return api.getPetById(fixture.id, requestOptions).then((result: Pet) => { + result.name = 'newname'; + return api.updatePet(result, requestOptions).then(() => { + return api.getPetById(fixture.id, requestOptions).then((result: Pet) => { + return expect(result.name).to.deep.equal('newname'); + }); + }); + }); + }); + + it('should delete Pet', () => { + return api.deletePet(fixture.id, requestOptions); + }); + + it('should not contain deleted Pet', () => { + return api.getPetById(fixture.id, requestOptions).then((result: Pet) => { + return expect(result).to.not.exist; + }, (err: any) => { + return expect(err).to.exist; + }); + }); + }); - }); + } - it('should delete Pet', () => { - return api.deletePet({ petId: fixture.id }, requestOptions); - }); - - it('should not contain deleted Pet', () => { - return api.getPetById({ petId: fixture.id }, requestOptions).then((result: Pet) => { - return expect(result).to.not.exist; - }, (err: any) => { - return expect(err).to.exist; - }); - }); + runSuite('without custom request options'); + runSuite('with custom request options', { + credentials: 'include', + mode: 'cors' }); - } - - runSuite('without custom request options'); - - runSuite('with custom request options', { - credentials: 'include', - mode: 'cors' - }); }); function createTestFixture(ts = Date.now()) { - const category: Category = { - 'id': ts, - 'name': `category${ts}`, - }; + const category: Category = { + 'id': ts, + 'name': `category${ts}`, + }; - const pet: Pet = { - 'id': ts, - 'name': `pet${ts}`, - 'category': category, - 'photoUrls': ['http://foo.bar.com/1', 'http://foo.bar.com/2'], - 'status': 'available', - 'tags': [] - }; + const pet: Pet = { + 'id': ts, + 'name': `pet${ts}`, + 'category': category, + 'photoUrls': ['http://foo.bar.com/1', 'http://foo.bar.com/2'], + 'status': Pet.StatusEnum.Available, + 'tags': [] + }; - return pet; + return pet; }; diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts b/samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts index 87626db5b70..35bcc98d874 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts +++ b/samples/client/petstore/typescript-fetch/tests/default/test/PetApiFactory.ts @@ -1,87 +1,91 @@ -import {expect} from 'chai'; -import {PetApiFactory, Pet, Category} from 'typescript-fetch-api'; -import {Configuration} from 'typescript-fetch-api/dist/configuration'; +import { expect } from 'chai'; +import { PetApiFactory, Pet, Category } from '@swagger/typescript-fetch-petstore'; +import { Configuration } from '@swagger/typescript-fetch-petstore'; let config: Configuration; -before(function() { - config = new Configuration(); - config.accessToken = "foobar"; - config.apiKey = { - api_key: "foobar" - }; - config.username = "foo"; - config.password = "bar"; +before(function () { + config = new Configuration(); + config.accessToken = "foobar"; + config.apiKey = (securityName: string) => { + // for multiple apiKey security + if (securityName === "api_key") { + return "foobar"; + } + return; + }; + config.username = "foo"; + config.password = "bar"; }); describe('PetApiFactory', () => { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any): void { - describe(description, () => { + describe(description, () => { - const fixture: Pet = createTestFixture(); + const fixture: Pet = createTestFixture(); - it('should add and delete Pet', () => { - return PetApiFactory().addPet({ body: fixture }, config, requestOptions).then(() => { - }); - }); - - it('should get Pet by ID', () => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then((result: Pet) => { - return expect(result).to.deep.equal(fixture); - }); - }); - - it('should update Pet by ID', () => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then( (result: Pet) => { - result.name = 'newname'; - return PetApiFactory().updatePet({ body: result }, config, requestOptions).then(() => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then( (result: Pet) => { - return expect(result.name).to.deep.equal('newname'); + it('should add and delete Pet', () => { + return PetApiFactory(config).addPet(fixture, requestOptions).then(() => { + }); }); - }); - }); - }); - it('should delete Pet', () => { - return PetApiFactory().deletePet({ petId: fixture.id }, config, requestOptions); - }); + it('should get Pet by ID', () => { + return PetApiFactory(config).getPetById(fixture.id, requestOptions).then((result: Pet) => { + return expect(result).to.deep.equal(fixture); + }); + }); - it('should not contain deleted Pet', () => { - return PetApiFactory().getPetById({ petId: fixture.id }, config, requestOptions).then((result: Pet) => { - return expect(result).to.not.exist; - }, (err: any) => { - return expect(err).to.exist; + it('should update Pet by ID', () => { + return PetApiFactory(config).getPetById(fixture.id, requestOptions).then((result: Pet) => { + result.name = 'newname'; + return PetApiFactory(config).updatePet(result, requestOptions).then(() => { + return PetApiFactory(config).getPetById(fixture.id, requestOptions).then((result: Pet) => { + return expect(result.name).to.deep.equal('newname'); + }); + }); + }); + }); + + it('should delete Pet', () => { + return PetApiFactory(config).deletePet(fixture.id, requestOptions); + }); + + it('should not contain deleted Pet', () => { + return PetApiFactory(config).getPetById(fixture.id, requestOptions).then((result: Pet) => { + return expect(result).to.not.exist; + }, (err: any) => { + return expect(err).to.exist; + }); + }); }); - }); + } + + runSuite('without custom request options'); + + runSuite('with custom request options', { + credentials: 'include', + mode: 'cors' }); - } - - runSuite('without custom request options'); - - runSuite('with custom request options', { - credentials: 'include', - mode: 'cors' - }); }); function createTestFixture(ts = Date.now()) { - const category: Category = { - 'id': ts, - 'name': `category${ts}`, - }; + const category: Category = { + 'id': ts, + 'name': `category${ts}`, + }; - const pet: Pet = { - 'id': ts, - 'name': `pet${ts}`, - 'category': category, - 'photoUrls': ['http://foo.bar.com/1', 'http://foo.bar.com/2'], - 'status': 'available', - 'tags': [] - }; + const pet: Pet = { + 'id': ts, + 'name': `pet${ts}`, + 'category': category, + 'photoUrls': ['http://foo.bar.com/1', 'http://foo.bar.com/2'], + 'status': Pet.StatusEnum.Available, + 'tags': [] + }; - return pet; + return pet; }; diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts b/samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts index 693bb1b2b52..24f50717360 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts +++ b/samples/client/petstore/typescript-fetch/tests/default/test/StoreApi.ts @@ -1,31 +1,31 @@ -import {expect} from 'chai'; -import {StoreApi} from 'typescript-fetch-api'; +import { expect } from 'chai'; +import { StoreApi } from '@swagger/typescript-fetch-petstore'; -describe('StoreApi', function() { +describe('StoreApi', function () { - function runSuite(description: string, requestOptions?: any): void { + function runSuite(description: string, requestOptions?: any): void { - describe(description, () => { - let api: StoreApi; + describe(description, () => { + let api: StoreApi; - beforeEach(function() { - api = new StoreApi(); - }); + beforeEach(function () { + api = new StoreApi(); + }); + + it('should get inventory', function () { + return api.getInventory(requestOptions).then((result: { [key: string]: number }) => { + expect(Object.keys(result)).to.not.be.empty; + }); + }); - it('should get inventory', function() { - return api.getInventory(requestOptions).then((result: { [key: string]: number }) => { - expect(Object.keys(result)).to.not.be.empty; }); - }); + } + runSuite('without custom request options'); + + runSuite('with custom request options', { + credentials: 'include', + mode: 'cors' }); - } - - runSuite('without custom request options'); - - runSuite('with custom request options', { - credentials: 'include', - mode: 'cors' - }); }); diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts b/samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts index 1f1fd54b009..d87bd020a85 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts +++ b/samples/client/petstore/typescript-fetch/tests/default/test/StoreApiFactory.ts @@ -1,38 +1,42 @@ -import {expect} from 'chai'; -import {StoreApiFactory} from 'typescript-fetch-api'; -import {Configuration} from 'typescript-fetch-api/dist/configuration'; +import { expect } from 'chai'; +import { StoreApiFactory } from '@swagger/typescript-fetch-petstore'; +import { Configuration } from '@swagger/typescript-fetch-petstore'; let config: Configuration; -before(function() { - config = new Configuration(); - config.accessToken = "foobar"; - config.apiKey = { - api_key: "foobar" - }; - config.username = "foo"; - config.password = "bar"; +before(function () { + config = new Configuration(); + config.accessToken = "foobar"; + config.apiKey = (securityName: string) => { + // for multiple apiKey security + if (securityName === "api_key") { + return "foobar"; + } + return; + }; + config.username = "foo"; + config.password = "bar"; }); -describe('StoreApiFactory', function() { - function runSuite(description: string, requestOptions?: any): void { +describe('StoreApiFactory', function () { + function runSuite(description: string, requestOptions?: any): void { - describe(description, () => { + describe(description, () => { + + it('should get inventory', function () { + return StoreApiFactory(config).getInventory(requestOptions).then((result: { [key: string]: number }) => { + expect(Object.keys(result)).to.not.be.empty; + }); + }); - it('should get inventory', function() { - return StoreApiFactory().getInventory(config, requestOptions).then((result: { [key: string]: number }) => { - expect(Object.keys(result)).to.not.be.empty; }); - }); + } + runSuite('without custom request options'); + + runSuite('with custom request options', { + credentials: 'include', + mode: 'cors' }); - } - - runSuite('without custom request options'); - - runSuite('with custom request options', { - credentials: 'include', - mode: 'cors' - }); }); diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/index.ts b/samples/client/petstore/typescript-fetch/tests/default/test/index.ts index e3b9cbf4a50..a3adb97ca81 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/test/index.ts +++ b/samples/client/petstore/typescript-fetch/tests/default/test/index.ts @@ -1,4 +1,4 @@ import './PetApi'; import './StoreApi'; import './PetApiFactory'; -import './StoreApiFactory'; \ No newline at end of file +import './StoreApiFactory'; diff --git a/samples/client/petstore/typescript-fetch/tests/default/test/mocha.opts b/samples/client/petstore/typescript-fetch/tests/default/test/mocha.opts deleted file mode 100644 index 12ea969970a..00000000000 --- a/samples/client/petstore/typescript-fetch/tests/default/test/mocha.opts +++ /dev/null @@ -1 +0,0 @@ ---timeout 10000 dist/test diff --git a/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json b/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json index e47c2647e01..6524f781742 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/tests/default/tsconfig.json @@ -5,12 +5,15 @@ "noImplicitAny": true, "sourceMap": false, "outDir": "dist", - "rootDir": "." + "types": [ + "mocha" + ], + "lib": [ + "es6", + "dom" + ] }, "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/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/webpack.config.js b/samples/client/petstore/typescript-fetch/tests/default/webpack.config.js index d3332281c5c..1ae52808b86 100644 --- a/samples/client/petstore/typescript-fetch/tests/default/webpack.config.js +++ b/samples/client/petstore/typescript-fetch/tests/default/webpack.config.js @@ -5,7 +5,7 @@ module.exports = { app: './test/index.ts', vendor: [ // libraries - 'typescript-fetch-api' + '@swagger/typescript-fetch-petstore' ], }, output: { @@ -27,4 +27,4 @@ module.exports = { } ] } -}; \ No newline at end of file +};