forked from loafle/openapi-generator-original
Implemented fetch client
This commit is contained in:
@@ -131,6 +131,9 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
supportingFiles.add(new SupportingFile("servers.mustache", "servers.ts"));
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "index.ts"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("models_all.mustache", "models", "all.ts"));
|
||||
// TODO: add supporting files depending on cli parameter e.g. fetch vs angular
|
||||
supportingFiles.add(new SupportingFile("generators/fetch/fetch.mustache", "api.ts"));
|
||||
// models
|
||||
// TODO: properly set model and api packages
|
||||
this.setModelPackage("");
|
||||
|
||||
@@ -1,16 +1,41 @@
|
||||
# TODO:
|
||||
import { ResponseContext } from './http/http';
|
||||
import * as models from './models/all';
|
||||
import { Configuration} from './configuration'
|
||||
|
||||
# Generic for HTTP Library:
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
import { {{name}} } from './models/{{name}}';
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
|
||||
# Generate one class for each api
|
||||
# constructor: Configuration + RequestFactory + ResponseProcessor
|
||||
# one method for each API
|
||||
# call request factory
|
||||
# execute request with http library or w/e other library
|
||||
# call response processor
|
||||
# return promise
|
||||
|
||||
# Why is this good? Because it allows each generator to return whatever they want to return, but they rely on the same
|
||||
# internal process to get the response (if done correctly...)
|
||||
|
||||
# Export correctly configured apis!
|
||||
{{#operations}}
|
||||
import { {{classname}}RequestFactory, {{classname}}ResponseProcessor} from "./apis/{{classname}}";
|
||||
export class {{classname}} {
|
||||
private requestFactory: {{classname}}RequestFactory;
|
||||
private responseProcessor: {{classname}}ResponseProcessor;
|
||||
|
||||
public constructor(private configuration: Configuration) {
|
||||
this.requestFactory = new {{classname}}RequestFactory(configuration);
|
||||
this.responseProcessor = new {{classname}}ResponseProcessor();
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {
|
||||
const requestContext = this.requestFactory.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.{{nickname}}(response);
|
||||
});
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
||||
}
|
||||
|
||||
{{/operations}}
|
||||
|
||||
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
@@ -6,6 +6,7 @@ import 'isomorphic-fetch';
|
||||
export class IsomorphicFetchHttpLibrary implements HttpLibrary {
|
||||
|
||||
public send(request: RequestContext): Promise<ResponseContext> {
|
||||
console.log("Request: ", request);
|
||||
let method = request.getHttpMethod().toString();
|
||||
let body = request.getBody();
|
||||
|
||||
@@ -21,7 +22,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
|
||||
headers[key] = (headers[key] as Array<string>).join("; ");
|
||||
}
|
||||
|
||||
return resp.text().then((body) => {
|
||||
return resp.json().then((body) => {
|
||||
return new ResponseContext(resp.status, headers, body)
|
||||
});
|
||||
});
|
||||
|
||||
5
modules/openapi-generator/src/main/resources/typescript/models_all.mustache
vendored
Normal file
5
modules/openapi-generator/src/main/resources/typescript/models_all.mustache
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
export * from './{{name}}'
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
218
samples/client/petstore/typescript/builds/default/api.ts
Normal file
218
samples/client/petstore/typescript/builds/default/api.ts
Normal file
@@ -0,0 +1,218 @@
|
||||
import { ResponseContext } from './http/http';
|
||||
import * as models from './models/all';
|
||||
import { Configuration} from './configuration'
|
||||
|
||||
import { ApiResponse } from './models/ApiResponse';
|
||||
import { Category } from './models/Category';
|
||||
import { Order } from './models/Order';
|
||||
import { Pet } from './models/Pet';
|
||||
import { Tag } from './models/Tag';
|
||||
import { User } from './models/User';
|
||||
|
||||
import { PetApiRequestFactory, PetApiResponseProcessor} from "./apis/PetApi";
|
||||
export class PetApi {
|
||||
private requestFactory: PetApiRequestFactory;
|
||||
private responseProcessor: PetApiResponseProcessor;
|
||||
|
||||
public constructor(private configuration: Configuration) {
|
||||
this.requestFactory = new PetApiRequestFactory(configuration);
|
||||
this.responseProcessor = new PetApiResponseProcessor();
|
||||
}
|
||||
|
||||
public addPet(pet: Pet, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.addPet(pet, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.addPet(response);
|
||||
});
|
||||
}
|
||||
|
||||
public deletePet(petId: number, apiKey?: string, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.deletePet(petId, apiKey, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.deletePet(response);
|
||||
});
|
||||
}
|
||||
|
||||
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<Array<Pet>> {
|
||||
const requestContext = this.requestFactory.findPetsByStatus(status, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.findPetsByStatus(response);
|
||||
});
|
||||
}
|
||||
|
||||
public findPetsByTags(tags: Array<string>, options?: any): Promise<Array<Pet>> {
|
||||
const requestContext = this.requestFactory.findPetsByTags(tags, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.findPetsByTags(response);
|
||||
});
|
||||
}
|
||||
|
||||
public getPetById(petId: number, options?: any): Promise<Pet> {
|
||||
const requestContext = this.requestFactory.getPetById(petId, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.getPetById(response);
|
||||
});
|
||||
}
|
||||
|
||||
public updatePet(pet: Pet, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.updatePet(pet, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.updatePet(response);
|
||||
});
|
||||
}
|
||||
|
||||
public updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.updatePetWithForm(petId, name, status, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.updatePetWithForm(response);
|
||||
});
|
||||
}
|
||||
|
||||
public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<ApiResponse> {
|
||||
const requestContext = this.requestFactory.uploadFile(petId, additionalMetadata, file, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.uploadFile(response);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
import { StoreApiRequestFactory, StoreApiResponseProcessor} from "./apis/StoreApi";
|
||||
export class StoreApi {
|
||||
private requestFactory: StoreApiRequestFactory;
|
||||
private responseProcessor: StoreApiResponseProcessor;
|
||||
|
||||
public constructor(private configuration: Configuration) {
|
||||
this.requestFactory = new StoreApiRequestFactory(configuration);
|
||||
this.responseProcessor = new StoreApiResponseProcessor();
|
||||
}
|
||||
|
||||
public deleteOrder(orderId: string, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.deleteOrder(orderId, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.deleteOrder(response);
|
||||
});
|
||||
}
|
||||
|
||||
public getInventory(options?: any): Promise<{ [key: string]: number; }> {
|
||||
const requestContext = this.requestFactory.getInventory(options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.getInventory(response);
|
||||
});
|
||||
}
|
||||
|
||||
public getOrderById(orderId: number, options?: any): Promise<Order> {
|
||||
const requestContext = this.requestFactory.getOrderById(orderId, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.getOrderById(response);
|
||||
});
|
||||
}
|
||||
|
||||
public placeOrder(order: Order, options?: any): Promise<Order> {
|
||||
const requestContext = this.requestFactory.placeOrder(order, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.placeOrder(response);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
import { UserApiRequestFactory, UserApiResponseProcessor} from "./apis/UserApi";
|
||||
export class UserApi {
|
||||
private requestFactory: UserApiRequestFactory;
|
||||
private responseProcessor: UserApiResponseProcessor;
|
||||
|
||||
public constructor(private configuration: Configuration) {
|
||||
this.requestFactory = new UserApiRequestFactory(configuration);
|
||||
this.responseProcessor = new UserApiResponseProcessor();
|
||||
}
|
||||
|
||||
public createUser(user: User, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.createUser(user, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.createUser(response);
|
||||
});
|
||||
}
|
||||
|
||||
public createUsersWithArrayInput(user: Array<User>, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.createUsersWithArrayInput(user, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.createUsersWithArrayInput(response);
|
||||
});
|
||||
}
|
||||
|
||||
public createUsersWithListInput(user: Array<User>, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.createUsersWithListInput(user, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.createUsersWithListInput(response);
|
||||
});
|
||||
}
|
||||
|
||||
public deleteUser(username: string, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.deleteUser(username, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.deleteUser(response);
|
||||
});
|
||||
}
|
||||
|
||||
public getUserByName(username: string, options?: any): Promise<User> {
|
||||
const requestContext = this.requestFactory.getUserByName(username, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.getUserByName(response);
|
||||
});
|
||||
}
|
||||
|
||||
public loginUser(username: string, password: string, options?: any): Promise<string> {
|
||||
const requestContext = this.requestFactory.loginUser(username, password, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.loginUser(response);
|
||||
});
|
||||
}
|
||||
|
||||
public logoutUser(options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.logoutUser(options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.logoutUser(response);
|
||||
});
|
||||
}
|
||||
|
||||
public updateUser(username: string, user: User, options?: any): Promise<void> {
|
||||
const requestContext = this.requestFactory.updateUser(username, user, options);
|
||||
|
||||
return this.configuration.httpApi.send(requestContext).then((response: ResponseContext) => {
|
||||
return this.responseProcessor.updateUser(response);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { BaseAPIRequestFactory } from './baseapi';
|
||||
import { RequestContext, ResponseContext } from '../http/http';
|
||||
import { ApiResponse } from '../models/ApiResponse';
|
||||
import { Pet } from '../models/Pet';
|
||||
export declare class PetApiRequestFactory extends BaseAPIRequestFactory {
|
||||
addPet(pet: Pet, options?: any): RequestContext;
|
||||
deletePet(petId: number, apiKey?: string, options?: any): RequestContext;
|
||||
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): RequestContext;
|
||||
findPetsByTags(tags: Array<string>, options?: any): RequestContext;
|
||||
getPetById(petId: number, options?: any): RequestContext;
|
||||
updatePet(pet: Pet, options?: any): RequestContext;
|
||||
updatePetWithForm(petId: number, name?: string, status?: string, options?: any): RequestContext;
|
||||
uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): RequestContext;
|
||||
}
|
||||
export declare class PetApiResponseProcessor {
|
||||
addPet(response: ResponseContext): void;
|
||||
deletePet(response: ResponseContext): void;
|
||||
findPetsByStatus(response: ResponseContext): Array<Pet>;
|
||||
findPetsByTags(response: ResponseContext): Array<Pet>;
|
||||
getPetById(response: ResponseContext): Pet;
|
||||
updatePet(response: ResponseContext): void;
|
||||
updatePetWithForm(response: ResponseContext): void;
|
||||
uploadFile(response: ResponseContext): ApiResponse;
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var baseapi_1 = require("./baseapi");
|
||||
var http_1 = require("../http/http");
|
||||
var FormData = require("form-data");
|
||||
var ObjectSerializer_1 = require("../models/ObjectSerializer");
|
||||
var PetApiRequestFactory = (function (_super) {
|
||||
__extends(PetApiRequestFactory, _super);
|
||||
function PetApiRequestFactory() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
PetApiRequestFactory.prototype.addPet = function (pet, options) {
|
||||
if (pet === null || pet === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter pet was null or undefined when calling addPet.');
|
||||
}
|
||||
var localVarPath = '/pet';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("Pet" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(pet || {}) : (pet.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.deletePet = function (petId, apiKey, options) {
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter petId was null or undefined when calling deletePet.');
|
||||
}
|
||||
var localVarPath = '/pet/{petId}'
|
||||
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
|
||||
requestContext.setHeaderParam("", ObjectSerializer_1.ObjectSerializer.serialize(apiKey, "string"));
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.findPetsByStatus = function (status, options) {
|
||||
if (status === null || status === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter status was null or undefined when calling findPetsByStatus.');
|
||||
}
|
||||
var localVarPath = '/pet/findByStatus';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
if (status !== undefined) {
|
||||
requestContext.setQueryParam("", ObjectSerializer_1.ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>"));
|
||||
}
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.findPetsByTags = function (tags, options) {
|
||||
if (tags === null || tags === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter tags was null or undefined when calling findPetsByTags.');
|
||||
}
|
||||
var localVarPath = '/pet/findByTags';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
if (tags !== undefined) {
|
||||
requestContext.setQueryParam("", ObjectSerializer_1.ObjectSerializer.serialize(tags, "Array<string>"));
|
||||
}
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.getPetById = function (petId, options) {
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter petId was null or undefined when calling getPetById.');
|
||||
}
|
||||
var localVarPath = '/pet/{petId}'
|
||||
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["api_key"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.updatePet = function (pet, options) {
|
||||
if (pet === null || pet === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter pet was null or undefined when calling updatePet.');
|
||||
}
|
||||
var localVarPath = '/pet';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("Pet" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(pet || {}) : (pet.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.updatePetWithForm = function (petId, name, status, options) {
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter petId was null or undefined when calling updatePetWithForm.');
|
||||
}
|
||||
var localVarPath = '/pet/{petId}'
|
||||
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
var localVarFormParams = new FormData();
|
||||
if (name !== undefined) {
|
||||
localVarFormParams.append('name', name);
|
||||
}
|
||||
if (status !== undefined) {
|
||||
localVarFormParams.append('status', status);
|
||||
}
|
||||
requestContext.setBody(localVarFormParams);
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
PetApiRequestFactory.prototype.uploadFile = function (petId, additionalMetadata, file, options) {
|
||||
if (petId === null || petId === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter petId was null or undefined when calling uploadFile.');
|
||||
}
|
||||
var localVarPath = '/pet/{petId}/uploadImage'
|
||||
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
var localVarFormParams = new FormData();
|
||||
if (additionalMetadata !== undefined) {
|
||||
localVarFormParams.append('additionalMetadata', additionalMetadata);
|
||||
}
|
||||
if (file !== undefined) {
|
||||
localVarFormParams.append('file', file);
|
||||
}
|
||||
requestContext.setBody(localVarFormParams);
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["petstore_auth"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
return PetApiRequestFactory;
|
||||
}(baseapi_1.BaseAPIRequestFactory));
|
||||
exports.PetApiRequestFactory = PetApiRequestFactory;
|
||||
var PetApiResponseProcessor = (function () {
|
||||
function PetApiResponseProcessor() {
|
||||
}
|
||||
PetApiResponseProcessor.prototype.addPet = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.deletePet = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.findPetsByStatus = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "Array<Pet>");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.findPetsByTags = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "Array<Pet>");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.getPetById = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "Pet");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.updatePet = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.updatePetWithForm = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
PetApiResponseProcessor.prototype.uploadFile = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "ApiResponse");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
return PetApiResponseProcessor;
|
||||
}());
|
||||
exports.PetApiResponseProcessor = PetApiResponseProcessor;
|
||||
//# sourceMappingURL=PetApi.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,17 +0,0 @@
|
||||
import { BaseAPIRequestFactory } from './baseapi';
|
||||
import { RequestContext, ResponseContext } from '../http/http';
|
||||
import { Order } from '../models/Order';
|
||||
export declare class StoreApiRequestFactory extends BaseAPIRequestFactory {
|
||||
deleteOrder(orderId: string, options?: any): RequestContext;
|
||||
getInventory(options?: any): RequestContext;
|
||||
getOrderById(orderId: number, options?: any): RequestContext;
|
||||
placeOrder(order: Order, options?: any): RequestContext;
|
||||
}
|
||||
export declare class StoreApiResponseProcessor {
|
||||
deleteOrder(response: ResponseContext): void;
|
||||
getInventory(response: ResponseContext): {
|
||||
[key: string]: number;
|
||||
};
|
||||
getOrderById(response: ResponseContext): Order;
|
||||
placeOrder(response: ResponseContext): Order;
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var baseapi_1 = require("./baseapi");
|
||||
var http_1 = require("../http/http");
|
||||
var ObjectSerializer_1 = require("../models/ObjectSerializer");
|
||||
var StoreApiRequestFactory = (function (_super) {
|
||||
__extends(StoreApiRequestFactory, _super);
|
||||
function StoreApiRequestFactory() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
StoreApiRequestFactory.prototype.deleteOrder = function (orderId, options) {
|
||||
if (orderId === null || orderId === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter orderId was null or undefined when calling deleteOrder.');
|
||||
}
|
||||
var localVarPath = '/store/order/{orderId}'
|
||||
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
|
||||
return requestContext;
|
||||
};
|
||||
StoreApiRequestFactory.prototype.getInventory = function (options) {
|
||||
var localVarPath = '/store/inventory';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
var authMethod = null;
|
||||
authMethod = this.configuration.authMethods["api_key"];
|
||||
if (authMethod) {
|
||||
authMethod.applySecurityAuthentication(requestContext);
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
StoreApiRequestFactory.prototype.getOrderById = function (orderId, options) {
|
||||
if (orderId === null || orderId === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter orderId was null or undefined when calling getOrderById.');
|
||||
}
|
||||
var localVarPath = '/store/order/{orderId}'
|
||||
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
return requestContext;
|
||||
};
|
||||
StoreApiRequestFactory.prototype.placeOrder = function (order, options) {
|
||||
if (order === null || order === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter order was null or undefined when calling placeOrder.');
|
||||
}
|
||||
var localVarPath = '/store/order';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("Order" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(order || {}) : (order.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
return requestContext;
|
||||
};
|
||||
return StoreApiRequestFactory;
|
||||
}(baseapi_1.BaseAPIRequestFactory));
|
||||
exports.StoreApiRequestFactory = StoreApiRequestFactory;
|
||||
var StoreApiResponseProcessor = (function () {
|
||||
function StoreApiResponseProcessor() {
|
||||
}
|
||||
StoreApiResponseProcessor.prototype.deleteOrder = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
StoreApiResponseProcessor.prototype.getInventory = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "{ [key: string]: number; }");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
StoreApiResponseProcessor.prototype.getOrderById = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "Order");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
StoreApiResponseProcessor.prototype.placeOrder = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "Order");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
return StoreApiResponseProcessor;
|
||||
}());
|
||||
exports.StoreApiResponseProcessor = StoreApiResponseProcessor;
|
||||
//# sourceMappingURL=StoreApi.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"StoreApi.js","sourceRoot":"","sources":["../../apis/StoreApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,qCAAiE;AACjE,qCAA0E;AAE1E,+DAA4D;AAG5D;IAA4C,0CAAqB;IAAjE;;IAuHA,CAAC;IApHU,4CAAW,GAAlB,UAAmB,OAAe,EAAE,OAAa;QAE7C,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE;YAC3C,MAAM,IAAI,uBAAa,CAAC,4EAA4E,CAAC,CAAC;SACzG;QAIJ,IAAM,YAAY,GAAG,wBAAwB;aACrC,OAAO,CAAC,GAAG,GAAG,SAAS,GAAG,GAAG,EAAE,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAG5E,IAAM,cAAc,GAAG,IAA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ACrB,OAAO,IAAI,CAAC;SACN;aAAM;YAEN,MAAM,IAAI,CAAA;SACV;IACL,CAAC;IAMM,gDAAY,GAAnB,UAAoB,QAAyB;QAC5C,IAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,cAAc,IAAI,GAAG,IAAI,QAAQ,CAAC,cAAc,IAAI,GAAG,CAAC;QAC5G,IAAM,IAAI,GAAU,mCAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;QAClF,IAAI,UAAU,EAAE;YACrB,OAAO,IAAI,CAAC;SACN;aAAM;YAEN,MAAM,IAAI,CAAA;SACV;IACL,CAAC;IAMM,8CAAU,GAAjB,UAAkB,QAAyB;QAC1C,IAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,cAAc,IAAI,GAAG,IAAI,QAAQ,CAAC,cAAc,IAAI,GAAG,CAAC;QAC5G,IAAM,IAAI,GAAU,mCAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;QAClF,IAAI,UAAU,EAAE;YACrB,OAAO,IAAI,CAAC;SACN;aAAM;YAEN,MAAM,IAAI,CAAA;SACV;IACL,CAAC;IAEL,gCAAC;AAAD,CAAC,AA3DD,IA2DC;AA3DY,8DAAyB"}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { BaseAPIRequestFactory } from './baseapi';
|
||||
import { RequestContext, ResponseContext } from '../http/http';
|
||||
import { User } from '../models/User';
|
||||
export declare class UserApiRequestFactory extends BaseAPIRequestFactory {
|
||||
createUser(user: User, options?: any): RequestContext;
|
||||
createUsersWithArrayInput(user: Array<User>, options?: any): RequestContext;
|
||||
createUsersWithListInput(user: Array<User>, options?: any): RequestContext;
|
||||
deleteUser(username: string, options?: any): RequestContext;
|
||||
getUserByName(username: string, options?: any): RequestContext;
|
||||
loginUser(username: string, password: string, options?: any): RequestContext;
|
||||
logoutUser(options?: any): RequestContext;
|
||||
updateUser(username: string, user: User, options?: any): RequestContext;
|
||||
}
|
||||
export declare class UserApiResponseProcessor {
|
||||
createUser(response: ResponseContext): void;
|
||||
createUsersWithArrayInput(response: ResponseContext): void;
|
||||
createUsersWithListInput(response: ResponseContext): void;
|
||||
deleteUser(response: ResponseContext): void;
|
||||
getUserByName(response: ResponseContext): User;
|
||||
loginUser(response: ResponseContext): string;
|
||||
logoutUser(response: ResponseContext): void;
|
||||
updateUser(response: ResponseContext): void;
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var baseapi_1 = require("./baseapi");
|
||||
var http_1 = require("../http/http");
|
||||
var ObjectSerializer_1 = require("../models/ObjectSerializer");
|
||||
var UserApiRequestFactory = (function (_super) {
|
||||
__extends(UserApiRequestFactory, _super);
|
||||
function UserApiRequestFactory() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
UserApiRequestFactory.prototype.createUser = function (user, options) {
|
||||
if (user === null || user === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter user was null or undefined when calling createUser.');
|
||||
}
|
||||
var localVarPath = '/user';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("User" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.createUsersWithArrayInput = function (user, options) {
|
||||
if (user === null || user === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
|
||||
}
|
||||
var localVarPath = '/user/createWithArray';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("Array<User>" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.createUsersWithListInput = function (user, options) {
|
||||
if (user === null || user === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.');
|
||||
}
|
||||
var localVarPath = '/user/createWithList';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("Array<User>" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.deleteUser = function (username, options) {
|
||||
if (username === null || username === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter username was null or undefined when calling deleteUser.');
|
||||
}
|
||||
var localVarPath = '/user/{username}'
|
||||
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.getUserByName = function (username, options) {
|
||||
if (username === null || username === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter username was null or undefined when calling getUserByName.');
|
||||
}
|
||||
var localVarPath = '/user/{username}'
|
||||
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.loginUser = function (username, password, options) {
|
||||
if (username === null || username === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter username was null or undefined when calling loginUser.');
|
||||
}
|
||||
if (password === null || password === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter password was null or undefined when calling loginUser.');
|
||||
}
|
||||
var localVarPath = '/user/login';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
if (username !== undefined) {
|
||||
requestContext.setQueryParam("", ObjectSerializer_1.ObjectSerializer.serialize(username, "string"));
|
||||
}
|
||||
if (password !== undefined) {
|
||||
requestContext.setQueryParam("", ObjectSerializer_1.ObjectSerializer.serialize(password, "string"));
|
||||
}
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.logoutUser = function (options) {
|
||||
var localVarPath = '/user/logout';
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
|
||||
return requestContext;
|
||||
};
|
||||
UserApiRequestFactory.prototype.updateUser = function (username, user, options) {
|
||||
if (username === null || username === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter username was null or undefined when calling updateUser.');
|
||||
}
|
||||
if (user === null || user === undefined) {
|
||||
throw new baseapi_1.RequiredError('Required parameter user was null or undefined when calling updateUser.');
|
||||
}
|
||||
var localVarPath = '/user/{username}'
|
||||
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
|
||||
var requestContext = this.configuration.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
|
||||
requestContext.setHeaderParam("Content-Type", "application/json");
|
||||
var needsSerialization = ("User" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
|
||||
var serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || "");
|
||||
requestContext.setBody(serializedBody);
|
||||
return requestContext;
|
||||
};
|
||||
return UserApiRequestFactory;
|
||||
}(baseapi_1.BaseAPIRequestFactory));
|
||||
exports.UserApiRequestFactory = UserApiRequestFactory;
|
||||
var UserApiResponseProcessor = (function () {
|
||||
function UserApiResponseProcessor() {
|
||||
}
|
||||
UserApiResponseProcessor.prototype.createUser = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.createUsersWithArrayInput = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.createUsersWithListInput = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.deleteUser = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.getUserByName = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "User");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.loginUser = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
var body = ObjectSerializer_1.ObjectSerializer.deserialize(response.body, "string");
|
||||
if (responseOK) {
|
||||
return body;
|
||||
}
|
||||
else {
|
||||
throw body;
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.logoutUser = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
UserApiResponseProcessor.prototype.updateUser = function (response) {
|
||||
var responseOK = response.httpStatusCode && response.httpStatusCode >= 200 && response.httpStatusCode <= 299;
|
||||
if (!responseOK) {
|
||||
throw new Error("Invalid status code: " + response.httpStatusCode + "!");
|
||||
}
|
||||
};
|
||||
return UserApiResponseProcessor;
|
||||
}());
|
||||
exports.UserApiResponseProcessor = UserApiResponseProcessor;
|
||||
//# sourceMappingURL=UserApi.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,16 +0,0 @@
|
||||
import { Configuration } from '../configuration';
|
||||
export declare const COLLECTION_FORMATS: {
|
||||
csv: string;
|
||||
ssv: string;
|
||||
tsv: string;
|
||||
pipes: string;
|
||||
};
|
||||
export declare class BaseAPIRequestFactory {
|
||||
protected configuration: Configuration;
|
||||
constructor(configuration: Configuration);
|
||||
}
|
||||
export declare class RequiredError extends Error {
|
||||
field: string;
|
||||
name: "RequiredError";
|
||||
constructor(field: string, msg?: string);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
var BaseAPIRequestFactory = (function () {
|
||||
function BaseAPIRequestFactory(configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
return BaseAPIRequestFactory;
|
||||
}());
|
||||
exports.BaseAPIRequestFactory = BaseAPIRequestFactory;
|
||||
;
|
||||
var RequiredError = (function (_super) {
|
||||
__extends(RequiredError, _super);
|
||||
function RequiredError(field, msg) {
|
||||
var _this = _super.call(this, msg) || this;
|
||||
_this.field = field;
|
||||
_this.name = "RequiredError";
|
||||
return _this;
|
||||
}
|
||||
return RequiredError;
|
||||
}(Error));
|
||||
exports.RequiredError = RequiredError;
|
||||
//# sourceMappingURL=baseapi.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"baseapi.js","sourceRoot":"","sources":["../../apis/baseapi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMa,QAAA,kBAAkB,GAAG;IAC9B,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,GAAG;CACb,CAAC;AAQF;IAEI,+BAAsB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAClD,CAAC;IACL,4BAAC;AAAD,CAAC,AAJD,IAIC;AAJY,sDAAqB;AAIjC,CAAC;AAQF;IAAmC,iCAAK;IAEpC,uBAAmB,KAAa,EAAE,GAAY;QAA9C,YACI,kBAAM,GAAG,CAAC,SACb;QAFkB,WAAK,GAAL,KAAK,CAAQ;QADhC,UAAI,GAAoB,eAAe,CAAC;;IAGxC,CAAC;IACL,oBAAC;AAAD,CAAC,AALD,CAAmC,KAAK,GAKvC;AALY,sCAAa"}
|
||||
@@ -1,43 +0,0 @@
|
||||
import { RequestContext } from '../http/http';
|
||||
export declare abstract class SecurityAuthentication {
|
||||
private name;
|
||||
constructor(name: string);
|
||||
getName(): string;
|
||||
abstract applySecurityAuthentication(context: RequestContext): void;
|
||||
}
|
||||
export declare class NoAuthentication extends SecurityAuthentication {
|
||||
constructor();
|
||||
applySecurityAuthentication(_context: RequestContext): void;
|
||||
}
|
||||
export declare class APIKeyAuthentication extends SecurityAuthentication {
|
||||
private paramName;
|
||||
private keyLocation;
|
||||
private apiKey;
|
||||
constructor(authName: string, paramName: string, keyLocation: "query" | "header" | "cookie", apiKey: string);
|
||||
applySecurityAuthentication(context: RequestContext): void;
|
||||
}
|
||||
export declare class HttpBasicAuthentication extends SecurityAuthentication {
|
||||
private username;
|
||||
private password;
|
||||
constructor(authName: string, username: string, password: string);
|
||||
applySecurityAuthentication(context: RequestContext): void;
|
||||
}
|
||||
export declare class OAuth2Authentication extends SecurityAuthentication {
|
||||
constructor(authName: string);
|
||||
applySecurityAuthentication(context: RequestContext): void;
|
||||
}
|
||||
export declare type AuthMethods = {
|
||||
"api_key"?: APIKeyAuthentication;
|
||||
"petstore_auth"?: OAuth2Authentication;
|
||||
};
|
||||
export declare type ApiKeyConfiguration = string;
|
||||
export declare type HttpBasicConfiguration = {
|
||||
"username": string;
|
||||
"password": string;
|
||||
};
|
||||
export declare type OAuth2Configuration = string;
|
||||
export declare type AuthMethodsConfiguration = {
|
||||
"api_key"?: ApiKeyConfiguration;
|
||||
"petstore_auth"?: OAuth2Configuration;
|
||||
};
|
||||
export declare function configureAuthMethods(conf: AuthMethodsConfiguration | undefined): AuthMethods;
|
||||
@@ -1,99 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var btoa = require("btoa");
|
||||
var SecurityAuthentication = (function () {
|
||||
function SecurityAuthentication(name) {
|
||||
this.name = name;
|
||||
}
|
||||
SecurityAuthentication.prototype.getName = function () {
|
||||
return this.name;
|
||||
};
|
||||
return SecurityAuthentication;
|
||||
}());
|
||||
exports.SecurityAuthentication = SecurityAuthentication;
|
||||
var NoAuthentication = (function (_super) {
|
||||
__extends(NoAuthentication, _super);
|
||||
function NoAuthentication() {
|
||||
return _super.call(this, "_no_auth") || this;
|
||||
}
|
||||
NoAuthentication.prototype.applySecurityAuthentication = function (_context) {
|
||||
};
|
||||
return NoAuthentication;
|
||||
}(SecurityAuthentication));
|
||||
exports.NoAuthentication = NoAuthentication;
|
||||
var APIKeyAuthentication = (function (_super) {
|
||||
__extends(APIKeyAuthentication, _super);
|
||||
function APIKeyAuthentication(authName, paramName, keyLocation, apiKey) {
|
||||
var _this = _super.call(this, authName) || this;
|
||||
_this.paramName = paramName;
|
||||
_this.keyLocation = keyLocation;
|
||||
_this.apiKey = apiKey;
|
||||
return _this;
|
||||
}
|
||||
APIKeyAuthentication.prototype.applySecurityAuthentication = function (context) {
|
||||
if (this.keyLocation === "header") {
|
||||
context.setHeaderParam(this.paramName, this.apiKey);
|
||||
}
|
||||
else if (this.keyLocation === "cookie") {
|
||||
context.addCookie(this.paramName, this.apiKey);
|
||||
}
|
||||
else if (this.keyLocation === "query") {
|
||||
context.setQueryParam(this.paramName, this.apiKey);
|
||||
}
|
||||
};
|
||||
return APIKeyAuthentication;
|
||||
}(SecurityAuthentication));
|
||||
exports.APIKeyAuthentication = APIKeyAuthentication;
|
||||
var HttpBasicAuthentication = (function (_super) {
|
||||
__extends(HttpBasicAuthentication, _super);
|
||||
function HttpBasicAuthentication(authName, username, password) {
|
||||
var _this = _super.call(this, authName) || this;
|
||||
_this.username = username;
|
||||
_this.password = password;
|
||||
return _this;
|
||||
}
|
||||
HttpBasicAuthentication.prototype.applySecurityAuthentication = function (context) {
|
||||
var comb = this.username + ":" + this.password;
|
||||
context.setHeaderParam("Authentication", "Basic " + btoa(comb));
|
||||
};
|
||||
return HttpBasicAuthentication;
|
||||
}(SecurityAuthentication));
|
||||
exports.HttpBasicAuthentication = HttpBasicAuthentication;
|
||||
var OAuth2Authentication = (function (_super) {
|
||||
__extends(OAuth2Authentication, _super);
|
||||
function OAuth2Authentication(authName) {
|
||||
return _super.call(this, authName) || this;
|
||||
}
|
||||
OAuth2Authentication.prototype.applySecurityAuthentication = function (context) {
|
||||
};
|
||||
return OAuth2Authentication;
|
||||
}(SecurityAuthentication));
|
||||
exports.OAuth2Authentication = OAuth2Authentication;
|
||||
function configureAuthMethods(conf) {
|
||||
var authMethods = {};
|
||||
if (!conf) {
|
||||
return authMethods;
|
||||
}
|
||||
if (conf["api_key"]) {
|
||||
authMethods["api_key"] = new APIKeyAuthentication("api_key", "api_key", "header", conf["api_key"]);
|
||||
}
|
||||
if (conf["petstore_auth"]) {
|
||||
authMethods["petstore_auth"] = new OAuth2Authentication("petstore_auth");
|
||||
}
|
||||
return authMethods;
|
||||
}
|
||||
exports.configureAuthMethods = configureAuthMethods;
|
||||
//# sourceMappingURL=auth.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../auth/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,2BA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,kBAAM,QAAQ,CAAC,SACf;QAF4C,cAAQ,GAAR,QAAQ,CAAQ;QAAU,cAAQ,GAAR,QAAQ,CAAQ;;IAEvF,CAAC;IAEM,6DAA2B,GAAlC,UAAmC,OAAuB;QACzD,IAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/C,OAAO,CAAC,cAAc,CAAC,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;IACF,8BAAC;AAAD,CAAC,AAVD,CAA6C,sBAAsB,GAUlE;AAVY,0DAAuB;AAYpC;IAA0C,wCAAsB;IAC/D,8BAAmB,QAAgB;eAClC,kBAAM,QAAQ,CAAC;IAChB,CAAC;IAEM,0DAA2B,GAAlC,UAAmC,OAAuB;IAE1D,CAAC;IACF,2BAAC;AAAD,CAAC,AARD,CAA0C,sBAAsB,GAQ/D;AARY,oDAAoB;AAqBjC,SAAgB,oBAAoB,CAAC,IAA0C;IAC9E,IAAI,WAAW,GAAgB,EAC9B,CAAA;IAED,IAAI,CAAC,IAAI,EAAE;QACV,OAAO,WAAW,CAAC;KACnB;IAED,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE;QACpB,WAAW,CAAC,SAAS,CAAC,GAAG,IAAI,oBAAoB,CAAC,SAAS,EAAG,SAAS,EAAE,QAAQ,EAAW,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;KAC7G;IAED,IAAI,IAAI,CAAC,eAAe,CAAC,EAAE;QAC1B,WAAW,CAAC,eAAe,CAAC,GAAG,IAAI,oBAAoB,CAAC,eAAe,CAAC,CAAC;KACzE;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAjBD,oDAiBC"}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { HttpLibrary } from './http/http';
|
||||
import { Middleware } from './middleware';
|
||||
import { ServerConfiguration } from './servers';
|
||||
import { AuthMethods, AuthMethodsConfiguration } from './auth/auth';
|
||||
export interface ConfigurationParameters {
|
||||
baseServer?: ServerConfiguration;
|
||||
httpApi?: HttpLibrary;
|
||||
middleware?: Middleware[];
|
||||
authMethods?: AuthMethodsConfiguration;
|
||||
}
|
||||
export declare class Configuration {
|
||||
baseServer: ServerConfiguration;
|
||||
httpApi: HttpLibrary;
|
||||
middleware: Middleware[];
|
||||
authMethods: AuthMethods;
|
||||
constructor(conf?: ConfigurationParameters);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var isomorphic_fetch_1 = require("./http/isomorphic-fetch");
|
||||
var servers_1 = require("./servers");
|
||||
var auth_1 = require("./auth/auth");
|
||||
var Configuration = (function () {
|
||||
function Configuration(conf) {
|
||||
if (conf === void 0) { conf = {}; }
|
||||
this.baseServer = conf.baseServer !== undefined ? conf.baseServer : servers_1.servers[0];
|
||||
this.httpApi = conf.httpApi || new isomorphic_fetch_1.IsomorphicFetchHttpLibrary();
|
||||
this.middleware = conf.middleware || [];
|
||||
this.authMethods = auth_1.configureAuthMethods(conf.authMethods);
|
||||
}
|
||||
return Configuration;
|
||||
}());
|
||||
exports.Configuration = Configuration;
|
||||
//# sourceMappingURL=configuration.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../configuration.ts"],"names":[],"mappings":";;AAEA,4DAAmE;AACnE,qCAAuD;AACvD,oCAAwF;AAUxF;IAOI,uBAAY,IAAkC;QAAlC,qBAAA,EAAA,SAAkC;QAC1C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAO,CAAC,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,6CAA0B,EAAE,CAAC;QAChE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;QAC9C,IAAI,CAAC,WAAW,GAAG,2BAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IACL,oBAAC;AAAD,CAAC,AAbD,IAaC;AAbY,sCAAa"}
|
||||
@@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=api.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../fetch/api.ts"],"names":[],"mappings":""}
|
||||
@@ -1,50 +0,0 @@
|
||||
import * as FormData from "form-data";
|
||||
export declare enum HttpMethod {
|
||||
GET = "GET",
|
||||
HEAD = "HEAD",
|
||||
POST = "POST",
|
||||
PUT = "PUT",
|
||||
DELETE = "DELETE",
|
||||
CONNECT = "CONNECT",
|
||||
OPTIONS = "OPTIONS",
|
||||
TRACE = "TRACE",
|
||||
PATCH = "PATCH"
|
||||
}
|
||||
export interface FormEntry {
|
||||
contentDisposition: string;
|
||||
value: string | Blob;
|
||||
}
|
||||
export declare class HttpException extends Error {
|
||||
constructor(msg: string);
|
||||
}
|
||||
export declare class RequestContext {
|
||||
private httpMethod;
|
||||
private headers;
|
||||
private body;
|
||||
private url;
|
||||
constructor(url: string, httpMethod: HttpMethod);
|
||||
getUrl(): string;
|
||||
setUrl(url: string): void;
|
||||
setBody(body: string | FormData): void;
|
||||
getHttpMethod(): HttpMethod;
|
||||
getHeaders(): {
|
||||
[key: string]: string;
|
||||
};
|
||||
getBody(): string | FormData;
|
||||
setQueryParam(name: string, value: string): void;
|
||||
addCookie(name: string, value: string): void;
|
||||
setHeaderParam(key: string, value: string): void;
|
||||
}
|
||||
export declare class ResponseContext {
|
||||
httpStatusCode: number;
|
||||
headers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
body: string;
|
||||
constructor(httpStatusCode: number, headers: {
|
||||
[key: string]: string;
|
||||
}, body: string);
|
||||
}
|
||||
export interface HttpLibrary {
|
||||
send(request: RequestContext): Promise<ResponseContext>;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var URLParse = require("url-parse");
|
||||
var HttpMethod;
|
||||
(function (HttpMethod) {
|
||||
HttpMethod["GET"] = "GET";
|
||||
HttpMethod["HEAD"] = "HEAD";
|
||||
HttpMethod["POST"] = "POST";
|
||||
HttpMethod["PUT"] = "PUT";
|
||||
HttpMethod["DELETE"] = "DELETE";
|
||||
HttpMethod["CONNECT"] = "CONNECT";
|
||||
HttpMethod["OPTIONS"] = "OPTIONS";
|
||||
HttpMethod["TRACE"] = "TRACE";
|
||||
HttpMethod["PATCH"] = "PATCH";
|
||||
})(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {}));
|
||||
var HttpException = (function (_super) {
|
||||
__extends(HttpException, _super);
|
||||
function HttpException(msg) {
|
||||
return _super.call(this, msg) || this;
|
||||
}
|
||||
return HttpException;
|
||||
}(Error));
|
||||
exports.HttpException = HttpException;
|
||||
var RequestContext = (function () {
|
||||
function RequestContext(url, httpMethod) {
|
||||
this.httpMethod = httpMethod;
|
||||
this.headers = {};
|
||||
this.body = "";
|
||||
this.url = URLParse(url, true);
|
||||
}
|
||||
RequestContext.prototype.getUrl = function () {
|
||||
return this.url.toString();
|
||||
};
|
||||
RequestContext.prototype.setUrl = function (url) {
|
||||
this.url = URLParse(url, true);
|
||||
};
|
||||
RequestContext.prototype.setBody = function (body) {
|
||||
if (this.httpMethod === HttpMethod.GET) {
|
||||
throw new HttpException("Body should not be included in GET-Requests!");
|
||||
}
|
||||
this.body = body;
|
||||
};
|
||||
RequestContext.prototype.getHttpMethod = function () {
|
||||
return this.httpMethod;
|
||||
};
|
||||
RequestContext.prototype.getHeaders = function () {
|
||||
return this.headers;
|
||||
};
|
||||
RequestContext.prototype.getBody = function () {
|
||||
return this.body;
|
||||
};
|
||||
RequestContext.prototype.setQueryParam = function (name, value) {
|
||||
var queryObj = this.url.query;
|
||||
queryObj[name] = value;
|
||||
this.url.set("query", queryObj);
|
||||
};
|
||||
RequestContext.prototype.addCookie = function (name, value) {
|
||||
if (!this.headers["Cookie"]) {
|
||||
this.headers["Cookie"] = "";
|
||||
}
|
||||
this.headers["Cookie"] += name + "=" + value + "; ";
|
||||
};
|
||||
RequestContext.prototype.setHeaderParam = function (key, value) {
|
||||
this.headers[key] = value;
|
||||
};
|
||||
return RequestContext;
|
||||
}());
|
||||
exports.RequestContext = RequestContext;
|
||||
var ResponseContext = (function () {
|
||||
function ResponseContext(httpStatusCode, headers, body) {
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
this.headers = headers;
|
||||
this.body = body;
|
||||
}
|
||||
return ResponseContext;
|
||||
}());
|
||||
exports.ResponseContext = ResponseContext;
|
||||
//# sourceMappingURL=http.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../http/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA,oCAAsC;AAEtC,IAAY,UAUX;AAVD,WAAY,UAAU;IAClB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,6BAAe,CAAA;IACf,6BAAe,CAAA;AACnB,CAAC,EAVW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAUrB;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B,UAAiB,IAAY,EAAE,KAAa;QACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;SAC/B;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,GAAG,GAAG,KAAK,GAAG,IAAI,CAAC;IACxD,CAAC;IAEM,uCAAc,GAArB,UAAsB,GAAW,EAAE,KAAa;QAC5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC9B,CAAC;IACL,qBAAC;AAAD,CAAC,AA3DD,IA2DC;AA3DY,wCAAc;AA6D3B;IAEI,yBAA0B,cAAsB,EACrC,OAAkC,EAAS,IAAY;QADxC,mBAAc,GAAd,cAAc,CAAQ;QACrC,YAAO,GAAP,OAAO,CAA2B;QAAS,SAAI,GAAJ,IAAI,CAAQ;IAClE,CAAC;IAEL,sBAAC;AAAD,CAAC,AAND,IAMC;AANY,0CAAe"}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { HttpLibrary, RequestContext, ResponseContext } from './http';
|
||||
import 'isomorphic-fetch';
|
||||
export declare class IsomorphicFetchHttpLibrary implements HttpLibrary {
|
||||
send(request: RequestContext): Promise<ResponseContext>;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var http_1 = require("./http");
|
||||
var e6p = require("es6-promise");
|
||||
e6p.polyfill();
|
||||
require("isomorphic-fetch");
|
||||
var IsomorphicFetchHttpLibrary = (function () {
|
||||
function IsomorphicFetchHttpLibrary() {
|
||||
}
|
||||
IsomorphicFetchHttpLibrary.prototype.send = function (request) {
|
||||
var method = request.getHttpMethod().toString();
|
||||
var body = request.getBody();
|
||||
return fetch(request.getUrl(), {
|
||||
method: method,
|
||||
body: body,
|
||||
headers: request.getHeaders(),
|
||||
credentials: "same-origin"
|
||||
}).then(function (resp) {
|
||||
var headers = resp.headers._headers;
|
||||
for (var key in headers) {
|
||||
headers[key] = headers[key].join("; ");
|
||||
}
|
||||
return resp.text().then(function (body) {
|
||||
return new http_1.ResponseContext(resp.status, headers, body);
|
||||
});
|
||||
});
|
||||
};
|
||||
return IsomorphicFetchHttpLibrary;
|
||||
}());
|
||||
exports.IsomorphicFetchHttpLibrary = IsomorphicFetchHttpLibrary;
|
||||
//# sourceMappingURL=isomorphic-fetch.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"isomorphic-fetch.js","sourceRoot":"","sources":["../../http/isomorphic-fetch.ts"],"names":[],"mappings":";;AAAA,+BAAoE;AACpE,iCAAkC;AAClC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACf,4BAA0B;AAE1B;IAAA;IAwBA,CAAC;IAtBU,yCAAI,GAAX,UAAY,OAAuB;QAC/B,IAAI,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC;QAChD,IAAI,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAE7B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE;YAC3B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAW;YACjB,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;YAC7B,WAAW,EAAE,aAAa;SAC7B,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YAET,IAAI,OAAO,GAAI,IAAI,CAAC,OAAe,CAAC,QAAQ,CAAC;YAC7C,KAAK,IAAI,GAAG,IAAI,OAAO,EAAE;gBACrB,OAAO,CAAC,GAAG,CAAC,GAAI,OAAO,CAAC,GAAG,CAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC7D;YAED,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,UAAC,IAAI;gBACzB,OAAO,IAAI,sBAAe,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;YAC1D,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IAEP,CAAC;IACL,iCAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,gEAA0B"}
|
||||
@@ -1,6 +0,0 @@
|
||||
export * from './configuration';
|
||||
export * from './http/http';
|
||||
export * from './auth/auth';
|
||||
export * from './middleware';
|
||||
export * from './servers';
|
||||
export * from './http/isomorphic-fetch';
|
||||
@@ -1,11 +0,0 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./configuration"));
|
||||
__export(require("./http/http"));
|
||||
__export(require("./auth/auth"));
|
||||
__export(require("./servers"));
|
||||
__export(require("./http/isomorphic-fetch"));
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AAAA,qCAA+B;AAC/B,iCAA4B;AAC5B,iCAA4B;AAE5B,+BAA0B;AAI1B,6CAAwC"}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { RequestContext, ResponseContext } from './http/http';
|
||||
export interface Middleware {
|
||||
pre?(context: RequestContext): Promise<RequestContext>;
|
||||
post?(context: ResponseContext): Promise<ResponseContext>;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=middleware.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../middleware.ts"],"names":[],"mappings":""}
|
||||
@@ -1,16 +0,0 @@
|
||||
export declare class ApiResponse {
|
||||
'code'?: number;
|
||||
'type'?: string;
|
||||
'message'?: string;
|
||||
static discriminator: string | undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}>;
|
||||
static getAttributeTypeMap(): {
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var ApiResponse = (function () {
|
||||
function ApiResponse() {
|
||||
}
|
||||
ApiResponse.getAttributeTypeMap = function () {
|
||||
return ApiResponse.attributeTypeMap;
|
||||
};
|
||||
ApiResponse.discriminator = undefined;
|
||||
ApiResponse.attributeTypeMap = [
|
||||
{
|
||||
"name": "code",
|
||||
"baseName": "code",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"baseName": "type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"baseName": "message",
|
||||
"type": "string"
|
||||
}
|
||||
];
|
||||
return ApiResponse;
|
||||
}());
|
||||
exports.ApiResponse = ApiResponse;
|
||||
//# sourceMappingURL=ApiResponse.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ApiResponse.js","sourceRoot":"","sources":["../../models/ApiResponse.ts"],"names":[],"mappings":";;AAOA;IAAA;IA2BA,CAAC;IAHU,+BAAmB,GAA1B;QACI,OAAO,WAAW,CAAC,gBAAgB,CAAC;IACxC,CAAC;IArBM,yBAAa,GAAuB,SAAS,CAAC;IAE9C,4BAAgB,GAA0D;QAC7E;YACI,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,QAAQ;SACnB;KAAK,CAAC;IAKf,kBAAC;CAAA,AA3BD,IA2BC;AA3BY,kCAAW"}
|
||||
@@ -1,15 +0,0 @@
|
||||
export declare class Category {
|
||||
'id'?: number;
|
||||
'name'?: string;
|
||||
static discriminator: string | undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}>;
|
||||
static getAttributeTypeMap(): {
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Category = (function () {
|
||||
function Category() {
|
||||
}
|
||||
Category.getAttributeTypeMap = function () {
|
||||
return Category.attributeTypeMap;
|
||||
};
|
||||
Category.discriminator = undefined;
|
||||
Category.attributeTypeMap = [
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
}
|
||||
];
|
||||
return Category;
|
||||
}());
|
||||
exports.Category = Category;
|
||||
//# sourceMappingURL=Category.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../models/Category.ts"],"names":[],"mappings":";;AAOA;IAAA;IAqBA,CAAC;IAHU,4BAAmB,GAA1B;QACI,OAAO,QAAQ,CAAC,gBAAgB,CAAC;IACrC,CAAC;IAhBM,sBAAa,GAAuB,SAAS,CAAC;IAE9C,yBAAgB,GAA0D;QAC7E;YACI,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,QAAQ;SACnB;KAAK,CAAC;IAKf,eAAC;CAAA,AArBD,IAqBC;AArBY,4BAAQ"}
|
||||
@@ -1,11 +0,0 @@
|
||||
export * from './ApiResponse';
|
||||
export * from './Category';
|
||||
export * from './Order';
|
||||
export * from './Pet';
|
||||
export * from './Tag';
|
||||
export * from './User';
|
||||
export declare class ObjectSerializer {
|
||||
static findCorrectType(data: any, expectedType: string): any;
|
||||
static serialize(data: any, type: string): any;
|
||||
static deserialize(data: any, type: string): any;
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./ApiResponse"));
|
||||
__export(require("./Category"));
|
||||
__export(require("./Order"));
|
||||
__export(require("./Pet"));
|
||||
__export(require("./Tag"));
|
||||
__export(require("./User"));
|
||||
var ApiResponse_1 = require("./ApiResponse");
|
||||
var Category_1 = require("./Category");
|
||||
var Order_1 = require("./Order");
|
||||
var Pet_1 = require("./Pet");
|
||||
var Tag_1 = require("./Tag");
|
||||
var User_1 = require("./User");
|
||||
var primitives = [
|
||||
"string",
|
||||
"boolean",
|
||||
"double",
|
||||
"integer",
|
||||
"long",
|
||||
"float",
|
||||
"number",
|
||||
"any"
|
||||
];
|
||||
var enumsMap = {
|
||||
"Order.StatusEnum": Order_1.Order.StatusEnum,
|
||||
"Pet.StatusEnum": Pet_1.Pet.StatusEnum,
|
||||
};
|
||||
var typeMap = {
|
||||
"ApiResponse": ApiResponse_1.ApiResponse,
|
||||
"Category": Category_1.Category,
|
||||
"Order": Order_1.Order,
|
||||
"Pet": Pet_1.Pet,
|
||||
"Tag": Tag_1.Tag,
|
||||
"User": User_1.User,
|
||||
};
|
||||
var ObjectSerializer = (function () {
|
||||
function ObjectSerializer() {
|
||||
}
|
||||
ObjectSerializer.findCorrectType = function (data, expectedType) {
|
||||
if (data == undefined) {
|
||||
return expectedType;
|
||||
}
|
||||
else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
|
||||
return expectedType;
|
||||
}
|
||||
else if (expectedType === "Date") {
|
||||
return expectedType;
|
||||
}
|
||||
else {
|
||||
if (enumsMap[expectedType]) {
|
||||
return expectedType;
|
||||
}
|
||||
if (!typeMap[expectedType]) {
|
||||
return expectedType;
|
||||
}
|
||||
var discriminatorProperty = typeMap[expectedType].discriminator;
|
||||
if (discriminatorProperty == null) {
|
||||
return expectedType;
|
||||
}
|
||||
else {
|
||||
if (data[discriminatorProperty]) {
|
||||
var discriminatorType = data[discriminatorProperty];
|
||||
if (typeMap[discriminatorType]) {
|
||||
return discriminatorType;
|
||||
}
|
||||
else {
|
||||
return expectedType;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return expectedType;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
ObjectSerializer.serialize = function (data, type) {
|
||||
if (data == undefined) {
|
||||
return data;
|
||||
}
|
||||
else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
||||
return data;
|
||||
}
|
||||
else if (type.lastIndexOf("Array<", 0) === 0) {
|
||||
var subType = type.replace("Array<", "");
|
||||
subType = subType.substring(0, subType.length - 1);
|
||||
var transformedData = [];
|
||||
for (var index in data) {
|
||||
var date = data[index];
|
||||
transformedData.push(ObjectSerializer.serialize(date, subType));
|
||||
}
|
||||
return transformedData;
|
||||
}
|
||||
else if (type === "Date") {
|
||||
return data.toISOString();
|
||||
}
|
||||
else {
|
||||
if (enumsMap[type]) {
|
||||
return data;
|
||||
}
|
||||
if (!typeMap[type]) {
|
||||
return data;
|
||||
}
|
||||
type = this.findCorrectType(data, type);
|
||||
var attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
var instance = {};
|
||||
for (var index in attributeTypes) {
|
||||
var attributeType = attributeTypes[index];
|
||||
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
};
|
||||
ObjectSerializer.deserialize = function (data, type) {
|
||||
type = ObjectSerializer.findCorrectType(data, type);
|
||||
if (data == undefined) {
|
||||
return data;
|
||||
}
|
||||
else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
||||
return data;
|
||||
}
|
||||
else if (type.lastIndexOf("Array<", 0) === 0) {
|
||||
var subType = type.replace("Array<", "");
|
||||
subType = subType.substring(0, subType.length - 1);
|
||||
var transformedData = [];
|
||||
for (var index in data) {
|
||||
var date = data[index];
|
||||
transformedData.push(ObjectSerializer.deserialize(date, subType));
|
||||
}
|
||||
return transformedData;
|
||||
}
|
||||
else if (type === "Date") {
|
||||
return new Date(data);
|
||||
}
|
||||
else {
|
||||
if (enumsMap[type]) {
|
||||
return data;
|
||||
}
|
||||
if (!typeMap[type]) {
|
||||
return data;
|
||||
}
|
||||
var instance = new typeMap[type]();
|
||||
var attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
for (var index in attributeTypes) {
|
||||
var attributeType = attributeTypes[index];
|
||||
instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
};
|
||||
return ObjectSerializer;
|
||||
}());
|
||||
exports.ObjectSerializer = ObjectSerializer;
|
||||
//# sourceMappingURL=ObjectSerializer.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ObjectSerializer.js","sourceRoot":"","sources":["../../models/ObjectSerializer.ts"],"names":[],"mappings":";;;;;AAAA,mCAA8B;AAC9B,gCAA2B;AAC3B,6BAAwB;AACxB,2BAAsB;AACtB,2BAAsB;AACtB,4BAAuB;AAEvB,6CAA4C;AAC5C,uCAAsC;AACtC,iCAAgC;AAChC,6BAA4B;AAC5B,6BAA4B;AAC5B,+BAA8B;AAG9B,IAAI,UAAU,GAAG;IACG,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;CACP,CAAC;AAEnB,IAAI,QAAQ,GAA2B;IAC/B,kBAAkB,EAAE,aAAK,CAAC,UAAU;IACpC,gBAAgB,EAAE,SAAG,CAAC,UAAU;CACvC,CAAA;AAED,IAAI,OAAO,GAA2B;IAClC,aAAa,EAAE,yBAAW;IAC1B,UAAU,EAAE,mBAAQ;IACp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mBAAmB,EAAE,CAAC;YACzD,KAAK,IAAI,KAAK,IAAI,cAAc,EAAE;gBAC9B,IAAI,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC1C,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aACjH;YACD,OAAO,QAAQ,CAAC;SACnB;IACL,CAAC;IACL,uBAAC;AAAD,CAAC,AA7GD,IA6GC;AA7GY,4CAAgB"}
|
||||
@@ -1,26 +0,0 @@
|
||||
export declare class Order {
|
||||
'id'?: number;
|
||||
'petId'?: number;
|
||||
'quantity'?: number;
|
||||
'shipDate'?: Date;
|
||||
'status'?: Order.StatusEnum;
|
||||
'complete'?: boolean;
|
||||
static discriminator: string | 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
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Order = (function () {
|
||||
function Order() {
|
||||
}
|
||||
Order.getAttributeTypeMap = function () {
|
||||
return Order.attributeTypeMap;
|
||||
};
|
||||
Order.discriminator = undefined;
|
||||
Order.attributeTypeMap = [
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "petId",
|
||||
"baseName": "petId",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"baseName": "quantity",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "shipDate",
|
||||
"baseName": "shipDate",
|
||||
"type": "Date"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"baseName": "status",
|
||||
"type": "Order.StatusEnum"
|
||||
},
|
||||
{
|
||||
"name": "complete",
|
||||
"baseName": "complete",
|
||||
"type": "boolean"
|
||||
}
|
||||
];
|
||||
return Order;
|
||||
}());
|
||||
exports.Order = Order;
|
||||
(function (Order) {
|
||||
var StatusEnum;
|
||||
(function (StatusEnum) {
|
||||
StatusEnum[StatusEnum["Placed"] = 'placed'] = "Placed";
|
||||
StatusEnum[StatusEnum["Approved"] = 'approved'] = "Approved";
|
||||
StatusEnum[StatusEnum["Delivered"] = 'delivered'] = "Delivered";
|
||||
})(StatusEnum = Order.StatusEnum || (Order.StatusEnum = {}));
|
||||
})(Order = exports.Order || (exports.Order = {}));
|
||||
exports.Order = Order;
|
||||
//# sourceMappingURL=Order.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"Order.js","sourceRoot":"","sources":["../../models/Order.ts"],"names":[],"mappings":";;AAOA;IAAA;IAgDA,CAAC;IAHU,yBAAmB,GAA1B;QACI,OAAO,KAAK,CAAC,gBAAgB,CAAC;IAClC,CAAC;IApCM,mBAAa,GAAuB,SAAS,CAAC;IAE9C,sBAAgB,GAA0D;QAC7E;YACI,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,MAAM;SACjB;QACD;YACI,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,kBAAkB;SAC7B;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,SAAS;SACpB;KAAK,CAAC;IAKf,YAAC;CAAA,AAhDD,IAgDC;AAhDY,sBAAK;AAkDlB,WAAiB,KAAK;IAClB,IAAY,UAIX;IAJD,WAAY,UAAU;QAClB,kCAAe,QAAQ,YAAA,CAAA;QACvB,oCAAiB,UAAU,cAAA,CAAA;QAC3B,qCAAkB,WAAW,eAAA,CAAA;IACjC,CAAC,EAJW,UAAU,GAAV,gBAAU,KAAV,gBAAU,QAIrB;AACL,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB;AAxDY,sBAAK"}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { Category } from './Category';
|
||||
import { Tag } from './Tag';
|
||||
export declare class Pet {
|
||||
'id'?: number;
|
||||
'category'?: Category;
|
||||
'name': string;
|
||||
'photoUrls': Array<string>;
|
||||
'tags'?: Array<Tag>;
|
||||
'status'?: Pet.StatusEnum;
|
||||
static discriminator: string | 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
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Pet = (function () {
|
||||
function Pet() {
|
||||
}
|
||||
Pet.getAttributeTypeMap = function () {
|
||||
return Pet.attributeTypeMap;
|
||||
};
|
||||
Pet.discriminator = undefined;
|
||||
Pet.attributeTypeMap = [
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "category",
|
||||
"baseName": "category",
|
||||
"type": "Category"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "photoUrls",
|
||||
"baseName": "photoUrls",
|
||||
"type": "Array<string>"
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"baseName": "tags",
|
||||
"type": "Array<Tag>"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"baseName": "status",
|
||||
"type": "Pet.StatusEnum"
|
||||
}
|
||||
];
|
||||
return Pet;
|
||||
}());
|
||||
exports.Pet = Pet;
|
||||
(function (Pet) {
|
||||
var StatusEnum;
|
||||
(function (StatusEnum) {
|
||||
StatusEnum[StatusEnum["Available"] = 'available'] = "Available";
|
||||
StatusEnum[StatusEnum["Pending"] = 'pending'] = "Pending";
|
||||
StatusEnum[StatusEnum["Sold"] = 'sold'] = "Sold";
|
||||
})(StatusEnum = Pet.StatusEnum || (Pet.StatusEnum = {}));
|
||||
})(Pet = exports.Pet || (exports.Pet = {}));
|
||||
exports.Pet = Pet;
|
||||
//# sourceMappingURL=Pet.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"Pet.js","sourceRoot":"","sources":["../../models/Pet.ts"],"names":[],"mappings":";;AASA;IAAA;IAgDA,CAAC;IAHU,uBAAmB,GAA1B;QACI,OAAO,GAAG,CAAC,gBAAgB,CAAC;IAChC,CAAC;IApCM,iBAAa,GAAuB,SAAS,CAAC;IAE9C,oBAAgB,GAA0D;QAC7E;YACI,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,UAAU;SACrB;QACD;YACI,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,WAAW;YACnB,UAAU,EAAE,WAAW;YACvB,MAAM,EAAE,eAAe;SAC1B;QACD;YACI,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,YAAY;SACvB;QACD;YACI,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,gBAAgB;SAC3B;KAAK,CAAC;IAKf,UAAC;CAAA,AAhDD,IAgDC;AAhDY,kBAAG;AAkDhB,WAAiB,GAAG;IAChB,IAAY,UAIX;IAJD,WAAY,UAAU;QAClB,qCAAkB,WAAW,eAAA,CAAA;QAC7B,mCAAgB,SAAS,aAAA,CAAA;QACzB,gCAAa,MAAM,UAAA,CAAA;IACvB,CAAC,EAJW,UAAU,GAAV,cAAU,KAAV,cAAU,QAIrB;AACL,CAAC,EANgB,GAAG,GAAH,WAAG,KAAH,WAAG,QAMnB;AAxDY,kBAAG"}
|
||||
@@ -1,15 +0,0 @@
|
||||
export declare class Tag {
|
||||
'id'?: number;
|
||||
'name'?: string;
|
||||
static discriminator: string | undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}>;
|
||||
static getAttributeTypeMap(): {
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Tag = (function () {
|
||||
function Tag() {
|
||||
}
|
||||
Tag.getAttributeTypeMap = function () {
|
||||
return Tag.attributeTypeMap;
|
||||
};
|
||||
Tag.discriminator = undefined;
|
||||
Tag.attributeTypeMap = [
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"baseName": "name",
|
||||
"type": "string"
|
||||
}
|
||||
];
|
||||
return Tag;
|
||||
}());
|
||||
exports.Tag = Tag;
|
||||
//# sourceMappingURL=Tag.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../models/Tag.ts"],"names":[],"mappings":";;AAOA;IAAA;IAqBA,CAAC;IAHU,uBAAmB,GAA1B;QACI,OAAO,GAAG,CAAC,gBAAgB,CAAC;IAChC,CAAC;IAhBM,iBAAa,GAAuB,SAAS,CAAC;IAE9C,oBAAgB,GAA0D;QAC7E;YACI,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,QAAQ;SACnB;KAAK,CAAC;IAKf,UAAC;CAAA,AArBD,IAqBC;AArBY,kBAAG"}
|
||||
@@ -1,21 +0,0 @@
|
||||
export declare class User {
|
||||
'id'?: number;
|
||||
'username'?: string;
|
||||
'firstName'?: string;
|
||||
'lastName'?: string;
|
||||
'email'?: string;
|
||||
'password'?: string;
|
||||
'phone'?: string;
|
||||
'userStatus'?: number;
|
||||
static discriminator: string | undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}>;
|
||||
static getAttributeTypeMap(): {
|
||||
name: string;
|
||||
baseName: string;
|
||||
type: string;
|
||||
}[];
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var User = (function () {
|
||||
function User() {
|
||||
}
|
||||
User.getAttributeTypeMap = function () {
|
||||
return User.attributeTypeMap;
|
||||
};
|
||||
User.discriminator = undefined;
|
||||
User.attributeTypeMap = [
|
||||
{
|
||||
"name": "id",
|
||||
"baseName": "id",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "username",
|
||||
"baseName": "username",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "firstName",
|
||||
"baseName": "firstName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "lastName",
|
||||
"baseName": "lastName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"baseName": "email",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"baseName": "password",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"baseName": "phone",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "userStatus",
|
||||
"baseName": "userStatus",
|
||||
"type": "number"
|
||||
}
|
||||
];
|
||||
return User;
|
||||
}());
|
||||
exports.User = User;
|
||||
//# sourceMappingURL=User.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../models/User.ts"],"names":[],"mappings":";;AAOA;IAAA;IA4DA,CAAC;IAHU,wBAAmB,GAA1B;QACI,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IA9CM,kBAAa,GAAuB,SAAS,CAAC;IAE9C,qBAAgB,GAA0D;QAC7E;YACI,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,WAAW;YACnB,UAAU,EAAE,WAAW;YACvB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,YAAY;YACxB,MAAM,EAAE,QAAQ;SACnB;KAAK,CAAC;IAKf,WAAC;CAAA,AA5DD,IA4DC;AA5DY,oBAAI"}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { RequestContext, HttpMethod } from './http/http';
|
||||
export declare class ServerConfiguration {
|
||||
private url;
|
||||
constructor(url: string);
|
||||
makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext;
|
||||
}
|
||||
export declare const servers: ServerConfiguration[];
|
||||
@@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var http_1 = require("./http/http");
|
||||
var ServerConfiguration = (function () {
|
||||
function ServerConfiguration(url) {
|
||||
this.url = url;
|
||||
}
|
||||
ServerConfiguration.prototype.makeRequestContext = function (endpoint, httpMethod) {
|
||||
return new http_1.RequestContext(this.url + endpoint, httpMethod);
|
||||
};
|
||||
return ServerConfiguration;
|
||||
}());
|
||||
exports.ServerConfiguration = ServerConfiguration;
|
||||
exports.servers = [
|
||||
new ServerConfiguration("http://petstore.swagger.io/v2"),
|
||||
];
|
||||
//# sourceMappingURL=servers.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"servers.js","sourceRoot":"","sources":["../servers.ts"],"names":[],"mappings":";;AAAA,oCAAuD;AAEvD;IAEI,6BAA2B,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IACtC,CAAC;IAEG,gDAAkB,GAAzB,UAA0B,QAAgB,EAAE,UAAsB;QACjE,OAAO,IAAI,qBAAc,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC5D,CAAC;IACF,0BAAC;AAAD,CAAC,AARD,IAQC;AARY,kDAAmB;AAUnB,QAAA,OAAO,GAAG;IACtB,IAAI,mBAAmB,CAAC,+BAA+B,CAAC;CACxD,CAAA"}
|
||||
@@ -6,6 +6,7 @@ import 'isomorphic-fetch';
|
||||
export class IsomorphicFetchHttpLibrary implements HttpLibrary {
|
||||
|
||||
public send(request: RequestContext): Promise<ResponseContext> {
|
||||
console.log("Request: ", request);
|
||||
let method = request.getHttpMethod().toString();
|
||||
let body = request.getBody();
|
||||
|
||||
@@ -21,7 +22,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary {
|
||||
headers[key] = (headers[key] as Array<string>).join("; ");
|
||||
}
|
||||
|
||||
return resp.text().then((body) => {
|
||||
return resp.json().then((body) => {
|
||||
return new ResponseContext(resp.status, headers, body)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './ApiResponse'
|
||||
export * from './Category'
|
||||
export * from './Order'
|
||||
export * from './Pet'
|
||||
export * from './Tag'
|
||||
export * from './User'
|
||||
12
samples/client/petstore/typescript/builds/default/test.ts
Normal file
12
samples/client/petstore/typescript/builds/default/test.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import {PetApi} from './api';
|
||||
import {Configuration } from './configuration';
|
||||
|
||||
const config = new Configuration();
|
||||
const api = new PetApi(config);
|
||||
|
||||
api.getPetById(3).then((pet) => {
|
||||
console.log(pet)
|
||||
}).catch((err) => {
|
||||
|
||||
console.log(err);
|
||||
});
|
||||
Reference in New Issue
Block a user