forked from loafle/openapi-generator-original
Restructure TypeScript Node generation into separate files (PHNX-1041) (#363)
This commit is contained in:
parent
7a7e221210
commit
960412a9b4
@ -19,7 +19,7 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
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 org.slf4j.LoggerFactory;
|
||||
|
||||
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 class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
||||
|
||||
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 class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
||||
}
|
||||
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<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
Map<String, Object> result = super.postProcessAllModels(objs);
|
||||
|
||||
for (Map.Entry<String, Object> entry : result.entrySet()) {
|
||||
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
|
||||
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
|
||||
for (Map<String, Object> 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<Map<String, String>> toTsImports(CodegenModel cm, Set<String> imports) {
|
||||
List<Map<String, String>> tsImports = new ArrayList<>();
|
||||
for (String im : imports) {
|
||||
if (!im.equals(cm.classname)) {
|
||||
HashMap<String, String> tsImport = new HashMap<>();
|
||||
tsImport.put("classname", im);
|
||||
tsImport.put("filename", toModelFilename(im));
|
||||
tsImports.add(tsImport);
|
||||
}
|
||||
}
|
||||
return tsImports;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> operations) {
|
||||
Map<String, Object> objs = (Map<String, Object>) 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<String, CodegenSecurity> authMethodsMap = new HashMap<>();
|
||||
for (CodegenOperation op : (List<CodegenOperation>) 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<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports");
|
||||
for (Map<String, Object> 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 class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
||||
@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 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
||||
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<String>)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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}}
|
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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}}
|
@ -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> => 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> => 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}} = <any> {{{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") {
|
||||
(<any>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': <Authentication>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 = (<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) {
|
||||
(<any>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';
|
@ -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}} = <any> {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
}
|
||||
{{/hasEnums}}
|
||||
{{/model}}
|
||||
{{/models}}
|
@ -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> => 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> => 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") {
|
||||
(<any>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
|
||||
}
|
||||
}
|
@ -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}}
|
||||
}
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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 (*):
|
||||
|
@ -1 +1 @@
|
||||
2.3.0-SNAPSHOT
|
||||
3.0.3-SNAPSHOT
|
@ -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> => 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> => 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") {
|
||||
(<any>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': <Authentication>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 = (<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) {
|
||||
(<any>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';
|
@ -0,0 +1,3 @@
|
||||
export * from './fakeApi';
|
||||
import { FakeApi } from './fakeApi';
|
||||
export const APIS = [FakeApi];
|
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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> => 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> => 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") {
|
||||
(<any>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
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
3.0.0-SNAPSHOT
|
||||
3.0.3-SNAPSHOT
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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];
|
546
samples/client/petstore/typescript-node/default/api/petApi.ts
Normal file
546
samples/client/petstore/typescript-node/default/api/petApi.ts
Normal file
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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<Pet>; }> {
|
||||
const localVarPath = this.basePath + '/pet/findByStatus';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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) {
|
||||
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||||
} else {
|
||||
localVarRequestOptions.form = localVarFormParams;
|
||||
}
|
||||
}
|
||||
return new Promise<{ response: http.ClientResponse; body: Array<Pet>; }>((resolve, reject) => {
|
||||
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
body = ObjectSerializer.deserialize(body, "Array<Pet>");
|
||||
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<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
|
||||
const localVarPath = this.basePath + '/pet/findByTags';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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<string>");
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||||
} else {
|
||||
localVarRequestOptions.form = localVarFormParams;
|
||||
}
|
||||
}
|
||||
return new Promise<{ response: http.ClientResponse; body: Array<Pet>; }>((resolve, reject) => {
|
||||
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
body = ObjectSerializer.deserialize(body, "Array<Pet>");
|
||||
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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
281
samples/client/petstore/typescript-node/default/api/storeApi.ts
Normal file
281
samples/client/petstore/typescript-node/default/api/storeApi.ts
Normal file
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
504
samples/client/petstore/typescript-node/default/api/userApi.ts
Normal file
504
samples/client/petstore/typescript-node/default/api/userApi.ts
Normal file
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/createWithArray';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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<User>")
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(localVarRequestOptions);
|
||||
|
||||
if (Object.keys(localVarFormParams).length) {
|
||||
if (localVarUseFormData) {
|
||||
(<any>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<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/createWithList';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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<User>")
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(localVarRequestOptions);
|
||||
|
||||
if (Object.keys(localVarFormParams).length) {
|
||||
if (localVarUseFormData) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
204
samples/client/petstore/typescript-node/default/model/models.ts
Normal file
204
samples/client/petstore/typescript-node/default/model/models.ts
Normal file
@ -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> => 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> => 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") {
|
||||
(<any>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
|
||||
}
|
||||
}
|
@ -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 = <any> 'placed',
|
||||
Approved = <any> 'approved',
|
||||
Delivered = <any> 'delivered'
|
||||
}
|
||||
}
|
75
samples/client/petstore/typescript-node/default/model/pet.ts
Normal file
75
samples/client/petstore/typescript-node/default/model/pet.ts
Normal file
@ -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<string>;
|
||||
'tags'?: Array<Tag>;
|
||||
/**
|
||||
* 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<string>"
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"baseName": "tags",
|
||||
"type": "Array<Tag>"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"baseName": "status",
|
||||
"type": "Pet.StatusEnum"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Pet.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Pet {
|
||||
export enum StatusEnum {
|
||||
Available = <any> 'available',
|
||||
Pending = <any> 'pending',
|
||||
Sold = <any> 'sold'
|
||||
}
|
||||
}
|
39
samples/client/petstore/typescript-node/default/model/tag.ts
Normal file
39
samples/client/petstore/typescript-node/default/model/tag.ts
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
3.0.0-SNAPSHOT
|
||||
3.0.3-SNAPSHOT
|
288
samples/client/petstore/typescript-node/npm/api.d.ts
vendored
288
samples/client/petstore/typescript-node/npm/api.d.ts
vendored
@ -1,288 +0,0 @@
|
||||
/// <reference types="request" />
|
||||
/// <reference types="bluebird" />
|
||||
/// <reference types="node" />
|
||||
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<string>;
|
||||
'tags'?: Array<Tag>;
|
||||
'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<Pet>;
|
||||
}>;
|
||||
findPetsByTags(tags: Array<string>): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body: Array<Pet>;
|
||||
}>;
|
||||
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<User>): Promise<{
|
||||
response: http.ClientResponse;
|
||||
body?: any;
|
||||
}>;
|
||||
createUsersWithListInput(user: Array<User>): 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;
|
||||
}>;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
7
samples/client/petstore/typescript-node/npm/api/apis.ts
Normal file
7
samples/client/petstore/typescript-node/npm/api/apis.ts
Normal file
@ -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];
|
546
samples/client/petstore/typescript-node/npm/api/petApi.ts
Normal file
546
samples/client/petstore/typescript-node/npm/api/petApi.ts
Normal file
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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<Pet>; }> {
|
||||
const localVarPath = this.basePath + '/pet/findByStatus';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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) {
|
||||
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||||
} else {
|
||||
localVarRequestOptions.form = localVarFormParams;
|
||||
}
|
||||
}
|
||||
return new Promise<{ response: http.ClientResponse; body: Array<Pet>; }>((resolve, reject) => {
|
||||
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
body = ObjectSerializer.deserialize(body, "Array<Pet>");
|
||||
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<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
|
||||
const localVarPath = this.basePath + '/pet/findByTags';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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<string>");
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
(<any>localVarRequestOptions).formData = localVarFormParams;
|
||||
} else {
|
||||
localVarRequestOptions.form = localVarFormParams;
|
||||
}
|
||||
}
|
||||
return new Promise<{ response: http.ClientResponse; body: Array<Pet>; }>((resolve, reject) => {
|
||||
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
body = ObjectSerializer.deserialize(body, "Array<Pet>");
|
||||
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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
281
samples/client/petstore/typescript-node/npm/api/storeApi.ts
Normal file
281
samples/client/petstore/typescript-node/npm/api/storeApi.ts
Normal file
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
504
samples/client/petstore/typescript-node/npm/api/userApi.ts
Normal file
504
samples/client/petstore/typescript-node/npm/api/userApi.ts
Normal file
@ -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': <Authentication>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 = (<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) {
|
||||
(<any>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<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/createWithArray';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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<User>")
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(localVarRequestOptions);
|
||||
|
||||
if (Object.keys(localVarFormParams).length) {
|
||||
if (localVarUseFormData) {
|
||||
(<any>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<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
|
||||
const localVarPath = this.basePath + '/user/createWithList';
|
||||
let localVarQueryParameters: any = {};
|
||||
let localVarHeaderParams: any = (<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<User>")
|
||||
};
|
||||
|
||||
this.authentications.default.applyToRequest(localVarRequestOptions);
|
||||
|
||||
if (Object.keys(localVarFormParams).length) {
|
||||
if (localVarUseFormData) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 = (<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) {
|
||||
(<any>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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
export {};
|
@ -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
|
File diff suppressed because one or more lines are too long
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
204
samples/client/petstore/typescript-node/npm/model/models.ts
Normal file
204
samples/client/petstore/typescript-node/npm/model/models.ts
Normal file
@ -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> => 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> => 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") {
|
||||
(<any>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
|
||||
}
|
||||
}
|
73
samples/client/petstore/typescript-node/npm/model/order.ts
Normal file
73
samples/client/petstore/typescript-node/npm/model/order.ts
Normal file
@ -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 = <any> 'placed',
|
||||
Approved = <any> 'approved',
|
||||
Delivered = <any> 'delivered'
|
||||
}
|
||||
}
|
75
samples/client/petstore/typescript-node/npm/model/pet.ts
Normal file
75
samples/client/petstore/typescript-node/npm/model/pet.ts
Normal file
@ -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<string>;
|
||||
'tags'?: Array<Tag>;
|
||||
/**
|
||||
* 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<string>"
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"baseName": "tags",
|
||||
"type": "Array<Tag>"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"baseName": "status",
|
||||
"type": "Pet.StatusEnum"
|
||||
} ];
|
||||
|
||||
static getAttributeTypeMap() {
|
||||
return Pet.attributeTypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Pet {
|
||||
export enum StatusEnum {
|
||||
Available = <any> 'available',
|
||||
Pending = <any> 'pending',
|
||||
Sold = <any> 'sold'
|
||||
}
|
||||
}
|
39
samples/client/petstore/typescript-node/npm/model/tag.ts
Normal file
39
samples/client/petstore/typescript-node/npm/model/tag.ts
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
|
78
samples/client/petstore/typescript-node/npm/model/user.ts
Normal file
78
samples/client/petstore/typescript-node/npm/model/user.ts
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user