From 960412a9b4b60c597ebab5b11871b5848f5c97cb Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Tue, 3 Jul 2018 11:03:40 -0400 Subject: [PATCH] Restructure TypeScript Node generation into separate files (PHNX-1041) (#363) --- .../TypeScriptNodeClientCodegen.java | 159 +- .../typescript-node/api-all.mustache | 12 + .../typescript-node/api-single.mustache | 221 +++ .../resources/typescript-node/api.mustache | 479 +---- .../resources/typescript-node/model.mustache | 69 + .../resources/typescript-node/models.mustache | 210 ++ .../typescript-node/package.mustache | 7 +- .../TypeScriptNodeClientOptionsProvider.java | 1 + .../typescript-node/.openapi-generator-ignore | 6 +- .../.openapi-generator/VERSION | 2 +- .../typescript-node/api.ts | 324 +-- .../typescript-node/api/apis.ts | 3 + .../typescript-node/api/fakeApi.ts | 119 ++ .../typescript-node/git_push.sh | 2 +- .../typescript-node/model/modelReturn.ts | 36 + .../typescript-node/model/models.ts | 187 ++ .../default/.openapi-generator/VERSION | 2 +- .../petstore/typescript-node/default/api.js | 1502 -------------- .../petstore/typescript-node/default/api.ts | 1743 +---------------- .../typescript-node/default/api/apis.ts | 7 + .../typescript-node/default/api/petApi.ts | 546 ++++++ .../typescript-node/default/api/storeApi.ts | 281 +++ .../typescript-node/default/api/userApi.ts | 504 +++++ .../default/model/apiResponse.ts | 45 + .../typescript-node/default/model/category.ts | 39 + .../typescript-node/default/model/models.ts | 204 ++ .../typescript-node/default/model/order.ts | 73 + .../typescript-node/default/model/pet.ts | 75 + .../typescript-node/default/model/tag.ts | 39 + .../typescript-node/default/model/user.ts | 78 + .../npm/.openapi-generator/VERSION | 2 +- .../petstore/typescript-node/npm/api.d.ts | 288 --- .../petstore/typescript-node/npm/api.js | 1488 -------------- .../petstore/typescript-node/npm/api.js.map | 1 - .../petstore/typescript-node/npm/api.ts | 1735 +--------------- .../petstore/typescript-node/npm/api/apis.ts | 7 + .../typescript-node/npm/api/petApi.ts | 546 ++++++ .../typescript-node/npm/api/storeApi.ts | 281 +++ .../typescript-node/npm/api/userApi.ts | 504 +++++ .../petstore/typescript-node/npm/client.d.ts | 1 - .../petstore/typescript-node/npm/client.js | 142 -- .../typescript-node/npm/client.js.map | 1 - .../petstore/typescript-node/npm/client.ts | 2 +- .../typescript-node/npm/model/apiResponse.ts | 45 + .../typescript-node/npm/model/category.ts | 39 + .../typescript-node/npm/model/models.ts | 204 ++ .../typescript-node/npm/model/order.ts | 73 + .../petstore/typescript-node/npm/model/pet.ts | 75 + .../petstore/typescript-node/npm/model/tag.ts | 39 + .../typescript-node/npm/model/user.ts | 78 + .../typescript-node/npm/package-lock.json | 835 -------- 51 files changed, 4819 insertions(+), 8542 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-node/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/typescript-node/models.mustache create mode 100644 samples/client/petstore-security-test/typescript-node/api/apis.ts create mode 100644 samples/client/petstore-security-test/typescript-node/api/fakeApi.ts create mode 100644 samples/client/petstore-security-test/typescript-node/model/modelReturn.ts create mode 100644 samples/client/petstore-security-test/typescript-node/model/models.ts delete mode 100644 samples/client/petstore/typescript-node/default/api.js create mode 100644 samples/client/petstore/typescript-node/default/api/apis.ts create mode 100644 samples/client/petstore/typescript-node/default/api/petApi.ts create mode 100644 samples/client/petstore/typescript-node/default/api/storeApi.ts create mode 100644 samples/client/petstore/typescript-node/default/api/userApi.ts create mode 100644 samples/client/petstore/typescript-node/default/model/apiResponse.ts create mode 100644 samples/client/petstore/typescript-node/default/model/category.ts create mode 100644 samples/client/petstore/typescript-node/default/model/models.ts create mode 100644 samples/client/petstore/typescript-node/default/model/order.ts create mode 100644 samples/client/petstore/typescript-node/default/model/pet.ts create mode 100644 samples/client/petstore/typescript-node/default/model/tag.ts create mode 100644 samples/client/petstore/typescript-node/default/model/user.ts delete mode 100644 samples/client/petstore/typescript-node/npm/api.d.ts delete mode 100644 samples/client/petstore/typescript-node/npm/api.js delete mode 100644 samples/client/petstore/typescript-node/npm/api.js.map create mode 100644 samples/client/petstore/typescript-node/npm/api/apis.ts create mode 100644 samples/client/petstore/typescript-node/npm/api/petApi.ts create mode 100644 samples/client/petstore/typescript-node/npm/api/storeApi.ts create mode 100644 samples/client/petstore/typescript-node/npm/api/userApi.ts delete mode 100644 samples/client/petstore/typescript-node/npm/client.d.ts delete mode 100644 samples/client/petstore/typescript-node/npm/client.js delete mode 100644 samples/client/petstore/typescript-node/npm/client.js.map create mode 100644 samples/client/petstore/typescript-node/npm/model/apiResponse.ts create mode 100644 samples/client/petstore/typescript-node/npm/model/category.ts create mode 100644 samples/client/petstore/typescript-node/npm/model/models.ts create mode 100644 samples/client/petstore/typescript-node/npm/model/order.ts create mode 100644 samples/client/petstore/typescript-node/npm/model/pet.ts create mode 100644 samples/client/petstore/typescript-node/npm/model/tag.ts create mode 100644 samples/client/petstore/typescript-node/npm/model/user.ts delete mode 100644 samples/client/petstore/typescript-node/npm/package-lock.json diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java index 4c97e1c04c8f..45f00f626be7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java @@ -19,7 +19,7 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.*; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -27,7 +27,7 @@ import java.io.File; import java.text.SimpleDateFormat; -import java.util.Date; +import java.util.*; public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class); @@ -41,11 +41,13 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen protected String npmName = null; protected String npmVersion = "1.0.0"; protected String npmRepository = null; + protected String apiSuffix = "Api"; public TypeScriptNodeClientCodegen() { super(); typeMapping.put("file", "Buffer"); + languageSpecificPrimitives.add("Buffer"); // clear import mapping (from default generator) as TS does not use it // at the moment @@ -53,6 +55,10 @@ public TypeScriptNodeClientCodegen() { outputFolder = "generated-code/typescript-node"; embeddedTemplateDir = templateDir = "typescript-node"; + modelTemplateFiles.put("model.mustache", ".ts"); + apiTemplateFiles.put("api-single.mustache", ".ts"); + modelPackage = "model"; + apiPackage = "api"; 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")); @@ -86,6 +92,101 @@ public String getTypeDeclaration(Schema p) { } return super.getTypeDeclaration(p); } + + @Override + public String toApiName(String name) { + if (name.length() == 0) { + return "Default" + apiSuffix; + } + return initialCaps(name) + apiSuffix; + } + + @Override + public String toApiFilename(String name) { + if (name.length() == 0) { + return "default" + apiSuffix; + } + return camelize(name, true) + apiSuffix; + } + + @Override + public String toApiImport(String name) { + return apiPackage() + "/" + toApiFilename(name); + } + + @Override + public String toModelFilename(String name) { + return camelize(toModelName(name), true); + } + + @Override + public String toModelImport(String name) { + return modelPackage() + "/" + toModelFilename(name); + } + + @Override + public Map postProcessAllModels(Map objs) { + Map result = super.postProcessAllModels(objs); + + for (Map.Entry entry : result.entrySet()) { + Map inner = (Map) entry.getValue(); + List> models = (List>) inner.get("models"); + for (Map mo : models) { + CodegenModel cm = (CodegenModel) mo.get("model"); + + // Add additional filename information for imports + mo.put("tsImports", toTsImports(cm, cm.imports)); + } + } + return result; + } + + private List> toTsImports(CodegenModel cm, Set imports) { + List> tsImports = new ArrayList<>(); + for (String im : imports) { + if (!im.equals(cm.classname)) { + HashMap tsImport = new HashMap<>(); + tsImport.put("classname", im); + tsImport.put("filename", toModelFilename(im)); + tsImports.add(tsImport); + } + } + return tsImports; + } + + @Override + public Map postProcessOperations(Map operations) { + Map objs = (Map) operations.get("operations"); + + // The api.mustache template requires all of the auth methods for the whole api + // Loop over all the operations and pick out each unique auth method + Map authMethodsMap = new HashMap<>(); + for (CodegenOperation op : (List) objs.get("operation")) { + if(op.hasAuthMethods){ + for(CodegenSecurity sec : op.authMethods){ + authMethodsMap.put(sec.name, sec); + } + } + } + + // If there wer any auth methods specified add them to the operations context + if (!authMethodsMap.isEmpty()) { + operations.put("authMethods", authMethodsMap.values()); + operations.put("hasAuthMethods", true); + } + + // Add filename information for api imports + objs.put("apiFilename", getApiFilenameFromClassname(objs.get("classname").toString())); + + // Add additional filename information for model imports in the apis + List> imports = (List>) operations.get("imports"); + for (Map im : imports) { + im.put("filename", im.get("import")); + im.put("classname", getModelnameFromModelFilename(im.get("filename").toString())); + } + + return operations; + } public void setNpmName(String npmName) { this.npmName = npmName; @@ -110,10 +211,12 @@ public void setNpmRepository(String npmRepository) { @Override public void processOpts() { super.processOpts(); - supportingFiles.add(new SupportingFile("api.mustache", null, "api.ts")); + supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts")); + supportingFiles.add(new SupportingFile("api-all.mustache", apiPackage().replace('.', File.separatorChar), "apis.ts")); + supportingFiles.add(new SupportingFile("api.mustache", getIndexDirectory(), "api.ts")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); - + if (additionalProperties.containsKey(NPM_NAME)) { addNpmPackageGeneration(); } @@ -141,9 +244,57 @@ private void addNpmPackageGeneration() { supportingFiles.add(new SupportingFile("package.mustache", getPackageRootDirectory(), "package.json")); supportingFiles.add(new SupportingFile("tsconfig.mustache", getPackageRootDirectory(), "tsconfig.json")); } + + private String getIndexDirectory() { + String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); + return indexPackage.replace('.', File.separatorChar); + } + + // The purpose of this override and associated methods is to allow for automatic conversion + // from 'file' type to the built in node 'Buffer' type + @Override + public String getSchemaType(Schema p) { + String openAPIType = super.getSchemaType(p); + if (isLanguagePrimitive(openAPIType) || isLanguageGenericType(openAPIType)) { + return openAPIType; + } + applyLocalTypeMapping(openAPIType); + return openAPIType; + } + + private String applyLocalTypeMapping(String type) { + if (typeMapping.containsKey(type)) { + type = typeMapping.get(type); + } + return type; + } + + private boolean isLanguagePrimitive(String type) { + return languageSpecificPrimitives.contains(type); + } + + // Determines if the given type is a generic/templated type (ie. ArrayList) + private boolean isLanguageGenericType(String type) { + for (String genericType : languageGenericTypes) { + if (type.startsWith(genericType + "<")) { + return true; + } + } + return false; + } private String getPackageRootDirectory() { String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.'))); return indexPackage.replace('.', File.separatorChar); } + + private String getApiFilenameFromClassname(String classname) { + String name = classname.substring(0, classname.length() - apiSuffix.length()); + return toApiFilename(name); + } + + private String getModelnameFromModelFilename(String filename) { + String name = filename.substring((modelPackage() + File.separator).length()); + return camelize(name); + } } diff --git a/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache b/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache new file mode 100644 index 000000000000..514b5e0d10fd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache @@ -0,0 +1,12 @@ +{{#apiInfo}} +{{#apis}} +{{#operations}} +export * from './{{ classFilename }}'; +import { {{ classname }} } from './{{ classFilename }}'; +{{/operations}} +{{#withInterfaces}} +export * from './{{ classFilename }}Interface' +{{/withInterfaces}} +{{/apis}} +export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; +{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache b/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache new file mode 100644 index 000000000000..b3508727eb67 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-node/api-single.mustache @@ -0,0 +1,221 @@ +{{>licenseInfo}} +import localVarRequest = require('request'); +import http = require('http'); +{{^supportsES6}} +import Promise = require('bluebird'); +{{/supportsES6}} + +/* tslint:disable:no-unused-locals */ +{{#imports}} +import { {{classname}} } from '../{{filename}}'; +{{/imports}} + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = '{{{basePath}}}'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +{{#operations}} +{{#description}} +/** +* {{&description}} +*/ +{{/description}} +export enum {{classname}}ApiKeys { +{{#authMethods}} +{{#isApiKey}} + {{name}}, +{{/isApiKey}} +{{/authMethods}} +} + +export class {{classname}} { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} + '{{name}}': new HttpBasicAuth(), +{{/isBasic}} +{{#isApiKey}} + '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{^isKeyInHeader}}'query'{{/isKeyInHeader}}, '{{keyParamName}}'), +{{/isApiKey}} +{{#isOAuth}} + '{{name}}': new OAuth(), +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + } + + constructor(basePath?: string); +{{#authMethods}} +{{#isBasic}} + constructor(username: string, password: string, basePath?: string); +{{/isBasic}} +{{/authMethods}} + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { +{{#authMethods}} +{{#isBasic}} + this.username = basePathOrUsername; + this.password = password +{{/isBasic}} +{{/authMethods}} + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: {{classname}}ApiKeys, value: string) { + (this.authentications as any)[{{classname}}ApiKeys[key]].apiKey = value; + } +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} + set username(username: string) { + this.authentications.{{name}}.username = username; + } + + set password(password: string) { + this.authentications.{{name}}.password = password; + } +{{/isBasic}} +{{#isOAuth}} + + set accessToken(token: string) { + this.authentications.{{name}}.accessToken = token; + } +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +{{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{paramName}} {{description}} + {{/allParams}} + */ + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { + const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}} + .replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}}; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + +{{#allParams}} +{{#required}} + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } + +{{/required}} +{{/allParams}} +{{#queryParams}} + if ({{paramName}} !== undefined) { + localVarQueryParameters['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); + } + +{{/queryParams}} +{{#headerParams}} + localVarHeaderParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); +{{/headerParams}} + + let localVarUseFormData = false; + +{{#formParams}} + if ({{paramName}} !== undefined) { + {{#isFile}} + localVarFormParams['{{baseName}}'] = {{paramName}}; + {{/isFile}} + {{^isFile}} + localVarFormParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); + {{/isFile}} + } +{{#isFile}} + localVarUseFormData = true; +{{/isFile}} + +{{/formParams}} + let localVarRequestOptions: localVarRequest.Options = { + method: '{{httpMethod}}', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, +{{^isResponseFile}} + json: true, +{{/isResponseFile}} +{{#isResponseFile}} + encoding: null, +{{/isResponseFile}} +{{#bodyParam}} + body: ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}") +{{/bodyParam}} + }; + +{{#authMethods}} + this.authentications.{{name}}.applyToRequest(localVarRequestOptions); + +{{/authMethods}} + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + {{#returnType}} + body = ObjectSerializer.deserialize(body, "{{{returnType}}}"); + {{/returnType}} + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/typescript-node/api.mustache b/modules/openapi-generator/src/main/resources/typescript-node/api.mustache index 50cb6cd7e4f5..4b76122d807b 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/api.mustache @@ -1,476 +1,3 @@ -{{>licenseInfo}} -import localVarRequest = require('request'); -import http = require('http'); -{{^supportsES6}} -import Promise = require('bluebird'); -{{/supportsES6}} - -let defaultBasePath = '{{{basePath}}}'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -class ObjectSerializer { - - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; - if(typeMap[discriminatorType]){ - return discriminatorType; // use the type given in the discriminator - } else { - return expectedType; // discriminator did not map to a type - } - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return data.toString(); - } else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - } - - public static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap[type]) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - } -} - -{{#models}} -{{#model}} -{{#description}} -/** -* {{{description}}} -*/ -{{/description}} -export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ -{{#vars}} -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; -{{/vars}} - - {{#discriminator}} - static discriminator: string | undefined = "{{discriminatorName}}"; - {{/discriminator}} - {{^discriminator}} - static discriminator: string | undefined = undefined; - {{/discriminator}} - - {{^isArrayModel}} - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - {{#vars}} - { - "name": "{{name}}", - "baseName": "{{baseName}}", - "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}" - }{{#hasMore}}, - {{/hasMore}} - {{/vars}} - ]; - - static getAttributeTypeMap() { - {{#parent}} - return super.getAttributeTypeMap().concat({{classname}}.attributeTypeMap); - {{/parent}} - {{^parent}} - return {{classname}}.attributeTypeMap; - {{/parent}} - } - {{/isArrayModel}} -} - -{{#hasEnums}} -export namespace {{classname}} { -{{#vars}} -{{#isEnum}} - export enum {{enumName}} { - {{#allowableValues}} - {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} - {{/allowableValues}} - } -{{/isEnum}} -{{/vars}} -} -{{/hasEnums}} -{{/model}} -{{/models}} - -let enumsMap: {[index: string]: any} = { - {{#models}} - {{#model}} - {{#hasEnums}} - {{#vars}} - {{#isEnum}} - {{#isContainer}}"{{classname}}.{{enumName}}": {{classname}}.{{enumName}}{{/isContainer}}{{#isNotContainer}}"{{datatypeWithEnum}}": {{datatypeWithEnum}}{{/isNotContainer}}, - {{/isEnum}} - {{/vars}} - {{/hasEnums}} - {{/model}} - {{/models}} -} - -let typeMap: {[index: string]: any} = { - {{#models}} - {{#model}} - "{{classname}}": {{classname}}, - {{/model}} - {{/models}} -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: localVarRequest.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string = ''; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - } -} - -export class VoidAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -{{#apiInfo}} -{{#apis}} -{{#operations}} -{{#description}} -/** -* {{&description}} -*/ -{{/description}} -export enum {{classname}}ApiKeys { -{{#authMethods}} -{{#isApiKey}} - {{name}}, -{{/isApiKey}} -{{/authMethods}} -} - -export class {{classname}} { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), -{{#authMethods}} -{{#isBasic}} - '{{name}}': new HttpBasicAuth(), -{{/isBasic}} -{{#isApiKey}} - '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{^isKeyInHeader}}'query'{{/isKeyInHeader}}, '{{keyParamName}}'), -{{/isApiKey}} -{{#isOAuth}} - '{{name}}': new OAuth(), -{{/isOAuth}} -{{/authMethods}} - } - - constructor(basePath?: string); -{{#authMethods}} -{{#isBasic}} - constructor(username: string, password: string, basePath?: string); -{{/isBasic}} -{{/authMethods}} - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { -{{#authMethods}} -{{#isBasic}} - this.username = basePathOrUsername; - this.password = password -{{/isBasic}} -{{/authMethods}} - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: {{classname}}ApiKeys, value: string) { - (this.authentications as any)[{{classname}}ApiKeys[key]].apiKey = value; - } -{{#authMethods}} -{{#isBasic}} - set username(username: string) { - this.authentications.{{name}}.username = username; - } - - set password(password: string) { - this.authentications.{{name}}.password = password; - } -{{/isBasic}} -{{#isOAuth}} - - set accessToken(token: string) { - this.authentications.{{name}}.accessToken = token; - } -{{/isOAuth}} -{{/authMethods}} -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{paramName}} {{description}} - {{/allParams}} - */ - public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { - const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}} - .replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}}; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - -{{#allParams}} -{{#required}} - // verify required parameter '{{paramName}}' is not null or undefined - if ({{paramName}} === null || {{paramName}} === undefined) { - throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); - } - -{{/required}} -{{/allParams}} -{{#queryParams}} - if ({{paramName}} !== undefined) { - localVarQueryParameters['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); - } - -{{/queryParams}} -{{#headerParams}} - localVarHeaderParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); -{{/headerParams}} - - let localVarUseFormData = false; - -{{#formParams}} - if ({{paramName}} !== undefined) { - {{#isFile}} - localVarFormParams['{{baseName}}'] = {{paramName}}; - {{/isFile}} - {{^isFile}} - localVarFormParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); - {{/isFile}} - } -{{#isFile}} - localVarUseFormData = true; -{{/isFile}} - -{{/formParams}} - let localVarRequestOptions: localVarRequest.Options = { - method: '{{httpMethod}}', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, -{{^isResponseFile}} - json: true, -{{/isResponseFile}} -{{#isResponseFile}} - encoding: null, -{{/isResponseFile}} -{{#bodyParam}} - body: ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}") -{{/bodyParam}} - }; - -{{#authMethods}} - this.authentications.{{name}}.applyToRequest(localVarRequestOptions); - -{{/authMethods}} - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - {{#returnType}} - body = ObjectSerializer.deserialize(body, "{{{returnType}}}"); - {{/returnType}} - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -{{/operation}} -} -{{/operations}} -{{/apis}} -{{/apiInfo}} +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-node/model.mustache b/modules/openapi-generator/src/main/resources/typescript-node/model.mustache new file mode 100644 index 000000000000..0b3ca7589164 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-node/model.mustache @@ -0,0 +1,69 @@ +{{>licenseInfo}} +{{#models}} +{{#model}} +{{#tsImports}} +import { {{classname}} } from './{{filename}}'; +{{/tsImports}} + +{{#description}} +/** +* {{{description}}} +*/ +{{/description}} +export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} +{{#description}} + /** + * {{{description}}} + */ +{{/description}} + '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; +{{/vars}} + + {{#discriminator}} + static discriminator: string | undefined = "{{discriminatorName}}"; + {{/discriminator}} + {{^discriminator}} + static discriminator: string | undefined = undefined; + {{/discriminator}} + + {{^isArrayModel}} + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + {{#vars}} + { + "name": "{{name}}", + "baseName": "{{baseName}}", + "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}" + }{{#hasMore}}, + {{/hasMore}} + {{/vars}} + ]; + + static getAttributeTypeMap() { + {{#parent}} + return super.getAttributeTypeMap().concat({{classname}}.attributeTypeMap); + {{/parent}} + {{^parent}} + return {{classname}}.attributeTypeMap; + {{/parent}} + } + {{/isArrayModel}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} +{{/model}} +{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-node/models.mustache b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache new file mode 100644 index 000000000000..279340121611 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-node/models.mustache @@ -0,0 +1,210 @@ +{{#models}} +{{#model}} +export * from './{{{ classFilename }}}'; +{{/model}} +{{/models}} + +import localVarRequest = require('request'); + +{{#models}} +{{#model}} +import { {{classname}} } from './{{{ classFilename }}}'; +{{/model}} +{{/models}} + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { + {{#models}} + {{#model}} + {{#hasEnums}} + {{#vars}} + {{#isEnum}} + {{#isContainer}}"{{classname}}.{{enumName}}": {{classname}}.{{enumName}}{{/isContainer}}{{#isNotContainer}}"{{datatypeWithEnum}}": {{datatypeWithEnum}}{{/isNotContainer}}, + {{/isEnum}} + {{/vars}} + {{/hasEnums}} + {{/model}} + {{/models}} +} + +let typeMap: {[index: string]: any} = { + {{#models}} + {{#model}} + "{{classname}}": {{classname}}, + {{/model}} + {{/models}} +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-node/package.mustache b/modules/openapi-generator/src/main/resources/typescript-node/package.mustache index 74936a63284e..0bd3ae01df0b 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/package.mustache @@ -16,12 +16,13 @@ "bluebird": "^3.5.0", "request": "^2.81.0", "@types/bluebird": "*", - "@types/request": "*" + "@types/request": "*", + "rewire": "^3.0.2" }, "devDependencies": { "typescript": "^2.4.2" }{{#npmRepository}}, - "publishConfig":{ - "registry":"{{npmRepository}}" + "publishConfig": { + "registry": "{{npmRepository}}" }{{/npmRepository}} } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java index 9ae03f939919..75a18e87d9e4 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java @@ -33,6 +33,7 @@ public class TypeScriptNodeClientOptionsProvider implements OptionsProvider { public static final String NMP_NAME = "npmName"; public static final String NMP_VERSION = "1.1.2"; public static final String NPM_REPOSITORY = "https://registry.npmjs.org"; + public static final String API_SUFFIX = "Api"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; diff --git a/samples/client/petstore-security-test/typescript-node/.openapi-generator-ignore b/samples/client/petstore-security-test/typescript-node/.openapi-generator-ignore index c5fa491b4c55..7484ee590a38 100644 --- a/samples/client/petstore-security-test/typescript-node/.openapi-generator-ignore +++ b/samples/client/petstore-security-test/typescript-node/.openapi-generator-ignore @@ -1,11 +1,11 @@ -# Swagger Codegen Ignore -# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator # Use this file to prevent files from being overwritten by the generator. # The patterns follow closely to .gitignore or .dockerignore. # As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: #ApiClient.cs # You can match any string of characters against a directory, file or extension with a single asterisk (*): diff --git a/samples/client/petstore-security-test/typescript-node/.openapi-generator/VERSION b/samples/client/petstore-security-test/typescript-node/.openapi-generator/VERSION index f9f7450d1359..82602aa4190d 100644 --- a/samples/client/petstore-security-test/typescript-node/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/typescript-node/.openapi-generator/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +3.0.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-node/api.ts b/samples/client/petstore-security-test/typescript-node/api.ts index ed9c4082078e..4b76122d807b 100644 --- a/samples/client/petstore-security-test/typescript-node/api.ts +++ b/samples/client/petstore-security-test/typescript-node/api.ts @@ -1,321 +1,3 @@ -/** - * 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. - */ - -import localVarRequest = require('request'); -import http = require('http'); -import Promise = require('bluebird'); - -let defaultBasePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -class ObjectSerializer { - - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - return data[discriminatorProperty]; // use the type given in the discriminator - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return data.toString(); - } else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - } - - public static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap[type]) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - } -} - -/** -* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r -*/ -export class ModelReturn { - /** - * property description *_/ ' \" =end -- \\r\\n \\n \\r - */ - 'return': number; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "return", - "baseName": "return", - "type": "number" - } ]; - - static getAttributeTypeMap() { - return ModelReturn.attributeTypeMap; - } -} - - -let enumsMap: {[index: string]: any} = { -} - -let typeMap: {[index: string]: any} = { - "ModelReturn": ModelReturn, -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: localVarRequest.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string; - public password: string; - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - } -} - -export class VoidAuth implements Authentication { - public username: string; - public password: string; - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export enum FakeApiApiKeys { - api_key, -} - -export class FakeApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key */ ' " =end -- \r\n \n \r'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: FakeApiApiKeys, value: string) { - (this.authentications as any)[FakeApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * - * @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 - */ - public testCodeInjectEndRnNR (test code inject * ' " =end rn n r?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/fake'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - - let localVarUseFormData = false; - - if (test code inject * ' " =end rn n r !== undefined) { - localVarFormParams['test code inject */ ' " =end -- \r\n \n \r'] = ObjectSerializer.serialize(test code inject * ' " =end rn n r, "string"); - } - - let localVarRequestOptions: localVarRequest.Options = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-node/api/apis.ts b/samples/client/petstore-security-test/typescript-node/api/apis.ts new file mode 100644 index 000000000000..192d350dd3a2 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-node/api/apis.ts @@ -0,0 +1,3 @@ +export * from './fakeApi'; +import { FakeApi } from './fakeApi'; +export const APIS = [FakeApi]; diff --git a/samples/client/petstore-security-test/typescript-node/api/fakeApi.ts b/samples/client/petstore-security-test/typescript-node/api/fakeApi.ts new file mode 100644 index 000000000000..e40f35702d40 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-node/api/fakeApi.ts @@ -0,0 +1,119 @@ +/** + * OpenAPI 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: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum FakeApiApiKeys { +} + +export class FakeApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: FakeApiApiKeys, value: string) { + (this.authentications as any)[FakeApiApiKeys[key]].apiKey = value; + } + + /** + * + * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param UNKNOWN_BASE_TYPE + */ + public testCodeInjectEndRnNR (UNKNOWN_BASE_TYPE?: any) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/fake'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(UNKNOWN_BASE_TYPE, "any") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore-security-test/typescript-node/git_push.sh b/samples/client/petstore-security-test/typescript-node/git_push.sh index ae01b182ae9e..8442b80bb445 100644 --- a/samples/client/petstore-security-test/typescript-node/git_push.sh +++ b/samples/client/petstore-security-test/typescript-node/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" git_user_id=$1 git_repo_id=$2 diff --git a/samples/client/petstore-security-test/typescript-node/model/modelReturn.ts b/samples/client/petstore-security-test/typescript-node/model/modelReturn.ts new file mode 100644 index 000000000000..38c7c6ed1952 --- /dev/null +++ b/samples/client/petstore-security-test/typescript-node/model/modelReturn.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI 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: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r +*/ +export class ModelReturn { + /** + * property description *_/ ' \" =end -- \\r\\n \\n \\r + */ + '_return'?: number; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "_return", + "baseName": "return", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return ModelReturn.attributeTypeMap; + } +} + diff --git a/samples/client/petstore-security-test/typescript-node/model/models.ts b/samples/client/petstore-security-test/typescript-node/model/models.ts new file mode 100644 index 000000000000..37288a0f189f --- /dev/null +++ b/samples/client/petstore-security-test/typescript-node/model/models.ts @@ -0,0 +1,187 @@ +export * from './modelReturn'; + +import localVarRequest = require('request'); + +import { ModelReturn } from './modelReturn'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { +} + +let typeMap: {[index: string]: any} = { + "ModelReturn": ModelReturn, +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-node/default/.openapi-generator/VERSION index 096bf47efe31..82602aa4190d 100644 --- a/samples/client/petstore/typescript-node/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-node/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.0.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/default/api.js b/samples/client/petstore/typescript-node/default/api.js deleted file mode 100644 index 3860eec145e2..000000000000 --- a/samples/client/petstore/typescript-node/default/api.js +++ /dev/null @@ -1,1502 +0,0 @@ -/** - * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@wordnik.com - * - * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -"use strict"; -var request = require('request'); -var Promise = require('bluebird'); -var defaultBasePath = 'http://petstore.swagger.io/v2'; -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== -/* tslint:disable:no-unused-variable */ -var primitives = ["string", - "String", - "boolean", - "Boolean", - "Double", - "Integer", - "Long", - "Float", - "number", - "any"]; -var ObjectSerializer = (function () { - function ObjectSerializer() { - } - ObjectSerializer.serialize = function (data, type) { - if (data == null) { - return data; - } - else if (primitives.indexOf(type) !== -1) { - return data.toString(); // i hope the cast is done automatically - } - else if (type.lastIndexOf("Array<", 0) === 0) { - var subType = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - var transformedData = []; - for (var index in data) { - var date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); // TODO: fix - } - return transformedData; - } - else if (type === "Date") { - return data.toString(); - } - else { - if (!instanceFunctionsMap[type]) { - console.log("Couldn't parse type " + type); - return data; - } - var instance = instanceFunctionsMap[type](); - if (typeof instance.getAttributeTypeMap === "undefined") { - return instance[data]; - } - var attributeTypes = instance.getAttributeTypeMap(); - for (var index in attributeTypes) { - var attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - }; - ObjectSerializer.deserialize = function (data, type) { - if (data == null) { - return data; - } - else if (primitives.indexOf(type) !== -1) { - return data; // i hope the cast is done automatically - } - else if (type.lastIndexOf("Array<", 0) === 0) { - var subType = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - var transformedData = []; - for (var index in data) { - var date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); // TODO: fix - } - return transformedData; - } - else if (type === "Date") { - return new Date(data); - } - else { - if (!instanceFunctionsMap[type]) { - console.log("Couldn't parse type " + type); - return data; - } - var instance = instanceFunctionsMap[type](); - if (typeof instance.getAttributeTypeMap === "undefined") { - return instance[data]; - } - var attributeTypes = instance.getAttributeTypeMap(); - for (var index in attributeTypes) { - var attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - }; - return ObjectSerializer; -}()); -var instanceFunctionsMap = { - "Category": function () { return new Category(); }, - "Order.StatusEnum": function () { return Order.StatusEnum; }, - "Order": function () { return new Order(); }, - "Pet.StatusEnum": function () { return Pet.StatusEnum; }, - "Pet": function () { return new Pet(); }, - "Tag": function () { return new Tag(); }, - "User": function () { return new User(); }, -}; -var Category = (function () { - function Category() { - } - Category.prototype.getAttributeTypeMap = function () { - return Category.attributeTypeMap; - }; - Category.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - }]; - return Category; -}()); -exports.Category = Category; -var Order = (function () { - function Order() { - } - Order.prototype.getAttributeTypeMap = function () { - return Order.attributeTypeMap; - }; - Order.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "petId", - "baseName": "petId", - "type": "number" - }, - { - "name": "quantity", - "baseName": "quantity", - "type": "number" - }, - { - "name": "shipDate", - "baseName": "shipDate", - "type": "Date" - }, - { - "name": "status", - "baseName": "status", - "type": "Order.StatusEnum" - }, - { - "name": "complete", - "baseName": "complete", - "type": "boolean" - }]; - return Order; -}()); -exports.Order = Order; -var Order; -(function (Order) { - (function (StatusEnum) { - StatusEnum[StatusEnum["Placed"] = 'placed'] = "Placed"; - StatusEnum[StatusEnum["Approved"] = 'approved'] = "Approved"; - StatusEnum[StatusEnum["Delivered"] = 'delivered'] = "Delivered"; - })(Order.StatusEnum || (Order.StatusEnum = {})); - var StatusEnum = Order.StatusEnum; -})(Order = exports.Order || (exports.Order = {})); -var Pet = (function () { - function Pet() { - } - Pet.prototype.getAttributeTypeMap = function () { - return Pet.attributeTypeMap; - }; - Pet.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "category", - "baseName": "category", - "type": "Category" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - }, - { - "name": "photoUrls", - "baseName": "photoUrls", - "type": "Array" - }, - { - "name": "tags", - "baseName": "tags", - "type": "Array" - }, - { - "name": "status", - "baseName": "status", - "type": "Pet.StatusEnum" - }]; - return Pet; -}()); -exports.Pet = Pet; -var Pet; -(function (Pet) { - (function (StatusEnum) { - StatusEnum[StatusEnum["Available"] = 'available'] = "Available"; - StatusEnum[StatusEnum["Pending"] = 'pending'] = "Pending"; - StatusEnum[StatusEnum["Sold"] = 'sold'] = "Sold"; - })(Pet.StatusEnum || (Pet.StatusEnum = {})); - var StatusEnum = Pet.StatusEnum; -})(Pet = exports.Pet || (exports.Pet = {})); -var Tag = (function () { - function Tag() { - } - Tag.prototype.getAttributeTypeMap = function () { - return Tag.attributeTypeMap; - }; - Tag.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - }]; - return Tag; -}()); -exports.Tag = Tag; -var User = (function () { - function User() { - } - User.prototype.getAttributeTypeMap = function () { - return User.attributeTypeMap; - }; - User.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "username", - "baseName": "username", - "type": "string" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string" - }, - { - "name": "email", - "baseName": "email", - "type": "string" - }, - { - "name": "password", - "baseName": "password", - "type": "string" - }, - { - "name": "phone", - "baseName": "phone", - "type": "string" - }, - { - "name": "userStatus", - "baseName": "userStatus", - "type": "number" - }]; - return User; -}()); -exports.User = User; -var HttpBasicAuth = (function () { - function HttpBasicAuth() { - } - HttpBasicAuth.prototype.applyToRequest = function (requestOptions) { - requestOptions.auth = { - username: this.username, password: this.password - }; - }; - return HttpBasicAuth; -}()); -exports.HttpBasicAuth = HttpBasicAuth; -var ApiKeyAuth = (function () { - function ApiKeyAuth(location, paramName) { - this.location = location; - this.paramName = paramName; - } - ApiKeyAuth.prototype.applyToRequest = function (requestOptions) { - if (this.location == "query") { - requestOptions.qs[this.paramName] = this.apiKey; - } - else if (this.location == "header") { - requestOptions.headers[this.paramName] = this.apiKey; - } - }; - return ApiKeyAuth; -}()); -exports.ApiKeyAuth = ApiKeyAuth; -var OAuth = (function () { - function OAuth() { - } - OAuth.prototype.applyToRequest = function (requestOptions) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - }; - return OAuth; -}()); -exports.OAuth = OAuth; -var VoidAuth = (function () { - function VoidAuth() { - } - VoidAuth.prototype.applyToRequest = function (requestOptions) { - // Do nothing - }; - return VoidAuth; -}()); -exports.VoidAuth = VoidAuth; -(function (PetApiApiKeys) { - PetApiApiKeys[PetApiApiKeys["api_key"] = 0] = "api_key"; -})(exports.PetApiApiKeys || (exports.PetApiApiKeys = {})); -var PetApiApiKeys = exports.PetApiApiKeys; -var PetApi = (function () { - function PetApi(basePathOrUsername, password, basePath) { - this.basePath = defaultBasePath; - this.defaultHeaders = {}; - this._useQuerystring = false; - this.authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - }; - if (password) { - if (basePath) { - this.basePath = basePath; - } - } - else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - Object.defineProperty(PetApi.prototype, "useQuerystring", { - set: function (value) { - this._useQuerystring = value; - }, - enumerable: true, - configurable: true - }); - PetApi.prototype.setApiKey = function (key, value) { - this.authentications[PetApiApiKeys[key]].apiKey = value; - }; - Object.defineProperty(PetApi.prototype, "accessToken", { - set: function (token) { - this.authentications.petstore_auth.accessToken = token; - }, - enumerable: true, - configurable: true - }); - PetApi.prototype.extendObj = function (objA, objB) { - for (var key in objB) { - if (objB.hasOwnProperty(key)) { - objA[key] = objB[key]; - } - } - return objA; - }; - /** - * Add a new pet to the store - * - * @param body Pet object that needs to be added to the store - */ - PetApi.prototype.addPet = function (body) { - var localVarPath = this.basePath + '/pet'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "Pet") - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Deletes a pet - * - * @param petId Pet id to delete - * @param apiKey - */ - PetApi.prototype.deletePet = function (petId, apiKey) { - var localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling deletePet.'); - } - headerParams['api_key'] = ObjectSerializer.serialize(apiKey, "string"); - var useFormData = false; - var requestOptions = { - method: 'DELETE', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Finds Pets by status - * Multiple status values can be provided with comma separated strings - * @param status Status values that need to be considered for filter - */ - PetApi.prototype.findPetsByStatus = function (status) { - var localVarPath = this.basePath + '/pet/findByStatus'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - if (status !== undefined) { - queryParameters['status'] = ObjectSerializer.serialize(status, "Array<string>"); - } - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Finds Pets by tags - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @param tags Tags to filter by - */ - PetApi.prototype.findPetsByTags = function (tags) { - var localVarPath = this.basePath + '/pet/findByTags'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - if (tags !== undefined) { - queryParameters['tags'] = ObjectSerializer.serialize(tags, "Array<string>"); - } - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched - */ - PetApi.prototype.getPetById = function (petId) { - var localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling getPetById.'); - } - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.api_key.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Pet"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Update an existing pet - * - * @param body Pet object that needs to be added to the store - */ - PetApi.prototype.updatePet = function (body) { - var localVarPath = this.basePath + '/pet'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'PUT', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "Pet") - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * 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 - */ - PetApi.prototype.updatePetWithForm = function (petId, name, status) { - var localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', String(petId)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - var useFormData = false; - if (name !== undefined) { - formParams['name'] = ObjectSerializer.serialize(name, "string"); - } - if (status !== undefined) { - formParams['status'] = ObjectSerializer.serialize(status, "string"); - } - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * uploads an image - * - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - */ - PetApi.prototype.uploadFile = function (petId, additionalMetadata, file) { - var localVarPath = this.basePath + '/pet/{petId}/uploadImage' - .replace('{' + 'petId' + '}', String(petId)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); - } - var useFormData = false; - if (additionalMetadata !== undefined) { - formParams['additionalMetadata'] = ObjectSerializer.serialize(additionalMetadata, "string"); - } - if (file !== undefined) { - formParams['file'] = file; - } - useFormData = true; - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - return PetApi; -}()); -exports.PetApi = PetApi; -(function (StoreApiApiKeys) { - StoreApiApiKeys[StoreApiApiKeys["api_key"] = 0] = "api_key"; -})(exports.StoreApiApiKeys || (exports.StoreApiApiKeys = {})); -var StoreApiApiKeys = exports.StoreApiApiKeys; -var StoreApi = (function () { - function StoreApi(basePathOrUsername, password, basePath) { - this.basePath = defaultBasePath; - this.defaultHeaders = {}; - this._useQuerystring = false; - this.authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - }; - if (password) { - if (basePath) { - this.basePath = basePath; - } - } - else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - Object.defineProperty(StoreApi.prototype, "useQuerystring", { - set: function (value) { - this._useQuerystring = value; - }, - enumerable: true, - configurable: true - }); - StoreApi.prototype.setApiKey = function (key, value) { - this.authentications[StoreApiApiKeys[key]].apiKey = value; - }; - Object.defineProperty(StoreApi.prototype, "accessToken", { - set: function (token) { - this.authentications.petstore_auth.accessToken = token; - }, - enumerable: true, - configurable: true - }); - StoreApi.prototype.extendObj = function (objA, objB) { - for (var key in objB) { - if (objB.hasOwnProperty(key)) { - objA[key] = objB[key]; - } - } - return objA; - }; - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted - */ - StoreApi.prototype.deleteOrder = function (orderId) { - var localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', String(orderId)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); - } - var useFormData = false; - var requestOptions = { - method: 'DELETE', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - */ - StoreApi.prototype.getInventory = function () { - var localVarPath = this.basePath + '/store/inventory'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.api_key.applyToRequest(requestOptions); - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @param orderId ID of pet that needs to be fetched - */ - StoreApi.prototype.getOrderById = function (orderId) { - var localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', String(orderId)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); - } - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Place an order for a pet - * - * @param body order placed for purchasing the pet - */ - StoreApi.prototype.placeOrder = function (body) { - var localVarPath = this.basePath + '/store/order'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "Order") - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - return StoreApi; -}()); -exports.StoreApi = StoreApi; -(function (UserApiApiKeys) { - UserApiApiKeys[UserApiApiKeys["api_key"] = 0] = "api_key"; -})(exports.UserApiApiKeys || (exports.UserApiApiKeys = {})); -var UserApiApiKeys = exports.UserApiApiKeys; -var UserApi = (function () { - function UserApi(basePathOrUsername, password, basePath) { - this.basePath = defaultBasePath; - this.defaultHeaders = {}; - this._useQuerystring = false; - this.authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - }; - if (password) { - if (basePath) { - this.basePath = basePath; - } - } - else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - Object.defineProperty(UserApi.prototype, "useQuerystring", { - set: function (value) { - this._useQuerystring = value; - }, - enumerable: true, - configurable: true - }); - UserApi.prototype.setApiKey = function (key, value) { - this.authentications[UserApiApiKeys[key]].apiKey = value; - }; - Object.defineProperty(UserApi.prototype, "accessToken", { - set: function (token) { - this.authentications.petstore_auth.accessToken = token; - }, - enumerable: true, - configurable: true - }); - UserApi.prototype.extendObj = function (objA, objB) { - for (var key in objB) { - if (objB.hasOwnProperty(key)) { - objA[key] = objB[key]; - } - } - return objA; - }; - /** - * Create user - * This can only be done by the logged in user. - * @param body Created user object - */ - UserApi.prototype.createUser = function (body) { - var localVarPath = this.basePath + '/user'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "User") - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Creates list of users with given input array - * - * @param body List of user object - */ - UserApi.prototype.createUsersWithArrayInput = function (body) { - var localVarPath = this.basePath + '/user/createWithArray'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "Array<User>") - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Creates list of users with given input array - * - * @param body List of user object - */ - UserApi.prototype.createUsersWithListInput = function (body) { - var localVarPath = this.basePath + '/user/createWithList'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'POST', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "Array<User>") - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted - */ - UserApi.prototype.deleteUser = function (username) { - var localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', String(username)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling deleteUser.'); - } - var useFormData = false; - var requestOptions = { - method: 'DELETE', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. - */ - UserApi.prototype.getUserByName = function (username) { - var localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', String(username)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling getUserByName.'); - } - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "User"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Logs user into the system - * - * @param username The user name for login - * @param password The password for login in clear text - */ - UserApi.prototype.loginUser = function (username, password) { - var localVarPath = this.basePath + '/user/login'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - if (username !== undefined) { - queryParameters['username'] = ObjectSerializer.serialize(username, "string"); - } - if (password !== undefined) { - queryParameters['password'] = ObjectSerializer.serialize(password, "string"); - } - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "string"); - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Logs out current logged in user session - * - */ - UserApi.prototype.logoutUser = function () { - var localVarPath = this.basePath + '/user/logout'; - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - var useFormData = false; - var requestOptions = { - method: 'GET', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted - * @param body Updated user object - */ - UserApi.prototype.updateUser = function (username, body) { - var localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', String(username)); - var queryParameters = {}; - var headerParams = this.extendObj({}, this.defaultHeaders); - var formParams = {}; - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling updateUser.'); - } - var useFormData = false; - var requestOptions = { - method: 'PUT', - qs: queryParameters, - headers: headerParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(body, "User") - }; - this.authentications.default.applyToRequest(requestOptions); - if (Object.keys(formParams).length) { - if (useFormData) { - requestOptions.formData = formParams; - } - else { - requestOptions.form = formParams; - } - } - return new Promise(function (resolve, reject) { - request(requestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - return UserApi; -}()); -exports.UserApi = UserApi; diff --git a/samples/client/petstore/typescript-node/default/api.ts b/samples/client/petstore/typescript-node/default/api.ts index a6e6c97eb340..4b76122d807b 100644 --- a/samples/client/petstore/typescript-node/default/api.ts +++ b/samples/client/petstore/typescript-node/default/api.ts @@ -1,1740 +1,3 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import localVarRequest = require('request'); -import http = require('http'); -import Promise = require('bluebird'); - -let defaultBasePath = 'http://petstore.swagger.io/v2'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -class ObjectSerializer { - - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; - if(typeMap[discriminatorType]){ - return discriminatorType; // use the type given in the discriminator - } else { - return expectedType; // discriminator did not map to a type - } - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return data.toString(); - } else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - } - - public static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap[type]) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - } -} - -/** -* Describes the result of uploading an image resource -*/ -export class ApiResponse { - 'code'?: number; - 'type'?: string; - 'message'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "number" - }, - { - "name": "type", - "baseName": "type", - "type": "string" - }, - { - "name": "message", - "baseName": "message", - "type": "string" - } ]; - - static getAttributeTypeMap() { - return ApiResponse.attributeTypeMap; - } -} - -/** -* A category for a pet -*/ -export class Category { - 'id'?: number; - 'name'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - } ]; - - static getAttributeTypeMap() { - return Category.attributeTypeMap; - } -} - -/** -* An order for a pets from the pet store -*/ -export class Order { - 'id'?: number; - 'petId'?: number; - 'quantity'?: number; - 'shipDate'?: Date; - /** - * Order Status - */ - 'status'?: Order.StatusEnum; - 'complete'?: boolean; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "petId", - "baseName": "petId", - "type": "number" - }, - { - "name": "quantity", - "baseName": "quantity", - "type": "number" - }, - { - "name": "shipDate", - "baseName": "shipDate", - "type": "Date" - }, - { - "name": "status", - "baseName": "status", - "type": "Order.StatusEnum" - }, - { - "name": "complete", - "baseName": "complete", - "type": "boolean" - } ]; - - static getAttributeTypeMap() { - return Order.attributeTypeMap; - } -} - -export namespace Order { - export enum StatusEnum { - Placed = 'placed', - Approved = 'approved', - Delivered = 'delivered' - } -} -/** -* A pet for sale in the pet store -*/ -export class Pet { - 'id'?: number; - 'category'?: Category; - 'name': string; - 'photoUrls': Array; - 'tags'?: Array; - /** - * pet status in the store - */ - 'status'?: Pet.StatusEnum; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "category", - "baseName": "category", - "type": "Category" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - }, - { - "name": "photoUrls", - "baseName": "photoUrls", - "type": "Array" - }, - { - "name": "tags", - "baseName": "tags", - "type": "Array" - }, - { - "name": "status", - "baseName": "status", - "type": "Pet.StatusEnum" - } ]; - - static getAttributeTypeMap() { - return Pet.attributeTypeMap; - } -} - -export namespace Pet { - export enum StatusEnum { - Available = 'available', - Pending = 'pending', - Sold = 'sold' - } -} -/** -* A tag for a pet -*/ -export class Tag { - 'id'?: number; - 'name'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - } ]; - - static getAttributeTypeMap() { - return Tag.attributeTypeMap; - } -} - -/** -* A User who is purchasing from the pet store -*/ -export class User { - 'id'?: number; - 'username'?: string; - 'firstName'?: string; - 'lastName'?: string; - 'email'?: string; - 'password'?: string; - 'phone'?: string; - /** - * User Status - */ - 'userStatus'?: number; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "username", - "baseName": "username", - "type": "string" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string" - }, - { - "name": "email", - "baseName": "email", - "type": "string" - }, - { - "name": "password", - "baseName": "password", - "type": "string" - }, - { - "name": "phone", - "baseName": "phone", - "type": "string" - }, - { - "name": "userStatus", - "baseName": "userStatus", - "type": "number" - } ]; - - static getAttributeTypeMap() { - return User.attributeTypeMap; - } -} - - -let enumsMap: {[index: string]: any} = { - "Order.StatusEnum": Order.StatusEnum, - "Pet.StatusEnum": Pet.StatusEnum, -} - -let typeMap: {[index: string]: any} = { - "ApiResponse": ApiResponse, - "Category": Category, - "Order": Order, - "Pet": Pet, - "Tag": Tag, - "User": User, -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: localVarRequest.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string = ''; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - } -} - -export class VoidAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export enum PetApiApiKeys { - api_key, -} - -export class PetApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: PetApiApiKeys, value: string) { - (this.authentications as any)[PetApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * - * @summary Add a new pet to the store - * @param pet Pet object that needs to be added to the store - */ - public addPet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'pet' is not null or undefined - if (pet === null || pet === undefined) { - throw new Error('Required parameter pet was null or undefined when calling addPet.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(pet, "Pet") - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling deletePet.'); - } - - localVarHeaderParams['api_key'] = ObjectSerializer.serialize(apiKey, "string"); - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * 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 - */ - public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/pet/findByStatus'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); - } - - if (status !== undefined) { - localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * 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 - */ - public findPetsByTags (tags: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/pet/findByTags'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); - } - - if (tags !== undefined) { - localVarQueryParameters['tags'] = ObjectSerializer.serialize(tags, "Array"); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - public getPetById (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling getPetById.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.api_key.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Pet; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Pet"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Update an existing pet - * @param pet Pet object that needs to be added to the store - */ - public updatePet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'pet' is not null or undefined - if (pet === null || pet === undefined) { - throw new Error('Required parameter pet was null or undefined when calling updatePet.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(pet, "Pet") - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @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 - */ - public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - - - let localVarUseFormData = false; - - if (name !== undefined) { - localVarFormParams['name'] = ObjectSerializer.serialize(name, "string"); - } - - if (status !== undefined) { - localVarFormParams['status'] = ObjectSerializer.serialize(status, "string"); - } - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - */ - public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> { - const localVarPath = this.basePath + '/pet/{petId}/uploadImage' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); - } - - - let localVarUseFormData = false; - - if (additionalMetadata !== undefined) { - localVarFormParams['additionalMetadata'] = ObjectSerializer.serialize(additionalMetadata, "string"); - } - - if (file !== undefined) { - localVarFormParams['file'] = file; - } - localVarUseFormData = true; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: ApiResponse; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "ApiResponse"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum StoreApiApiKeys { - api_key, -} - -export class StoreApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: StoreApiApiKeys, value: string) { - (this.authentications as any)[StoreApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * 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 - */ - public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { - const localVarPath = this.basePath + '/store/inventory'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.api_key.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * 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 - */ - public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> { - const localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Place an order for a pet - * @param order order placed for purchasing the pet - */ - public placeOrder (order: Order) : Promise<{ response: http.ClientResponse; body: Order; }> { - const localVarPath = this.basePath + '/store/order'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'order' is not null or undefined - if (order === null || order === undefined) { - throw new Error('Required parameter order was null or undefined when calling placeOrder.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(order, "Order") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum UserApiApiKeys { - api_key, -} - -export class UserApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: UserApiApiKeys, value: string) { - (this.authentications as any)[UserApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * This can only be done by the logged in user. - * @summary Create user - * @param user Created user object - */ - public createUser (user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUser.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "User") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Creates list of users with given input array - * @param user List of user object - */ - public createUsersWithArrayInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/createWithArray'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "Array") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Creates list of users with given input array - * @param user List of user object - */ - public createUsersWithListInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/createWithList'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "Array") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * This can only be done by the logged in user. - * @summary Delete user - * @param username The name that needs to be deleted - */ - public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling deleteUser.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> { - const localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling getUserByName.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: User; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "User"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text - */ - public loginUser (username: string, password: string) : Promise<{ response: http.ClientResponse; body: string; }> { - const localVarPath = this.basePath + '/user/login'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('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 Error('Required parameter password was null or undefined when calling loginUser.'); - } - - if (username !== undefined) { - localVarQueryParameters['username'] = ObjectSerializer.serialize(username, "string"); - } - - if (password !== undefined) { - localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string"); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: string; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "string"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Logs out current logged in user session - */ - public logoutUser () : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/logout'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * This can only be done by the logged in user. - * @summary Updated user - * @param username name that need to be deleted - * @param user Updated user object - */ - public updateUser (username: string, user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling updateUser.'); - } - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling updateUser.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "User") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/default/api/apis.ts b/samples/client/petstore/typescript-node/default/api/apis.ts new file mode 100644 index 000000000000..2bbfc445eaf0 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/api/apis.ts @@ -0,0 +1,7 @@ +export * from './petApi'; +import { PetApi } from './petApi'; +export * from './storeApi'; +import { StoreApi } from './storeApi'; +export * from './userApi'; +import { UserApi } from './userApi'; +export const APIS = [PetApi, StoreApi, UserApi]; diff --git a/samples/client/petstore/typescript-node/default/api/petApi.ts b/samples/client/petstore/typescript-node/default/api/petApi.ts new file mode 100644 index 000000000000..c367b489d22b --- /dev/null +++ b/samples/client/petstore/typescript-node/default/api/petApi.ts @@ -0,0 +1,546 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ +import { ApiResponse } from '../model/apiResponse'; +import { Pet } from '../model/pet'; + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum PetApiApiKeys { + api_key, +} + +export class PetApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: PetApiApiKeys, value: string) { + (this.authentications as any)[PetApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + + /** + * + * @summary Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling addPet.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(pet, "Pet") + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); + } + + localVarHeaderParams['api_key'] = ObjectSerializer.serialize(apiKey, "string"); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * 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 + */ + public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/pet/findByStatus'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } + + if (status !== undefined) { + localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Array"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * 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 + */ + public findPetsByTags (tags: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/pet/findByTags'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } + + if (tags !== undefined) { + localVarQueryParameters['tags'] = ObjectSerializer.serialize(tags, "Array"); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Array"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * Returns a single pet + * @summary Find pet by ID + * @param petId ID of pet to return + */ + public getPetById (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.api_key.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Pet; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Pet"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling updatePet.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(pet, "Pet") + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @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 + */ + public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + + + let localVarUseFormData = false; + + if (name !== undefined) { + localVarFormParams['name'] = ObjectSerializer.serialize(name, "string"); + } + + if (status !== undefined) { + localVarFormParams['status'] = ObjectSerializer.serialize(status, "string"); + } + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); + } + + + let localVarUseFormData = false; + + if (additionalMetadata !== undefined) { + localVarFormParams['additionalMetadata'] = ObjectSerializer.serialize(additionalMetadata, "string"); + } + + if (file !== undefined) { + localVarFormParams['file'] = file; + } + localVarUseFormData = true; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: ApiResponse; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "ApiResponse"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore/typescript-node/default/api/storeApi.ts b/samples/client/petstore/typescript-node/default/api/storeApi.ts new file mode 100644 index 000000000000..39a1b21f2383 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/api/storeApi.ts @@ -0,0 +1,281 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ +import { Order } from '../model/order'; + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum StoreApiApiKeys { + api_key, +} + +export class StoreApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: StoreApiApiKeys, value: string) { + (this.authentications as any)[StoreApiApiKeys[key]].apiKey = value; + } + + /** + * 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 + */ + public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + */ + public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { + const localVarPath = this.basePath + '/store/inventory'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.api_key.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * 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 + */ + public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Order"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder (order: Order) : Promise<{ response: http.ClientResponse; body: Order; }> { + const localVarPath = this.basePath + '/store/order'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new Error('Required parameter order was null or undefined when calling placeOrder.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(order, "Order") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Order"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore/typescript-node/default/api/userApi.ts b/samples/client/petstore/typescript-node/default/api/userApi.ts new file mode 100644 index 000000000000..fbdb95cb4934 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/api/userApi.ts @@ -0,0 +1,504 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ +import { User } from '../model/user'; + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum UserApiApiKeys { +} + +export class UserApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: UserApiApiKeys, value: string) { + (this.authentications as any)[UserApiApiKeys[key]].apiKey = value; + } + + /** + * This can only be done by the logged in user. + * @summary Create user + * @param user Created user object + */ + public createUser (user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUser.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "User") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/createWithArray'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "Array") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/createWithList'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "Array") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param username The name that needs to be deleted + */ + public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: User; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "User"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (username: string, password: string) : Promise<{ response: http.ClientResponse; body: string; }> { + const localVarPath = this.basePath + '/user/login'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('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 Error('Required parameter password was null or undefined when calling loginUser.'); + } + + if (username !== undefined) { + localVarQueryParameters['username'] = ObjectSerializer.serialize(username, "string"); + } + + if (password !== undefined) { + localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string"); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: string; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "string"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Logs out current logged in user session + */ + public logoutUser () : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/logout'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser (username: string, user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); + } + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling updateUser.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "User") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore/typescript-node/default/model/apiResponse.ts b/samples/client/petstore/typescript-node/default/model/apiResponse.ts new file mode 100644 index 000000000000..5abc5ef23645 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/apiResponse.ts @@ -0,0 +1,45 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Describes the result of uploading an image resource +*/ +export class ApiResponse { + 'code'?: number; + 'type'?: string; + 'message'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "number" + }, + { + "name": "type", + "baseName": "type", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return ApiResponse.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/default/model/category.ts b/samples/client/petstore/typescript-node/default/model/category.ts new file mode 100644 index 000000000000..5a2f620f64c3 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/category.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* A category for a pet +*/ +export class Category { + 'id'?: number; + 'name'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Category.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/default/model/models.ts b/samples/client/petstore/typescript-node/default/model/models.ts new file mode 100644 index 000000000000..8ed47b194d73 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/models.ts @@ -0,0 +1,204 @@ +export * from './apiResponse'; +export * from './category'; +export * from './order'; +export * from './pet'; +export * from './tag'; +export * from './user'; + +import localVarRequest = require('request'); + +import { ApiResponse } from './apiResponse'; +import { Category } from './category'; +import { Order } from './order'; +import { Pet } from './pet'; +import { Tag } from './tag'; +import { User } from './user'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { + "Order.StatusEnum": Order.StatusEnum, + "Pet.StatusEnum": Pet.StatusEnum, +} + +let typeMap: {[index: string]: any} = { + "ApiResponse": ApiResponse, + "Category": Category, + "Order": Order, + "Pet": Pet, + "Tag": Tag, + "User": User, +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/default/model/order.ts b/samples/client/petstore/typescript-node/default/model/order.ts new file mode 100644 index 000000000000..8670f6aef573 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/order.ts @@ -0,0 +1,73 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* An order for a pets from the pet store +*/ +export class Order { + 'id'?: number; + 'petId'?: number; + 'quantity'?: number; + 'shipDate'?: Date; + /** + * Order Status + */ + 'status'?: Order.StatusEnum; + 'complete'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "petId", + "baseName": "petId", + "type": "number" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number" + }, + { + "name": "shipDate", + "baseName": "shipDate", + "type": "Date" + }, + { + "name": "status", + "baseName": "status", + "type": "Order.StatusEnum" + }, + { + "name": "complete", + "baseName": "complete", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return Order.attributeTypeMap; + } +} + +export namespace Order { + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} diff --git a/samples/client/petstore/typescript-node/default/model/pet.ts b/samples/client/petstore/typescript-node/default/model/pet.ts new file mode 100644 index 000000000000..a91c4252fe34 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/pet.ts @@ -0,0 +1,75 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Category } from './category'; +import { Tag } from './tag'; + +/** +* A pet for sale in the pet store +*/ +export class Pet { + 'id'?: number; + 'category'?: Category; + 'name': string; + 'photoUrls': Array; + 'tags'?: Array; + /** + * pet status in the store + */ + 'status'?: Pet.StatusEnum; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "category", + "baseName": "category", + "type": "Category" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "photoUrls", + "baseName": "photoUrls", + "type": "Array" + }, + { + "name": "tags", + "baseName": "tags", + "type": "Array" + }, + { + "name": "status", + "baseName": "status", + "type": "Pet.StatusEnum" + } ]; + + static getAttributeTypeMap() { + return Pet.attributeTypeMap; + } +} + +export namespace Pet { + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} diff --git a/samples/client/petstore/typescript-node/default/model/tag.ts b/samples/client/petstore/typescript-node/default/model/tag.ts new file mode 100644 index 000000000000..26d1dc741c57 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/tag.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* A tag for a pet +*/ +export class Tag { + 'id'?: number; + 'name'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Tag.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/default/model/user.ts b/samples/client/petstore/typescript-node/default/model/user.ts new file mode 100644 index 000000000000..b683fb5debc5 --- /dev/null +++ b/samples/client/petstore/typescript-node/default/model/user.ts @@ -0,0 +1,78 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* A User who is purchasing from the pet store +*/ +export class User { + 'id'?: number; + 'username'?: string; + 'firstName'?: string; + 'lastName'?: string; + 'email'?: string; + 'password'?: string; + 'phone'?: string; + /** + * User Status + */ + 'userStatus'?: number; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "username", + "baseName": "username", + "type": "string" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string" + }, + { + "name": "email", + "baseName": "email", + "type": "string" + }, + { + "name": "password", + "baseName": "password", + "type": "string" + }, + { + "name": "phone", + "baseName": "phone", + "type": "string" + }, + { + "name": "userStatus", + "baseName": "userStatus", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return User.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/npm/.openapi-generator/VERSION b/samples/client/petstore/typescript-node/npm/.openapi-generator/VERSION index 096bf47efe31..82602aa4190d 100644 --- a/samples/client/petstore/typescript-node/npm/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-node/npm/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.0.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api.d.ts b/samples/client/petstore/typescript-node/npm/api.d.ts deleted file mode 100644 index 31795b1aa51e..000000000000 --- a/samples/client/petstore/typescript-node/npm/api.d.ts +++ /dev/null @@ -1,288 +0,0 @@ -/// -/// -/// -import localVarRequest = require('request'); -import http = require('http'); -import Promise = require('bluebird'); -export declare class ApiResponse { - 'code'?: number; - 'type'?: string; - 'message'?: string; - static discriminator: undefined; - static attributeTypeMap: Array<{ - name: string; - baseName: string; - type: string; - }>; - static getAttributeTypeMap(): { - name: string; - baseName: string; - type: string; - }[]; -} -export declare class Category { - 'id'?: number; - 'name'?: string; - static discriminator: undefined; - static attributeTypeMap: Array<{ - name: string; - baseName: string; - type: string; - }>; - static getAttributeTypeMap(): { - name: string; - baseName: string; - type: string; - }[]; -} -export declare class Order { - 'id'?: number; - 'petId'?: number; - 'quantity'?: number; - 'shipDate'?: Date; - 'status'?: Order.StatusEnum; - 'complete'?: boolean; - static discriminator: undefined; - static attributeTypeMap: Array<{ - name: string; - baseName: string; - type: string; - }>; - static getAttributeTypeMap(): { - name: string; - baseName: string; - type: string; - }[]; -} -export declare namespace Order { - enum StatusEnum { - Placed, - Approved, - Delivered, - } -} -export declare class Pet { - 'id'?: number; - 'category'?: Category; - 'name': string; - 'photoUrls': Array; - 'tags'?: Array; - 'status'?: Pet.StatusEnum; - static discriminator: undefined; - static attributeTypeMap: Array<{ - name: string; - baseName: string; - type: string; - }>; - static getAttributeTypeMap(): { - name: string; - baseName: string; - type: string; - }[]; -} -export declare namespace Pet { - enum StatusEnum { - Available, - Pending, - Sold, - } -} -export declare class Tag { - 'id'?: number; - 'name'?: string; - static discriminator: undefined; - static attributeTypeMap: Array<{ - name: string; - baseName: string; - type: string; - }>; - static getAttributeTypeMap(): { - name: string; - baseName: string; - type: string; - }[]; -} -export declare class User { - 'id'?: number; - 'username'?: string; - 'firstName'?: string; - 'lastName'?: string; - 'email'?: string; - 'password'?: string; - 'phone'?: string; - 'userStatus'?: number; - static discriminator: undefined; - static attributeTypeMap: Array<{ - name: string; - baseName: string; - type: string; - }>; - static getAttributeTypeMap(): { - name: string; - baseName: string; - type: string; - }[]; -} -export interface Authentication { - applyToRequest(requestOptions: localVarRequest.Options): void; -} -export declare class HttpBasicAuth implements Authentication { - username: string; - password: string; - applyToRequest(requestOptions: localVarRequest.Options): void; -} -export declare class ApiKeyAuth implements Authentication { - private location; - private paramName; - apiKey: string; - constructor(location: string, paramName: string); - applyToRequest(requestOptions: localVarRequest.Options): void; -} -export declare class OAuth implements Authentication { - accessToken: string; - applyToRequest(requestOptions: localVarRequest.Options): void; -} -export declare class VoidAuth implements Authentication { - username: string; - password: string; - applyToRequest(_: localVarRequest.Options): void; -} -export declare enum PetApiApiKeys { - api_key = 0, -} -export declare class PetApi { - protected _basePath: string; - protected defaultHeaders: any; - protected _useQuerystring: boolean; - protected authentications: { - 'default': Authentication; - 'api_key': ApiKeyAuth; - 'petstore_auth': OAuth; - }; - constructor(basePath?: string); - useQuerystring: boolean; - basePath: string; - setDefaultAuthentication(auth: Authentication): void; - setApiKey(key: PetApiApiKeys, value: string): void; - accessToken: string; - addPet(pet: Pet): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - deletePet(petId: number, apiKey?: string): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>): Promise<{ - response: http.ClientResponse; - body: Array; - }>; - findPetsByTags(tags: Array): Promise<{ - response: http.ClientResponse; - body: Array; - }>; - getPetById(petId: number): Promise<{ - response: http.ClientResponse; - body: Pet; - }>; - updatePet(pet: Pet): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - updatePetWithForm(petId: number, name?: string, status?: string): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - uploadFile(petId: number, additionalMetadata?: string, file?: Buffer): Promise<{ - response: http.ClientResponse; - body: ApiResponse; - }>; -} -export declare enum StoreApiApiKeys { - api_key = 0, -} -export declare class StoreApi { - protected _basePath: string; - protected defaultHeaders: any; - protected _useQuerystring: boolean; - protected authentications: { - 'default': Authentication; - 'api_key': ApiKeyAuth; - 'petstore_auth': OAuth; - }; - constructor(basePath?: string); - useQuerystring: boolean; - basePath: string; - setDefaultAuthentication(auth: Authentication): void; - setApiKey(key: StoreApiApiKeys, value: string): void; - accessToken: string; - deleteOrder(orderId: string): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - getInventory(): Promise<{ - response: http.ClientResponse; - body: { - [key: string]: number; - }; - }>; - getOrderById(orderId: number): Promise<{ - response: http.ClientResponse; - body: Order; - }>; - placeOrder(order: Order): Promise<{ - response: http.ClientResponse; - body: Order; - }>; -} -export declare enum UserApiApiKeys { - api_key = 0, -} -export declare class UserApi { - protected _basePath: string; - protected defaultHeaders: any; - protected _useQuerystring: boolean; - protected authentications: { - 'default': Authentication; - 'api_key': ApiKeyAuth; - 'petstore_auth': OAuth; - }; - constructor(basePath?: string); - useQuerystring: boolean; - basePath: string; - setDefaultAuthentication(auth: Authentication): void; - setApiKey(key: UserApiApiKeys, value: string): void; - accessToken: string; - createUser(user: User): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - createUsersWithArrayInput(user: Array): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - createUsersWithListInput(user: Array): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - deleteUser(username: string): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - getUserByName(username: string): Promise<{ - response: http.ClientResponse; - body: User; - }>; - loginUser(username: string, password: string): Promise<{ - response: http.ClientResponse; - body: string; - }>; - logoutUser(): Promise<{ - response: http.ClientResponse; - body?: any; - }>; - updateUser(username: string, user: User): Promise<{ - response: http.ClientResponse; - body?: any; - }>; -} diff --git a/samples/client/petstore/typescript-node/npm/api.js b/samples/client/petstore/typescript-node/npm/api.js deleted file mode 100644 index dc93dcc090ea..000000000000 --- a/samples/client/petstore/typescript-node/npm/api.js +++ /dev/null @@ -1,1488 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var localVarRequest = require("request"); -var Promise = require("bluebird"); -var defaultBasePath = 'http://petstore.swagger.io/v2'; -var primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" -]; -var ObjectSerializer = (function () { - function ObjectSerializer() { - } - ObjectSerializer.findCorrectType = function (data, expectedType) { - if (data == undefined) { - return expectedType; - } - else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } - else if (expectedType === "Date") { - return expectedType; - } - else { - if (enumsMap[expectedType]) { - return expectedType; - } - if (!typeMap[expectedType]) { - return expectedType; - } - var discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; - } - else { - if (data[discriminatorProperty]) { - return data[discriminatorProperty]; - } - else { - return expectedType; - } - } - } - }; - ObjectSerializer.serialize = function (data, type) { - if (data == undefined) { - return data; - } - else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - else if (type.lastIndexOf("Array<", 0) === 0) { - var subType = type.replace("Array<", ""); - subType = subType.substring(0, subType.length - 1); - var transformedData = []; - for (var index in data) { - var date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); - } - return transformedData; - } - else if (type === "Date") { - return data.toString(); - } - else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - return data; - } - var attributeTypes = typeMap[type].getAttributeTypeMap(); - var instance = {}; - for (var index in attributeTypes) { - var attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - }; - ObjectSerializer.deserialize = function (data, type) { - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } - else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } - else if (type.lastIndexOf("Array<", 0) === 0) { - var subType = type.replace("Array<", ""); - subType = subType.substring(0, subType.length - 1); - var transformedData = []; - for (var index in data) { - var date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); - } - return transformedData; - } - else if (type === "Date") { - return new Date(data); - } - else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { - return data; - } - var instance = new typeMap[type](); - var attributeTypes = typeMap[type].getAttributeTypeMap(); - for (var index in attributeTypes) { - var attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - }; - return ObjectSerializer; -}()); -var ApiResponse = (function () { - function ApiResponse() { - } - ApiResponse.getAttributeTypeMap = function () { - return ApiResponse.attributeTypeMap; - }; - ApiResponse.discriminator = undefined; - ApiResponse.attributeTypeMap = [ - { - "name": "code", - "baseName": "code", - "type": "number" - }, - { - "name": "type", - "baseName": "type", - "type": "string" - }, - { - "name": "message", - "baseName": "message", - "type": "string" - } - ]; - return ApiResponse; -}()); -exports.ApiResponse = ApiResponse; -var Category = (function () { - function Category() { - } - Category.getAttributeTypeMap = function () { - return Category.attributeTypeMap; - }; - Category.discriminator = undefined; - Category.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - } - ]; - return Category; -}()); -exports.Category = Category; -var Order = (function () { - function Order() { - } - Order.getAttributeTypeMap = function () { - return Order.attributeTypeMap; - }; - Order.discriminator = undefined; - Order.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "petId", - "baseName": "petId", - "type": "number" - }, - { - "name": "quantity", - "baseName": "quantity", - "type": "number" - }, - { - "name": "shipDate", - "baseName": "shipDate", - "type": "Date" - }, - { - "name": "status", - "baseName": "status", - "type": "Order.StatusEnum" - }, - { - "name": "complete", - "baseName": "complete", - "type": "boolean" - } - ]; - return Order; -}()); -exports.Order = Order; -(function (Order) { - var StatusEnum; - (function (StatusEnum) { - StatusEnum[StatusEnum["Placed"] = 'placed'] = "Placed"; - StatusEnum[StatusEnum["Approved"] = 'approved'] = "Approved"; - StatusEnum[StatusEnum["Delivered"] = 'delivered'] = "Delivered"; - })(StatusEnum = Order.StatusEnum || (Order.StatusEnum = {})); -})(Order = exports.Order || (exports.Order = {})); -exports.Order = Order; -var Pet = (function () { - function Pet() { - } - Pet.getAttributeTypeMap = function () { - return Pet.attributeTypeMap; - }; - Pet.discriminator = undefined; - Pet.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "category", - "baseName": "category", - "type": "Category" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - }, - { - "name": "photoUrls", - "baseName": "photoUrls", - "type": "Array" - }, - { - "name": "tags", - "baseName": "tags", - "type": "Array" - }, - { - "name": "status", - "baseName": "status", - "type": "Pet.StatusEnum" - } - ]; - return Pet; -}()); -exports.Pet = Pet; -(function (Pet) { - var StatusEnum; - (function (StatusEnum) { - StatusEnum[StatusEnum["Available"] = 'available'] = "Available"; - StatusEnum[StatusEnum["Pending"] = 'pending'] = "Pending"; - StatusEnum[StatusEnum["Sold"] = 'sold'] = "Sold"; - })(StatusEnum = Pet.StatusEnum || (Pet.StatusEnum = {})); -})(Pet = exports.Pet || (exports.Pet = {})); -exports.Pet = Pet; -var Tag = (function () { - function Tag() { - } - Tag.getAttributeTypeMap = function () { - return Tag.attributeTypeMap; - }; - Tag.discriminator = undefined; - Tag.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - } - ]; - return Tag; -}()); -exports.Tag = Tag; -var User = (function () { - function User() { - } - User.getAttributeTypeMap = function () { - return User.attributeTypeMap; - }; - User.discriminator = undefined; - User.attributeTypeMap = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "username", - "baseName": "username", - "type": "string" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string" - }, - { - "name": "email", - "baseName": "email", - "type": "string" - }, - { - "name": "password", - "baseName": "password", - "type": "string" - }, - { - "name": "phone", - "baseName": "phone", - "type": "string" - }, - { - "name": "userStatus", - "baseName": "userStatus", - "type": "number" - } - ]; - return User; -}()); -exports.User = User; -var enumsMap = { - "Order.StatusEnum": Order.StatusEnum, - "Pet.StatusEnum": Pet.StatusEnum, -}; -var typeMap = { - "ApiResponse": ApiResponse, - "Category": Category, - "Order": Order, - "Pet": Pet, - "Tag": Tag, - "User": User, -}; -var HttpBasicAuth = (function () { - function HttpBasicAuth() { - this.username = ''; - this.password = ''; - } - HttpBasicAuth.prototype.applyToRequest = function (requestOptions) { - requestOptions.auth = { - username: this.username, password: this.password - }; - }; - return HttpBasicAuth; -}()); -exports.HttpBasicAuth = HttpBasicAuth; -var ApiKeyAuth = (function () { - function ApiKeyAuth(location, paramName) { - this.location = location; - this.paramName = paramName; - this.apiKey = ''; - } - ApiKeyAuth.prototype.applyToRequest = function (requestOptions) { - if (this.location == "query") { - requestOptions.qs[this.paramName] = this.apiKey; - } - else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } - }; - return ApiKeyAuth; -}()); -exports.ApiKeyAuth = ApiKeyAuth; -var OAuth = (function () { - function OAuth() { - this.accessToken = ''; - } - OAuth.prototype.applyToRequest = function (requestOptions) { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - }; - return OAuth; -}()); -exports.OAuth = OAuth; -var VoidAuth = (function () { - function VoidAuth() { - this.username = ''; - this.password = ''; - } - VoidAuth.prototype.applyToRequest = function (_) { - }; - return VoidAuth; -}()); -exports.VoidAuth = VoidAuth; -var PetApiApiKeys; -(function (PetApiApiKeys) { - PetApiApiKeys[PetApiApiKeys["api_key"] = 0] = "api_key"; -})(PetApiApiKeys = exports.PetApiApiKeys || (exports.PetApiApiKeys = {})); -var PetApi = (function () { - function PetApi(basePathOrUsername, password, basePath) { - this._basePath = defaultBasePath; - this.defaultHeaders = {}; - this._useQuerystring = false; - this.authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - }; - if (password) { - if (basePath) { - this.basePath = basePath; - } - } - else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - Object.defineProperty(PetApi.prototype, "useQuerystring", { - set: function (value) { - this._useQuerystring = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(PetApi.prototype, "basePath", { - get: function () { - return this._basePath; - }, - set: function (basePath) { - this._basePath = basePath; - }, - enumerable: true, - configurable: true - }); - PetApi.prototype.setDefaultAuthentication = function (auth) { - this.authentications.default = auth; - }; - PetApi.prototype.setApiKey = function (key, value) { - this.authentications[PetApiApiKeys[key]].apiKey = value; - }; - Object.defineProperty(PetApi.prototype, "accessToken", { - set: function (token) { - this.authentications.petstore_auth.accessToken = token; - }, - enumerable: true, - configurable: true - }); - PetApi.prototype.addPet = function (pet) { - var localVarPath = this.basePath + '/pet'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (pet === null || pet === undefined) { - throw new Error('Required parameter pet was null or undefined when calling addPet.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(pet, "Pet") - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.deletePet = function (petId, apiKey) { - var localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling deletePet.'); - } - localVarHeaderParams['api_key'] = ObjectSerializer.serialize(apiKey, "string"); - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.findPetsByStatus = function (status) { - var localVarPath = this.basePath + '/pet/findByStatus'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (status === null || status === undefined) { - throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); - } - if (status !== undefined) { - localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.findPetsByTags = function (tags) { - var localVarPath = this.basePath + '/pet/findByTags'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (tags === null || tags === undefined) { - throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); - } - if (tags !== undefined) { - localVarQueryParameters['tags'] = ObjectSerializer.serialize(tags, "Array"); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.getPetById = function (petId) { - var localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling getPetById.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.api_key.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Pet"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.updatePet = function (pet) { - var localVarPath = this.basePath + '/pet'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (pet === null || pet === undefined) { - throw new Error('Required parameter pet was null or undefined when calling updatePet.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(pet, "Pet") - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.updatePetWithForm = function (petId, name, status) { - var localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - var localVarUseFormData = false; - if (name !== undefined) { - localVarFormParams['name'] = ObjectSerializer.serialize(name, "string"); - } - if (status !== undefined) { - localVarFormParams['status'] = ObjectSerializer.serialize(status, "string"); - } - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - PetApi.prototype.uploadFile = function (petId, additionalMetadata, file) { - var localVarPath = this.basePath + '/pet/{petId}/uploadImage' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); - } - var localVarUseFormData = false; - if (additionalMetadata !== undefined) { - localVarFormParams['additionalMetadata'] = ObjectSerializer.serialize(additionalMetadata, "string"); - } - if (file !== undefined) { - localVarFormParams['file'] = file; - } - localVarUseFormData = true; - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "ApiResponse"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - return PetApi; -}()); -exports.PetApi = PetApi; -var StoreApiApiKeys; -(function (StoreApiApiKeys) { - StoreApiApiKeys[StoreApiApiKeys["api_key"] = 0] = "api_key"; -})(StoreApiApiKeys = exports.StoreApiApiKeys || (exports.StoreApiApiKeys = {})); -var StoreApi = (function () { - function StoreApi(basePathOrUsername, password, basePath) { - this._basePath = defaultBasePath; - this.defaultHeaders = {}; - this._useQuerystring = false; - this.authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - }; - if (password) { - if (basePath) { - this.basePath = basePath; - } - } - else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - Object.defineProperty(StoreApi.prototype, "useQuerystring", { - set: function (value) { - this._useQuerystring = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(StoreApi.prototype, "basePath", { - get: function () { - return this._basePath; - }, - set: function (basePath) { - this._basePath = basePath; - }, - enumerable: true, - configurable: true - }); - StoreApi.prototype.setDefaultAuthentication = function (auth) { - this.authentications.default = auth; - }; - StoreApi.prototype.setApiKey = function (key, value) { - this.authentications[StoreApiApiKeys[key]].apiKey = value; - }; - Object.defineProperty(StoreApi.prototype, "accessToken", { - set: function (token) { - this.authentications.petstore_auth.accessToken = token; - }, - enumerable: true, - configurable: true - }); - StoreApi.prototype.deleteOrder = function (orderId) { - var localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - StoreApi.prototype.getInventory = function () { - var localVarPath = this.basePath + '/store/inventory'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.api_key.applyToRequest(localVarRequestOptions); - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - StoreApi.prototype.getOrderById = function (orderId) { - var localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - StoreApi.prototype.placeOrder = function (order) { - var localVarPath = this.basePath + '/store/order'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (order === null || order === undefined) { - throw new Error('Required parameter order was null or undefined when calling placeOrder.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(order, "Order") - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - return StoreApi; -}()); -exports.StoreApi = StoreApi; -var UserApiApiKeys; -(function (UserApiApiKeys) { - UserApiApiKeys[UserApiApiKeys["api_key"] = 0] = "api_key"; -})(UserApiApiKeys = exports.UserApiApiKeys || (exports.UserApiApiKeys = {})); -var UserApi = (function () { - function UserApi(basePathOrUsername, password, basePath) { - this._basePath = defaultBasePath; - this.defaultHeaders = {}; - this._useQuerystring = false; - this.authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - }; - if (password) { - if (basePath) { - this.basePath = basePath; - } - } - else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - Object.defineProperty(UserApi.prototype, "useQuerystring", { - set: function (value) { - this._useQuerystring = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(UserApi.prototype, "basePath", { - get: function () { - return this._basePath; - }, - set: function (basePath) { - this._basePath = basePath; - }, - enumerable: true, - configurable: true - }); - UserApi.prototype.setDefaultAuthentication = function (auth) { - this.authentications.default = auth; - }; - UserApi.prototype.setApiKey = function (key, value) { - this.authentications[UserApiApiKeys[key]].apiKey = value; - }; - Object.defineProperty(UserApi.prototype, "accessToken", { - set: function (token) { - this.authentications.petstore_auth.accessToken = token; - }, - enumerable: true, - configurable: true - }); - UserApi.prototype.createUser = function (user) { - var localVarPath = this.basePath + '/user'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUser.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "User") - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.createUsersWithArrayInput = function (user) { - var localVarPath = this.basePath + '/user/createWithArray'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "Array") - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.createUsersWithListInput = function (user) { - var localVarPath = this.basePath + '/user/createWithList'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "Array") - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.deleteUser = function (username) { - var localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling deleteUser.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.getUserByName = function (username) { - var localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling getUserByName.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "User"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.loginUser = function (username, password) { - var localVarPath = this.basePath + '/user/login'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling loginUser.'); - } - if (password === null || password === undefined) { - throw new Error('Required parameter password was null or undefined when calling loginUser.'); - } - if (username !== undefined) { - localVarQueryParameters['username'] = ObjectSerializer.serialize(username, "string"); - } - if (password !== undefined) { - localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string"); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - body = ObjectSerializer.deserialize(body, "string"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.logoutUser = function () { - var localVarPath = this.basePath + '/user/logout'; - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - UserApi.prototype.updateUser = function (username, user) { - var localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - var localVarQueryParameters = {}; - var localVarHeaderParams = Object.assign({}, this.defaultHeaders); - var localVarFormParams = {}; - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling updateUser.'); - } - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling updateUser.'); - } - var localVarUseFormData = false; - var localVarRequestOptions = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "User") - }; - this.authentications.default.applyToRequest(localVarRequestOptions); - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - localVarRequestOptions.formData = localVarFormParams; - } - else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise(function (resolve, reject) { - localVarRequest(localVarRequestOptions, function (error, response, body) { - if (error) { - reject(error); - } - else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } - else { - reject({ response: response, body: body }); - } - } - }); - }); - }; - return UserApi; -}()); -exports.UserApi = UserApi; -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api.js.map b/samples/client/petstore/typescript-node/npm/api.js.map deleted file mode 100644 index a6ed6bbada30..000000000000 --- a/samples/client/petstore/typescript-node/npm/api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api.js","sourceRoot":"","sources":["api.ts"],"names":[],"mappings":";;AAYA,yCAA4C;AAE5C,kCAAqC;AAErC,IAAI,eAAe,GAAG,+BAA+B,CAAC;AAOtD,IAAI,UAAU,GAAG;IACG,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;C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M;gBACH,sBAAsB,CAAC,IAAI,GAAG,kBAAkB,CAAC;aACpD;SACJ;QACD,OAAO,IAAI,OAAO,CAAkD,UAAC,OAAO,EAAE,MAAM;YAChF,eAAe,CAAC,sBAAsB,EAAE,UAAC,KAAK,EAAE,QAAQ,EAAE,IAAI;gBAC1D,IAAI,KAAK,EAAE;oBACP,MAAM,CAAC,KAAK,CAAC,CAAC;iBACjB;qBAAM;oBACH,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;wBACjF,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC/C;yBAAM;wBACH,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC9C;iBACJ;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACL,cAAC;AAAD,CAAC,AA9dD,IA8dC;AA9dY,0BAAO"} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api.ts b/samples/client/petstore/typescript-node/npm/api.ts index 13b8db92be6f..4b76122d807b 100644 --- a/samples/client/petstore/typescript-node/npm/api.ts +++ b/samples/client/petstore/typescript-node/npm/api.ts @@ -1,1732 +1,3 @@ -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * OpenAPI spec version: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import localVarRequest = require('request'); -import http = require('http'); -import Promise = require('bluebird'); - -let defaultBasePath = 'http://petstore.swagger.io/v2'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -class ObjectSerializer { - - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - return data[discriminatorProperty]; // use the type given in the discriminator - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.serialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return data.toString(); - } else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - } - - public static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index in data) { - let date = data[index]; - transformedData.push(ObjectSerializer.deserialize(date, subType)); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap[type]) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index in attributeTypes) { - let attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - } -} - -/** -* Describes the result of uploading an image resource -*/ -export class ApiResponse { - 'code'?: number; - 'type'?: string; - 'message'?: string; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "code", - "baseName": "code", - "type": "number" - }, - { - "name": "type", - "baseName": "type", - "type": "string" - }, - { - "name": "message", - "baseName": "message", - "type": "string" - } ]; - - static getAttributeTypeMap() { - return ApiResponse.attributeTypeMap; - } -} - -/** -* A category for a pet -*/ -export class Category { - 'id'?: number; - 'name'?: string; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - } ]; - - static getAttributeTypeMap() { - return Category.attributeTypeMap; - } -} - -/** -* An order for a pets from the pet store -*/ -export class Order { - 'id'?: number; - 'petId'?: number; - 'quantity'?: number; - 'shipDate'?: Date; - /** - * Order Status - */ - 'status'?: Order.StatusEnum; - 'complete'?: boolean; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "petId", - "baseName": "petId", - "type": "number" - }, - { - "name": "quantity", - "baseName": "quantity", - "type": "number" - }, - { - "name": "shipDate", - "baseName": "shipDate", - "type": "Date" - }, - { - "name": "status", - "baseName": "status", - "type": "Order.StatusEnum" - }, - { - "name": "complete", - "baseName": "complete", - "type": "boolean" - } ]; - - static getAttributeTypeMap() { - return Order.attributeTypeMap; - } -} - -export namespace Order { - export enum StatusEnum { - Placed = 'placed', - Approved = 'approved', - Delivered = 'delivered' - } -} -/** -* A pet for sale in the pet store -*/ -export class Pet { - 'id'?: number; - 'category'?: Category; - 'name': string; - 'photoUrls': Array; - 'tags'?: Array; - /** - * pet status in the store - */ - 'status'?: Pet.StatusEnum; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "category", - "baseName": "category", - "type": "Category" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - }, - { - "name": "photoUrls", - "baseName": "photoUrls", - "type": "Array" - }, - { - "name": "tags", - "baseName": "tags", - "type": "Array" - }, - { - "name": "status", - "baseName": "status", - "type": "Pet.StatusEnum" - } ]; - - static getAttributeTypeMap() { - return Pet.attributeTypeMap; - } -} - -export namespace Pet { - export enum StatusEnum { - Available = 'available', - Pending = 'pending', - Sold = 'sold' - } -} -/** -* A tag for a pet -*/ -export class Tag { - 'id'?: number; - 'name'?: string; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "name", - "baseName": "name", - "type": "string" - } ]; - - static getAttributeTypeMap() { - return Tag.attributeTypeMap; - } -} - -/** -* A User who is purchasing from the pet store -*/ -export class User { - 'id'?: number; - 'username'?: string; - 'firstName'?: string; - 'lastName'?: string; - 'email'?: string; - 'password'?: string; - 'phone'?: string; - /** - * User Status - */ - 'userStatus'?: number; - - static discriminator = undefined; - - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - { - "name": "id", - "baseName": "id", - "type": "number" - }, - { - "name": "username", - "baseName": "username", - "type": "string" - }, - { - "name": "firstName", - "baseName": "firstName", - "type": "string" - }, - { - "name": "lastName", - "baseName": "lastName", - "type": "string" - }, - { - "name": "email", - "baseName": "email", - "type": "string" - }, - { - "name": "password", - "baseName": "password", - "type": "string" - }, - { - "name": "phone", - "baseName": "phone", - "type": "string" - }, - { - "name": "userStatus", - "baseName": "userStatus", - "type": "number" - } ]; - - static getAttributeTypeMap() { - return User.attributeTypeMap; - } -} - - -let enumsMap: {[index: string]: any} = { - "Order.StatusEnum": Order.StatusEnum, - "Pet.StatusEnum": Pet.StatusEnum, -} - -let typeMap: {[index: string]: any} = { - "ApiResponse": ApiResponse, - "Category": Category, - "Order": Order, - "Pet": Pet, - "Tag": Tag, - "User": User, -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: localVarRequest.Options): void; -} - -export class HttpBasicAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string = ''; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } - } -} - -export class OAuth implements Authentication { - public accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - } -} - -export class VoidAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export enum PetApiApiKeys { - api_key, -} - -export class PetApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: PetApiApiKeys, value: string) { - (this.authentications as any)[PetApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * - * @summary Add a new pet to the store - * @param pet Pet object that needs to be added to the store - */ - public addPet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'pet' is not null or undefined - if (pet === null || pet === undefined) { - throw new Error('Required parameter pet was null or undefined when calling addPet.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(pet, "Pet") - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Deletes a pet - * @param petId Pet id to delete - * @param apiKey - */ - public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling deletePet.'); - } - - localVarHeaderParams['api_key'] = ObjectSerializer.serialize(apiKey, "string"); - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * 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 - */ - public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/pet/findByStatus'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); - } - - if (status !== undefined) { - localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * 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 - */ - public findPetsByTags (tags: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { - const localVarPath = this.basePath + '/pet/findByTags'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); - } - - if (tags !== undefined) { - localVarQueryParameters['tags'] = ObjectSerializer.serialize(tags, "Array"); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Array"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Returns a single pet - * @summary Find pet by ID - * @param petId ID of pet to return - */ - public getPetById (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling getPetById.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.api_key.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Pet; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Pet"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Update an existing pet - * @param pet Pet object that needs to be added to the store - */ - public updatePet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'pet' is not null or undefined - if (pet === null || pet === undefined) { - throw new Error('Required parameter pet was null or undefined when calling updatePet.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(pet, "Pet") - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @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 - */ - public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/pet/{petId}' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - - - let localVarUseFormData = false; - - if (name !== undefined) { - localVarFormParams['name'] = ObjectSerializer.serialize(name, "string"); - } - - if (status !== undefined) { - localVarFormParams['status'] = ObjectSerializer.serialize(status, "string"); - } - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary uploads an image - * @param petId ID of pet to update - * @param additionalMetadata Additional data to pass to server - * @param file file to upload - */ - public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> { - const localVarPath = this.basePath + '/pet/{petId}/uploadImage' - .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); - } - - - let localVarUseFormData = false; - - if (additionalMetadata !== undefined) { - localVarFormParams['additionalMetadata'] = ObjectSerializer.serialize(additionalMetadata, "string"); - } - - if (file !== undefined) { - localVarFormParams['file'] = file; - } - localVarUseFormData = true; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: ApiResponse; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "ApiResponse"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum StoreApiApiKeys { - api_key, -} - -export class StoreApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: StoreApiApiKeys, value: string) { - (this.authentications as any)[StoreApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * 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 - */ - public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - */ - public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { - const localVarPath = this.basePath + '/store/inventory'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.api_key.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * 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 - */ - public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> { - const localVarPath = this.basePath + '/store/order/{orderId}' - .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Place an order for a pet - * @param order order placed for purchasing the pet - */ - public placeOrder (order: Order) : Promise<{ response: http.ClientResponse; body: Order; }> { - const localVarPath = this.basePath + '/store/order'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'order' is not null or undefined - if (order === null || order === undefined) { - throw new Error('Required parameter order was null or undefined when calling placeOrder.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(order, "Order") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "Order"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum UserApiApiKeys { - api_key, -} - -export class UserApi { - protected _basePath = defaultBasePath; - protected defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'api_key': new ApiKeyAuth('header', 'api_key'), - 'petstore_auth': new OAuth(), - } - - constructor(basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: UserApiApiKeys, value: string) { - (this.authentications as any)[UserApiApiKeys[key]].apiKey = value; - } - - set accessToken(token: string) { - this.authentications.petstore_auth.accessToken = token; - } - /** - * This can only be done by the logged in user. - * @summary Create user - * @param user Created user object - */ - public createUser (user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUser.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "User") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Creates list of users with given input array - * @param user List of user object - */ - public createUsersWithArrayInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/createWithArray'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "Array") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Creates list of users with given input array - * @param user List of user object - */ - public createUsersWithListInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/createWithList'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "Array") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * This can only be done by the logged in user. - * @summary Delete user - * @param username The name that needs to be deleted - */ - public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling deleteUser.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'DELETE', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Get user by user name - * @param username The name that needs to be fetched. Use user1 for testing. - */ - public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> { - const localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling getUserByName.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: User; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "User"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Logs user into the system - * @param username The user name for login - * @param password The password for login in clear text - */ - public loginUser (username: string, password: string) : Promise<{ response: http.ClientResponse; body: string; }> { - const localVarPath = this.basePath + '/user/login'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('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 Error('Required parameter password was null or undefined when calling loginUser.'); - } - - if (username !== undefined) { - localVarQueryParameters['username'] = ObjectSerializer.serialize(username, "string"); - } - - if (password !== undefined) { - localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string"); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body: string; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, "string"); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * - * @summary Logs out current logged in user session - */ - public logoutUser () : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/logout'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - /** - * This can only be done by the logged in user. - * @summary Updated user - * @param username name that need to be deleted - * @param user Updated user object - */ - public updateUser (username: string, user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { - const localVarPath = this.basePath + '/user/{username}' - .replace('{' + 'username' + '}', encodeURIComponent(String(username))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling updateUser.'); - } - - // verify required parameter 'user' is not null or undefined - if (user === null || user === undefined) { - throw new Error('Required parameter user was null or undefined when calling updateUser.'); - } - - - let localVarUseFormData = false; - - let localVarRequestOptions: localVarRequest.Options = { - method: 'PUT', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - body: ObjectSerializer.serialize(user, "User") - }; - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/api/apis.ts b/samples/client/petstore/typescript-node/npm/api/apis.ts new file mode 100644 index 000000000000..2bbfc445eaf0 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api/apis.ts @@ -0,0 +1,7 @@ +export * from './petApi'; +import { PetApi } from './petApi'; +export * from './storeApi'; +import { StoreApi } from './storeApi'; +export * from './userApi'; +import { UserApi } from './userApi'; +export const APIS = [PetApi, StoreApi, UserApi]; diff --git a/samples/client/petstore/typescript-node/npm/api/petApi.ts b/samples/client/petstore/typescript-node/npm/api/petApi.ts new file mode 100644 index 000000000000..c367b489d22b --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api/petApi.ts @@ -0,0 +1,546 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ +import { ApiResponse } from '../model/apiResponse'; +import { Pet } from '../model/pet'; + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum PetApiApiKeys { + api_key, +} + +export class PetApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'petstore_auth': new OAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: PetApiApiKeys, value: string) { + (this.authentications as any)[PetApiApiKeys[key]].apiKey = value; + } + + set accessToken(token: string) { + this.authentications.petstore_auth.accessToken = token; + } + + /** + * + * @summary Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling addPet.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(pet, "Pet") + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); + } + + localVarHeaderParams['api_key'] = ObjectSerializer.serialize(apiKey, "string"); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * 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 + */ + public findPetsByStatus (status: Array<'available' | 'pending' | 'sold'>) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/pet/findByStatus'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } + + if (status !== undefined) { + localVarQueryParameters['status'] = ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Array"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * 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 + */ + public findPetsByTags (tags: Array) : Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/pet/findByTags'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } + + if (tags !== undefined) { + localVarQueryParameters['tags'] = ObjectSerializer.serialize(tags, "Array"); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Array"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * Returns a single pet + * @summary Find pet by ID + * @param petId ID of pet to return + */ + public getPetById (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.api_key.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Pet; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Pet"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet (pet: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new Error('Required parameter pet was null or undefined when calling updatePet.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(pet, "Pet") + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @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 + */ + public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + + + let localVarUseFormData = false; + + if (name !== undefined) { + localVarFormParams['name'] = ObjectSerializer.serialize(name, "string"); + } + + if (status !== undefined) { + localVarFormParams['status'] = ObjectSerializer.serialize(status, "string"); + } + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> { + const localVarPath = this.basePath + '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); + } + + + let localVarUseFormData = false; + + if (additionalMetadata !== undefined) { + localVarFormParams['additionalMetadata'] = ObjectSerializer.serialize(additionalMetadata, "string"); + } + + if (file !== undefined) { + localVarFormParams['file'] = file; + } + localVarUseFormData = true; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.petstore_auth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: ApiResponse; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "ApiResponse"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore/typescript-node/npm/api/storeApi.ts b/samples/client/petstore/typescript-node/npm/api/storeApi.ts new file mode 100644 index 000000000000..39a1b21f2383 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api/storeApi.ts @@ -0,0 +1,281 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ +import { Order } from '../model/order'; + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum StoreApiApiKeys { + api_key, +} + +export class StoreApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'api_key': new ApiKeyAuth('header', 'api_key'), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: StoreApiApiKeys, value: string) { + (this.authentications as any)[StoreApiApiKeys[key]].apiKey = value; + } + + /** + * 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 + */ + public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + */ + public getInventory () : Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }> { + const localVarPath = this.basePath + '/store/inventory'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.api_key.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: { [key: string]: number; }; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * 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 + */ + public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> { + const localVarPath = this.basePath + '/store/order/{orderId}' + .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Order"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder (order: Order) : Promise<{ response: http.ClientResponse; body: Order; }> { + const localVarPath = this.basePath + '/store/order'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new Error('Required parameter order was null or undefined when calling placeOrder.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(order, "Order") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Order; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Order"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore/typescript-node/npm/api/userApi.ts b/samples/client/petstore/typescript-node/npm/api/userApi.ts new file mode 100644 index 000000000000..fbdb95cb4934 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/api/userApi.ts @@ -0,0 +1,504 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); +import Promise = require('bluebird'); + +/* tslint:disable:no-unused-locals */ +import { User } from '../model/user'; + +import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models'; + +let defaultBasePath = 'http://petstore.swagger.io/v2'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum UserApiApiKeys { +} + +export class UserApi { + protected _basePath = defaultBasePath; + protected defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + } + + constructor(basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: UserApiApiKeys, value: string) { + (this.authentications as any)[UserApiApiKeys[key]].apiKey = value; + } + + /** + * This can only be done by the logged in user. + * @summary Create user + * @param user Created user object + */ + public createUser (user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUser.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "User") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/createWithArray'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "Array") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput (user: Array) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/createWithList'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "Array") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param username The name that needs to be deleted + */ + public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: User; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "User"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser (username: string, password: string) : Promise<{ response: http.ClientResponse; body: string; }> { + const localVarPath = this.basePath + '/user/login'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('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 Error('Required parameter password was null or undefined when calling loginUser.'); + } + + if (username !== undefined) { + localVarQueryParameters['username'] = ObjectSerializer.serialize(username, "string"); + } + + if (password !== undefined) { + localVarQueryParameters['password'] = ObjectSerializer.serialize(password, "string"); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: string; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "string"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Logs out current logged in user session + */ + public logoutUser () : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/logout'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser (username: string, user: User) : Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); + } + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new Error('Required parameter user was null or undefined when calling updateUser.'); + } + + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(user, "User") + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} diff --git a/samples/client/petstore/typescript-node/npm/client.d.ts b/samples/client/petstore/typescript-node/npm/client.d.ts deleted file mode 100644 index cb0ff5c3b541..000000000000 --- a/samples/client/petstore/typescript-node/npm/client.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/samples/client/petstore/typescript-node/npm/client.js b/samples/client/petstore/typescript-node/npm/client.js deleted file mode 100644 index f5813b8c25ac..000000000000 --- a/samples/client/petstore/typescript-node/npm/client.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var api = require("./api"); -var fs = require("fs"); -function deepCheck(objectA, objectB) { - var a = objectA; - var b = objectB; - var isString = (typeof a === "string" && typeof b === "string"); - var isBool = (typeof a === "boolean" && typeof b === "boolean"); - var isNumber = (typeof a === "number" && typeof b === "number"); - if (a instanceof Array && b instanceof Array) { - for (var i = 0; i < a.length; i++) { - if (!deepCheck(a[i], b[i])) { - return false; - } - } - return true; - } - else if (isString || isBool || isNumber) { - return a === b; - } - else if (typeof a === "object" && typeof b === "object") { - for (var key in a) { - if (!deepCheck(a[key], b[key])) { - return false; - } - } - return true; - } - else { - return a === b; - } -} -var petApi = new api.PetApi(); -petApi.setApiKey(api.PetApiApiKeys.api_key, 'special-key'); -var tag1 = new api.Tag(); -tag1.id = 18291; -tag1.name = 'TS tag 1'; -var pet = new api.Pet(); -pet.name = 'TypeScriptDoggie'; -pet.id = 18291; -pet.photoUrls = ["http://url1", "http://url2"]; -pet.tags = [tag1]; -var petId; -var exitCode = 0; -var rewire = require("rewire"); -var rewiredApi = rewire("./api"); -var objectSerializer = rewiredApi.__get__("ObjectSerializer"); -console.log("Checking deserialization."); -var serializedPet = { - "id": pet.id, - "category": { - "id": 18291, - "name": "TS category 1" - }, - "name": pet.name, - "photoUrls": pet.photoUrls, - "tags": [ - { - "id": 18291, - "name": "TS tag 1" - } - ], - "status": "available" -}; -var deserializedPet = objectSerializer.deserialize(serializedPet, "Pet"); -var petType = deserializedPet instanceof rewiredApi.Pet; -var tagType1 = deserializedPet.tags[0] instanceof rewiredApi.Tag; -var categoryType = deserializedPet.category instanceof rewiredApi.Category; -var checks = {}; -for (var key in deserializedPet) { - checks[key] = {}; - checks[key]["isCorrect"] = deepCheck(deserializedPet[key], serializedPet[key]); - checks[key]["is"] = deserializedPet[key]; - checks[key]["should"] = serializedPet[key]; -} -var correctTypes = petType && tagType1 && categoryType; -if (!correctTypes) { - exitCode = 1; - console.log("PetType correct: ", petType); - console.log("TagType1 correct: ", tagType1); - console.log("CategoryType correct: ", categoryType); -} -for (var key in checks) { - var check = checks[key]; - if (!check["isCorrect"]) { - exitCode = 1; - console.log(key, " incorrect ", "\nis:\n ", check["is"], "\nshould:\n ", check["should"]); - } -} -console.log("Checking serialization"); -var category = new api.Category(); -category.id = 18291; -category.name = "TS category 1"; -pet.category = category; -pet.status = api.Pet.StatusEnum.Available; -var reserializedData = objectSerializer.serialize(pet, "Pet"); -if (!deepCheck(reserializedData, serializedPet)) { - exitCode = 1; - console.log("Reserialized Data incorrect! \nis:\n ", reserializedData, "\nshould:\n ", serializedPet); -} -petApi.addPet(pet) - .then(function (res) { - var newPet = res.body; - petId = newPet.id; - console.log("Created pet with ID " + petId); - newPet.status = api.Pet.StatusEnum.Available; - return petApi.updatePet(newPet); -}) - .then(function (res) { - console.log('Updated pet using POST body'); - return petApi.updatePetWithForm(petId, undefined, "pending"); -}) - .then(function (res) { - console.log('Updated pet using POST form'); - return petApi.uploadFile(petId, undefined, fs.readFileSync('sample.png')); -}) - .then(function (res) { - console.log('Uploaded image'); - return petApi.getPetById(petId); -}) - .then(function (res) { - console.log('Got pet by ID: ' + JSON.stringify(res.body)); - console.log("EnumValue: ", api.Pet.StatusEnum.Pending); - console.log("Typeof EnumValue:", typeof api.Pet.StatusEnum.Pending); - console.log("Res:", res.body.status); - if (res.body.status != api.Pet.StatusEnum.Pending) { - throw new Error("Unexpected pet status"); - } -}) - .catch(function (err) { - console.error(err); - exitCode = 1; -}) - .then(function () { - return petApi.deletePet(petId); -}) - .then(function (res) { - console.log('Deleted pet'); - process.exit(exitCode); -}); -//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/client.js.map b/samples/client/petstore/typescript-node/npm/client.js.map deleted file mode 100644 index 26a3202975b2..000000000000 --- a/samples/client/petstore/typescript-node/npm/client.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client.js","sourceRoot":"","sources":["client.ts"],"names":[],"mappings":";;AAAA,2BAA8B;AAC9B,uBAA0B;AAG1B,mBAAmB,OAAY,EAAE,OAAY;IACzC,IAAI,CAAC,GAAG,OAAO,CAAC;IAChB,IAAI,CAAC,GAAG,OAAO,CAAC;IAChB,IAAI,QAAQ,GAAY,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;IACzE,IAAI,MAAM,GAAY,CAAC,OAAO,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC;IACzE,IAAI,QAAQ,GAAY,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,K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AAG,CAAC,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE;QAC/C,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC5C;AACL,CAAC,CAAC;KACD,KAAK,CAAC,UAAC,GAAQ;IACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,QAAQ,GAAG,CAAC,CAAC;AACjB,CAAC,CAAC;KACD,IAAI,CAAC;IACF,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC;KACD,IAAI,CAAC,UAAC,GAAG;IACN,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/client.ts b/samples/client/petstore/typescript-node/npm/client.ts index e3c7b7c8b332..1dc7593c31c3 100644 --- a/samples/client/petstore/typescript-node/npm/client.ts +++ b/samples/client/petstore/typescript-node/npm/client.ts @@ -51,7 +51,7 @@ var exitCode = 0; // Test Object Serializer var rewire = require("rewire"); var rewiredApi = rewire("./api"); -var objectSerializer = rewiredApi.__get__("ObjectSerializer"); +var objectSerializer = rewiredApi.ObjectSerializer; console.log("Checking deserialization."); var serializedPet = { "id": pet.id, diff --git a/samples/client/petstore/typescript-node/npm/model/apiResponse.ts b/samples/client/petstore/typescript-node/npm/model/apiResponse.ts new file mode 100644 index 000000000000..5abc5ef23645 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/apiResponse.ts @@ -0,0 +1,45 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* Describes the result of uploading an image resource +*/ +export class ApiResponse { + 'code'?: number; + 'type'?: string; + 'message'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "number" + }, + { + "name": "type", + "baseName": "type", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return ApiResponse.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/npm/model/category.ts b/samples/client/petstore/typescript-node/npm/model/category.ts new file mode 100644 index 000000000000..5a2f620f64c3 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/category.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* A category for a pet +*/ +export class Category { + 'id'?: number; + 'name'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Category.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/npm/model/models.ts b/samples/client/petstore/typescript-node/npm/model/models.ts new file mode 100644 index 000000000000..8ed47b194d73 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/models.ts @@ -0,0 +1,204 @@ +export * from './apiResponse'; +export * from './category'; +export * from './order'; +export * from './pet'; +export * from './tag'; +export * from './user'; + +import localVarRequest = require('request'); + +import { ApiResponse } from './apiResponse'; +import { Category } from './category'; +import { Order } from './order'; +import { Pet } from './pet'; +import { Tag } from './tag'; +import { User } from './user'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { + "Order.StatusEnum": Order.StatusEnum, + "Pet.StatusEnum": Pet.StatusEnum, +} + +let typeMap: {[index: string]: any} = { + "ApiResponse": ApiResponse, + "Category": Category, + "Order": Order, + "Pet": Pet, + "Tag": Tag, + "User": User, +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/model/order.ts b/samples/client/petstore/typescript-node/npm/model/order.ts new file mode 100644 index 000000000000..8670f6aef573 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/order.ts @@ -0,0 +1,73 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* An order for a pets from the pet store +*/ +export class Order { + 'id'?: number; + 'petId'?: number; + 'quantity'?: number; + 'shipDate'?: Date; + /** + * Order Status + */ + 'status'?: Order.StatusEnum; + 'complete'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "petId", + "baseName": "petId", + "type": "number" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number" + }, + { + "name": "shipDate", + "baseName": "shipDate", + "type": "Date" + }, + { + "name": "status", + "baseName": "status", + "type": "Order.StatusEnum" + }, + { + "name": "complete", + "baseName": "complete", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return Order.attributeTypeMap; + } +} + +export namespace Order { + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} diff --git a/samples/client/petstore/typescript-node/npm/model/pet.ts b/samples/client/petstore/typescript-node/npm/model/pet.ts new file mode 100644 index 000000000000..a91c4252fe34 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/pet.ts @@ -0,0 +1,75 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Category } from './category'; +import { Tag } from './tag'; + +/** +* A pet for sale in the pet store +*/ +export class Pet { + 'id'?: number; + 'category'?: Category; + 'name': string; + 'photoUrls': Array; + 'tags'?: Array; + /** + * pet status in the store + */ + 'status'?: Pet.StatusEnum; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "category", + "baseName": "category", + "type": "Category" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "photoUrls", + "baseName": "photoUrls", + "type": "Array" + }, + { + "name": "tags", + "baseName": "tags", + "type": "Array" + }, + { + "name": "status", + "baseName": "status", + "type": "Pet.StatusEnum" + } ]; + + static getAttributeTypeMap() { + return Pet.attributeTypeMap; + } +} + +export namespace Pet { + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} diff --git a/samples/client/petstore/typescript-node/npm/model/tag.ts b/samples/client/petstore/typescript-node/npm/model/tag.ts new file mode 100644 index 000000000000..26d1dc741c57 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/tag.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* A tag for a pet +*/ +export class Tag { + 'id'?: number; + 'name'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Tag.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/npm/model/user.ts b/samples/client/petstore/typescript-node/npm/model/user.ts new file mode 100644 index 000000000000..b683fb5debc5 --- /dev/null +++ b/samples/client/petstore/typescript-node/npm/model/user.ts @@ -0,0 +1,78 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** +* A User who is purchasing from the pet store +*/ +export class User { + 'id'?: number; + 'username'?: string; + 'firstName'?: string; + 'lastName'?: string; + 'email'?: string; + 'password'?: string; + 'phone'?: string; + /** + * User Status + */ + 'userStatus'?: number; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number" + }, + { + "name": "username", + "baseName": "username", + "type": "string" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string" + }, + { + "name": "email", + "baseName": "email", + "type": "string" + }, + { + "name": "password", + "baseName": "password", + "type": "string" + }, + { + "name": "phone", + "baseName": "phone", + "type": "string" + }, + { + "name": "userStatus", + "baseName": "userStatus", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return User.attributeTypeMap; + } +} + diff --git a/samples/client/petstore/typescript-node/npm/package-lock.json b/samples/client/petstore/typescript-node/npm/package-lock.json deleted file mode 100644 index 4e1c2957991d..000000000000 --- a/samples/client/petstore/typescript-node/npm/package-lock.json +++ /dev/null @@ -1,835 +0,0 @@ -{ - "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@types/bluebird": { - "version": "3.5.20", - "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.20.tgz", - "integrity": "sha512-Wk41MVdF+cHBfVXj/ufUHJeO3BlIQr1McbHZANErMykaCWeDSZbH5erGjNBw2/3UlRdSxZbLfSuQTzFmPOYFsA==" - }, - "@types/caseless": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.1.tgz", - "integrity": "sha512-FhlMa34NHp9K5MY1Uz8yb+ZvuX0pnvn3jScRSNAb75KHGB8d3rEU6hqMs3Z2vjuytcMfRg6c5CHMc3wtYyD2/A==" - }, - "@types/form-data": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz", - "integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==", - "requires": { - "@types/node": "*" - } - }, - "@types/node": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.0.6.tgz", - "integrity": "sha512-2whhQUfDHRBiZ3L54Ulyl1X+fZWbWabxPYRDAsibgOAtE6adwusD15Xv0Bw/D7cPah35Z/wKTdW3iAKsevw1uw==" - }, - "@types/request": { - "version": "2.47.0", - "resolved": "https://registry.npmjs.org/@types/request/-/request-2.47.0.tgz", - "integrity": "sha512-/KXM5oev+nNCLIgBjkwbk8VqxmzI56woD4VUxn95O+YeQ8hJzcSmIZ1IN3WexiqBb6srzDo2bdMbsXxgXNkz5Q==", - "requires": { - "@types/caseless": "*", - "@types/form-data": "*", - "@types/node": "*", - "@types/tough-cookie": "*" - } - }, - "@types/tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha512-MDQLxNFRLasqS4UlkWMSACMKeSm1x4Q3TxzUC7KQUsh6RK1ZrQ0VEyE3yzXcBu+K8ejVj4wuX32eUG02yNp+YQ==" - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", - "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, - "babel-core": { - "version": "6.26.3", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", - "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", - "requires": { - "babel-code-frame": "^6.26.0", - "babel-generator": "^6.26.0", - "babel-helpers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "convert-source-map": "^1.5.1", - "debug": "^2.6.9", - "json5": "^0.5.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.4", - "path-is-absolute": "^1.0.1", - "private": "^0.1.8", - "slash": "^1.0.0", - "source-map": "^0.5.7" - } - }, - "babel-generator": { - "version": "6.26.1", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", - "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - } - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", - "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", - "requires": { - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "lodash": "^4.17.4" - } - }, - "babel-register": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", - "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "requires": { - "babel-core": "^6.26.0", - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "home-or-tmp": "^2.0.0", - "lodash": "^4.17.4", - "mkdirp": "^0.5.1", - "source-map-support": "^0.4.15" - } - }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - } - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" - }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "requires": { - "hoek": "4.x.x" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "convert-source-map": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", - "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=" - }, - "core-js": { - "version": "2.5.6", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.6.tgz", - "integrity": "sha512-lQUVfQi0aLix2xpyjrrJEvfuYCqPc/HwmTKsC/VNf8q0zsjX7SQZtp4+oRONN5Tsur9GDETPjj+Ub2iDiGZfSQ==" - }, - "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=" - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "requires": { - "boom": "5.x.x" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "requires": { - "hoek": "4.x.x" - } - } - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "requires": { - "repeating": "^2.0.0" - } - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "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=" - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "requires": { - "ajv": "^5.1.0", - "har-schema": "^2.0.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "requires": { - "boom": "4.x.x", - "cryptiles": "3.x.x", - "hoek": "4.x.x", - "sntp": "2.x.x" - } - }, - "hoek": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", - "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" - }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.1" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "requires": { - "loose-envify": "^1.0.0" - } - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" - }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "requires": { - "js-tokens": "^3.0.0" - } - }, - "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" - }, - "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "requires": { - "mime-db": "~1.33.0" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "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" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "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=" - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" - }, - "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=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "private": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", - "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "requires": { - "is-finite": "^1.0.0" - } - }, - "request": { - "version": "2.85.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", - "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.6.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.1", - "forever-agent": "~0.6.1", - "form-data": "~2.3.1", - "har-validator": "~5.0.3", - "hawk": "~6.0.2", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.17", - "oauth-sign": "~0.8.2", - "performance-now": "^2.1.0", - "qs": "~6.5.1", - "safe-buffer": "^5.1.1", - "stringstream": "~0.0.5", - "tough-cookie": "~2.3.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.1.0" - } - }, - "rewire": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rewire/-/rewire-3.0.2.tgz", - "integrity": "sha512-ejkkt3qYnsQ38ifc9llAAzuHiGM7kR8N5/mL3aHWgmWwet0OMFcmJB8aTsMV2PBHCWxNVTLCeRfBpEa8X2+1fw==", - "requires": { - "babel-core": "^6.26.0", - "babel-plugin-transform-es2015-block-scoping": "^6.26.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" - }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "requires": { - "hoek": "4.x.x" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "requires": { - "source-map": "^0.5.6" - } - }, - "sshpk": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", - "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - } - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^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=" - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=" - }, - "tough-cookie": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", - "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", - "requires": { - "punycode": "^1.4.1" - } - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "typescript": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.3.tgz", - "integrity": "sha512-K7g15Bb6Ra4lKf7Iq2l/I5/En+hLIHmxWZGq3D4DIRNFxMNV6j2SHSvDOqs2tGd4UvD/fJvrwopzQXjLrT7Itw==", - "dev": true - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - } - } -}