add encodeURIComponent to encode path parameters (#6551)

This commit is contained in:
wing328 2017-09-25 16:28:30 +08:00 committed by GitHub
parent 419ee1cc79
commit 96137e5677
22 changed files with 237 additions and 170 deletions

View File

@ -29,8 +29,10 @@ export class {{classname}} {
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/
{{#allParams}}
* @param {{paramName}} {{description}}
{{/allParams}}
*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};
@ -47,6 +49,7 @@ export class {{classname}} {
if ({{paramName}} === null || {{paramName}} === undefined) {
throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
}
{{/required}}
{{/allParams}}
{{#queryParams}}

View File

@ -36,11 +36,16 @@ export class {{classname}} extends Api {
}
{{#operation}}
/**{{#summary}}
/**
{{#summary}}
* {{summary}}
*{{/summary}}{{#notes}}
* {{notes}}{{/notes}}{{#allParams}}
* @param params.{{paramName}} {{description}}{{/allParams}}
{{/summary}}
{{#notes}}
* {{notes}}
{{/notes}}
{{#allParams}}
* @param params.{{paramName}} {{description}}
{{/allParams}}
*/
async {{nickname}}({{#hasParams}}params: I{{operationIdCamelCase}}Params{{/hasParams}}): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}any{{/returnType}}> {
// Verify required parameters are set
@ -52,7 +57,7 @@ export class {{classname}} extends Api {
// Create URL to call
const url = `${this.basePath}{{{path}}}`{{#pathParams}}
.replace(`{${'{{baseName}}'}}`, `${params['{{paramName}}']}`){{/pathParams}};
.replace(`{${'{{baseName}}'}}`, encodeURIComponent(String(${params['{{paramName}}']}))){{/pathParams}};
const response = await this.httpClient.createRequest(url)
// Set HTTP method

View File

@ -99,7 +99,7 @@ export const {{classname}}FetchParamCreator = function (configuration?: Configur
{{/required}}
{{/allParams}}
const path = `{{{path}}}`{{#pathParams}}
.replace(`{${"{{baseName}}"}}`, String({{paramName}})){{/pathParams}};
.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}};
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: '{{httpMethod}}' }, options);
const headerParameter = {} as any;

View File

@ -48,10 +48,12 @@ export class {{classname}} {
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/
{{#allParams}}
* @param {{paramName}} {{description}}
{{/allParams}}
*/
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
let localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
let localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};
let queryParameters: any = {};
let headerParams: any = {};
@ -66,8 +68,8 @@ export class {{classname}} {
if ({{paramName}} === null || {{paramName}} === undefined) {
throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
}
{{/required}}
{{/required}}
{{/allParams}}
{{#queryParams}}
{{#isListContainer}}

View File

@ -364,21 +364,26 @@ export class {{classname}} {
{{#summary}}
* @summary {{&summary}}
{{/summary}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/
{{#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}}' + '}', String({{paramName}})){{/pathParams}};
.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
{{#allParams}}{{#required}}
{{#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}}
{{/required}}
{{/allParams}}
{{#queryParams}}
if ({{paramName}} !== undefined) {
queryParameters['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}");

View File

@ -40,6 +40,7 @@ export class PetApi {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
@ -70,6 +71,7 @@ export class PetApi {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
headerParams['api_key'] = apiKey;
let httpRequestParams: ng.IRequestConfig = {
@ -99,6 +101,7 @@ export class PetApi {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
if (status !== undefined) {
queryParameters['status'] = status;
}
@ -130,6 +133,7 @@ export class PetApi {
if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
if (tags !== undefined) {
queryParameters['tags'] = tags;
}
@ -162,6 +166,7 @@ export class PetApi {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
@ -189,6 +194,7 @@ export class PetApi {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'PUT',
url: localVarPath,
@ -222,6 +228,7 @@ export class PetApi {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['name'] = name;
@ -261,6 +268,7 @@ export class PetApi {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
headerParams['Content-Type'] = 'application/x-www-form-urlencoded';
formParams['additionalMetadata'] = additionalMetadata;

View File

@ -41,6 +41,7 @@ export class StoreApi {
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'DELETE',
url: localVarPath,
@ -91,6 +92,7 @@ export class StoreApi {
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
@ -118,6 +120,7 @@ export class StoreApi {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,

View File

@ -40,6 +40,7 @@ export class UserApi {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
@ -68,6 +69,7 @@ export class UserApi {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
@ -96,6 +98,7 @@ export class UserApi {
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'POST',
url: localVarPath,
@ -125,6 +128,7 @@ export class UserApi {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'DELETE',
url: localVarPath,
@ -153,6 +157,7 @@ export class UserApi {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'GET',
url: localVarPath,
@ -181,10 +186,12 @@ export class UserApi {
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) {
queryParameters['username'] = username;
}
@ -244,10 +251,12 @@ export class UserApi {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
let httpRequestParams: ng.IRequestConfig = {
method: 'PUT',
url: localVarPath,

View File

@ -99,7 +99,6 @@ export class PetApi extends Api {
/**
* Add a new pet to the store
*
*
* @param params.body Pet object that needs to be added to the store
*/
@ -131,7 +130,6 @@ export class PetApi extends Api {
/**
* Deletes a pet
*
*
* @param params.petId Pet id to delete
* @param params.apiKey
@ -142,7 +140,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, `${params['petId']}`);
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -162,7 +160,6 @@ export class PetApi extends Api {
/**
* Finds Pets by status
*
* Multiple status values can be provided with comma separated strings
* @param params.status Status values that need to be considered for filter
*/
@ -195,7 +192,6 @@ export class PetApi extends Api {
/**
* Finds Pets by tags
*
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param params.tags Tags to filter by
*/
@ -228,7 +224,6 @@ export class PetApi extends Api {
/**
* Find pet by ID
*
* Returns a single pet
* @param params.petId ID of pet to return
*/
@ -238,7 +233,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, `${params['petId']}`);
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -259,7 +254,6 @@ export class PetApi extends Api {
/**
* Update an existing pet
*
*
* @param params.body Pet object that needs to be added to the store
*/
@ -291,7 +285,6 @@ export class PetApi extends Api {
/**
* Updates a pet in the store with form data
*
*
* @param params.petId ID of pet that needs to be updated
* @param params.name Updated name of the pet
@ -303,7 +296,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}`
.replace(`{${'petId'}}`, `${params['petId']}`);
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -329,7 +322,6 @@ export class PetApi extends Api {
/**
* uploads an image
*
*
* @param params.petId ID of pet to update
* @param params.additionalMetadata Additional data to pass to server
@ -341,7 +333,7 @@ export class PetApi extends Api {
// Create URL to call
const url = `${this.basePath}/pet/{petId}/uploadImage`
.replace(`{${'petId'}}`, `${params['petId']}`);
.replace(`{${'petId'}}`, encodeURIComponent(String(${params['petId']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method

View File

@ -62,7 +62,6 @@ export class StoreApi extends Api {
/**
* Delete purchase order by ID
*
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param params.orderId ID of the order that needs to be deleted
*/
@ -72,7 +71,7 @@ export class StoreApi extends Api {
// Create URL to call
const url = `${this.basePath}/store/order/{orderId}`
.replace(`{${'orderId'}}`, `${params['orderId']}`);
.replace(`{${'orderId'}}`, encodeURIComponent(String(${params['orderId']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -91,7 +90,6 @@ export class StoreApi extends Api {
/**
* Returns pet inventories by status
*
* Returns a map of status codes to quantities
*/
async getInventory(): Promise<{ [key: string]: number; }> {
@ -119,7 +117,6 @@ export class StoreApi extends Api {
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param params.orderId ID of pet that needs to be fetched
*/
@ -129,7 +126,7 @@ export class StoreApi extends Api {
// Create URL to call
const url = `${this.basePath}/store/order/{orderId}`
.replace(`{${'orderId'}}`, `${params['orderId']}`);
.replace(`{${'orderId'}}`, encodeURIComponent(String(${params['orderId']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -148,7 +145,6 @@ export class StoreApi extends Api {
/**
* Place an order for a pet
*
*
* @param params.body order placed for purchasing the pet
*/

View File

@ -93,7 +93,6 @@ export class UserApi extends Api {
/**
* Create user
*
* This can only be done by the logged in user.
* @param params.body Created user object
*/
@ -124,7 +123,6 @@ export class UserApi extends Api {
/**
* Creates list of users with given input array
*
*
* @param params.body List of user object
*/
@ -155,7 +153,6 @@ export class UserApi extends Api {
/**
* Creates list of users with given input array
*
*
* @param params.body List of user object
*/
@ -186,7 +183,6 @@ export class UserApi extends Api {
/**
* Delete user
*
* This can only be done by the logged in user.
* @param params.username The name that needs to be deleted
*/
@ -196,7 +192,7 @@ export class UserApi extends Api {
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, `${params['username']}`);
.replace(`{${'username'}}`, encodeURIComponent(String(${params['username']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -215,7 +211,6 @@ export class UserApi extends Api {
/**
* Get user by user name
*
*
* @param params.username The name that needs to be fetched. Use user1 for testing.
*/
@ -225,7 +220,7 @@ export class UserApi extends Api {
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, `${params['username']}`);
.replace(`{${'username'}}`, encodeURIComponent(String(${params['username']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method
@ -244,7 +239,6 @@ export class UserApi extends Api {
/**
* Logs user into the system
*
*
* @param params.username The user name for login
* @param params.password The password for login in clear text
@ -279,7 +273,6 @@ export class UserApi extends Api {
/**
* Logs out current logged in user session
*
*
*/
async logoutUser(): Promise<any> {
@ -305,7 +298,6 @@ export class UserApi extends Api {
/**
* Updated user
*
* This can only be done by the logged in user.
* @param params.username name that need to be deleted
* @param params.body Updated user object
@ -317,7 +309,7 @@ export class UserApi extends Api {
// Create URL to call
const url = `${this.basePath}/user/{username}`
.replace(`{${'username'}}`, `${params['username']}`);
.replace(`{${'username'}}`, encodeURIComponent(String(${params['username']})));
const response = await this.httpClient.createRequest(url)
// Set HTTP method

View File

@ -380,7 +380,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -504,7 +504,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -583,7 +583,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'POST' }, options);
const headerParameter = {} as any;
@ -635,7 +635,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.');
}
const path = `/pet/{petId}/uploadImage`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'POST' }, options);
const headerParameter = {} as any;
@ -1064,7 +1064,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.');
}
const path = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, String(orderId));
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -1124,7 +1124,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.');
}
const path = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, String(orderId));
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -1474,7 +1474,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -1503,7 +1503,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -1601,7 +1601,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'PUT' }, options);
const headerParameter = {} as any;

View File

@ -380,7 +380,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -504,7 +504,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -583,7 +583,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'POST' }, options);
const headerParameter = {} as any;
@ -635,7 +635,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.');
}
const path = `/pet/{petId}/uploadImage`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'POST' }, options);
const headerParameter = {} as any;
@ -1064,7 +1064,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.');
}
const path = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, String(orderId));
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -1124,7 +1124,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.');
}
const path = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, String(orderId));
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -1474,7 +1474,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -1503,7 +1503,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -1601,7 +1601,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'PUT' }, options);
const headerParameter = {} as any;

View File

@ -380,7 +380,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -504,7 +504,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -583,7 +583,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.');
}
const path = `/pet/{petId}`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'POST' }, options);
const headerParameter = {} as any;
@ -635,7 +635,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.');
}
const path = `/pet/{petId}/uploadImage`
.replace(`{${"petId"}}`, String(petId));
.replace(`{${"petId"}}`, encodeURIComponent(String(petId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'POST' }, options);
const headerParameter = {} as any;
@ -1064,7 +1064,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.');
}
const path = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, String(orderId));
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -1124,7 +1124,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration
throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.');
}
const path = `/store/order/{orderId}`
.replace(`{${"orderId"}}`, String(orderId));
.replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -1474,7 +1474,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'DELETE' }, options);
const headerParameter = {} as any;
@ -1503,7 +1503,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'GET' }, options);
const headerParameter = {} as any;
@ -1601,7 +1601,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration)
throw new RequiredError('body','Required parameter body was null or undefined when calling updateUser.');
}
const path = `/user/{username}`
.replace(`{${"username"}}`, String(username));
.replace(`{${"username"}}`, encodeURIComponent(String(username)));
const urlObj = url.parse(path, true);
const requestOptions = Object.assign({ method: 'PUT' }, options);
const headerParameter = {} as any;

View File

@ -112,7 +112,7 @@ export class PetApi {
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -122,7 +122,6 @@ export class PetApi {
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
headerParams['api_key'] = String(apiKey);
@ -295,7 +294,7 @@ export class PetApi {
* @param petId ID of pet to return
*/
public getPetById(petId: number): JQueryPromise<{ response: JQueryXHR; body: models.Pet; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -414,7 +413,7 @@ export class PetApi {
* @param status Updated status of the pet
*/
public updatePetWithForm(petId: number, name?: string, status?: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -427,8 +426,6 @@ export class PetApi {
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
if (name !== null && name !== undefined) {
formParams.append('name', <any>name);
@ -494,7 +491,7 @@ export class PetApi {
* @param file file to upload
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: any): JQueryPromise<{ response: JQueryXHR; body: models.ApiResponse; }> {
let localVarPath = this.basePath + '/pet/{petId}/uploadImage'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}/uploadImage'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -507,8 +504,6 @@ export class PetApi {
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
if (additionalMetadata !== null && additionalMetadata !== undefined) {
formParams.append('additionalMetadata', <any>additionalMetadata);

View File

@ -48,7 +48,7 @@ export class StoreApi {
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder(orderId: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', String(orderId));
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -144,7 +144,7 @@ export class StoreApi {
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: number): JQueryPromise<{ response: JQueryXHR; body: models.Order; }> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', String(orderId));
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = {};

View File

@ -204,7 +204,7 @@ export class UserApi {
* @param username The name that needs to be deleted
*/
public deleteUser(username: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', String(username));
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
@ -253,7 +253,7 @@ export class UserApi {
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string): JQueryPromise<{ response: JQueryXHR; body: models.User; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', String(username));
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
@ -407,7 +407,7 @@ export class UserApi {
* @param body Updated user object
*/
public updateUser(username: string, body: models.User): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', String(username));
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};

View File

@ -112,7 +112,7 @@ export class PetApi {
* @param apiKey
*/
public deletePet(petId: number, apiKey?: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -122,7 +122,6 @@ export class PetApi {
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
headerParams['api_key'] = String(apiKey);
@ -295,7 +294,7 @@ export class PetApi {
* @param petId ID of pet to return
*/
public getPetById(petId: number): JQueryPromise<{ response: JQueryXHR; body: models.Pet; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -414,7 +413,7 @@ export class PetApi {
* @param status Updated status of the pet
*/
public updatePetWithForm(petId: number, name?: string, status?: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -427,8 +426,6 @@ export class PetApi {
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
if (name !== null && name !== undefined) {
formParams.append('name', <any>name);
@ -494,7 +491,7 @@ export class PetApi {
* @param file file to upload
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: any): JQueryPromise<{ response: JQueryXHR; body: models.ApiResponse; }> {
let localVarPath = this.basePath + '/pet/{petId}/uploadImage'.replace('{' + 'petId' + '}', String(petId));
let localVarPath = this.basePath + '/pet/{petId}/uploadImage'.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -507,8 +504,6 @@ export class PetApi {
}
localVarPath = localVarPath + "?" + $.param(queryParameters);
if (additionalMetadata !== null && additionalMetadata !== undefined) {
formParams.append('additionalMetadata', <any>additionalMetadata);

View File

@ -48,7 +48,7 @@ export class StoreApi {
* @param orderId ID of the order that needs to be deleted
*/
public deleteOrder(orderId: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', String(orderId));
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = {};
@ -144,7 +144,7 @@ export class StoreApi {
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: number): JQueryPromise<{ response: JQueryXHR; body: models.Order; }> {
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', String(orderId));
let localVarPath = this.basePath + '/store/order/{orderId}'.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = {};

View File

@ -204,7 +204,7 @@ export class UserApi {
* @param username The name that needs to be deleted
*/
public deleteUser(username: string): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', String(username));
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
@ -253,7 +253,7 @@ export class UserApi {
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName(username: string): JQueryPromise<{ response: JQueryXHR; body: models.User; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', String(username));
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};
@ -407,7 +407,7 @@ export class UserApi {
* @param body Updated user object
*/
public updateUser(username: string, body: models.User): JQueryPromise<{ response: JQueryXHR; body?: any; }> {
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', String(username));
let localVarPath = this.basePath + '/user/{username}'.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = {};

View File

@ -532,7 +532,6 @@ export class PetApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
@ -584,12 +583,11 @@ export class PetApi {
*/
public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -644,7 +642,6 @@ export class PetApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -703,7 +700,6 @@ export class PetApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -758,12 +754,11 @@ export class PetApi {
*/
public getPetById (petId: number) : Promise<{ response: http.ClientResponse; body: Pet; }> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -818,7 +813,6 @@ export class PetApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
@ -871,12 +865,11 @@ export class PetApi {
*/
public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -936,12 +929,11 @@ export class PetApi {
*/
public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> {
const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1053,12 +1045,11 @@ export class StoreApi {
*/
public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1110,7 +1101,6 @@ export class StoreApi {
let formParams: any = {};
let useFormData = false;
let requestOptions: request.Options = {
@ -1155,12 +1145,11 @@ export class StoreApi {
*/
public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1213,7 +1202,6 @@ export class StoreApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
@ -1319,7 +1307,6 @@ export class UserApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
@ -1372,7 +1359,6 @@ export class UserApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
@ -1425,7 +1411,6 @@ export class UserApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
@ -1474,12 +1459,11 @@ export class UserApi {
*/
public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1527,12 +1511,11 @@ export class UserApi {
*/
public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1586,7 +1569,6 @@ export class UserApi {
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1652,7 +1634,6 @@ export class UserApi {
let formParams: any = {};
let useFormData = false;
let requestOptions: request.Options = {
@ -1695,12 +1676,11 @@ export class UserApi {
*/
public updateUser (username: string, body: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');

View File

@ -1,9 +1,9 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@wordnik.com
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@ -136,6 +136,41 @@ class ObjectSerializer {
}
}
/**
* Describes the result of uploading an image resource
*/
export class ApiResponse {
'code': number;
'type': string;
'message': string;
static discriminator = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "code",
"baseName": "code",
"type": "number"
},
{
"name": "type",
"baseName": "type",
"type": "string"
},
{
"name": "message",
"baseName": "message",
"type": "string"
} ];
static getAttributeTypeMap() {
return ApiResponse.attributeTypeMap;
}
}
/**
* A category for a pet
*/
export class Category {
'id': number;
'name': string;
@ -159,6 +194,9 @@ export class Category {
}
}
/**
* An order for a pets from the pet store
*/
export class Order {
'id': number;
'petId': number;
@ -216,6 +254,9 @@ export namespace Order {
Delivered = <any> 'delivered'
}
}
/**
* A pet for sale in the pet store
*/
export class Pet {
'id': number;
'category': Category;
@ -273,6 +314,9 @@ export namespace Pet {
Sold = <any> 'sold'
}
}
/**
* A tag for a pet
*/
export class Tag {
'id': number;
'name': string;
@ -296,6 +340,9 @@ export class Tag {
}
}
/**
* A User who is purchasing from the pet store
*/
export class User {
'id': number;
'username': string;
@ -365,6 +412,7 @@ let enumsMap = {
}
let typeMap = {
"ApiResponse": ApiResponse,
"Category": Category,
"Order": Order,
"Pet": Pet,
@ -478,12 +526,16 @@ export class PetApi {
* @summary Add a new pet to the store
* @param body Pet object that needs to be added to the store
*/
public addPet (body?: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
public addPet (body: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling addPet.');
}
let useFormData = false;
@ -531,12 +583,11 @@ export class PetApi {
*/
public deletePet (petId: number, apiKey?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -585,12 +636,16 @@ export class PetApi {
* @summary Finds Pets by status
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus (status?: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
public findPetsByStatus (status: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByStatus';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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) {
queryParameters['status'] = ObjectSerializer.serialize(status, "Array<string>");
@ -639,12 +694,16 @@ export class PetApi {
* @summary Finds Pets by tags
* @param tags Tags to filter by
*/
public findPetsByTags (tags?: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
public findPetsByTags (tags: Array<string>) : Promise<{ response: http.ClientResponse; body: Array<Pet>; }> {
const localVarPath = this.basePath + '/pet/findByTags';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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) {
queryParameters['tags'] = ObjectSerializer.serialize(tags, "Array<string>");
@ -689,18 +748,17 @@ export class PetApi {
});
}
/**
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
* Returns a single pet
* @summary Find pet by ID
* @param petId ID of pet that needs to be fetched
* @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' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -720,8 +778,6 @@ export class PetApi {
this.authentications.api_key.applyToRequest(requestOptions);
this.authentications.petstore_auth.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(requestOptions);
if (Object.keys(formParams).length) {
@ -751,12 +807,16 @@ export class PetApi {
* @summary Update an existing pet
* @param body Pet object that needs to be added to the store
*/
public updatePet (body?: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
public updatePet (body: Pet) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updatePet.');
}
let useFormData = false;
@ -803,14 +863,13 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
public updatePetWithForm (petId: string, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
public updatePetWithForm (petId: number, name?: string, status?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/pet/{petId}'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -868,14 +927,13 @@ export class PetApi {
* @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?: any; }> {
public uploadFile (petId: number, additionalMetadata?: string, file?: Buffer) : Promise<{ response: http.ClientResponse; body: ApiResponse; }> {
const localVarPath = this.basePath + '/pet/{petId}/uploadImage'
.replace('{' + 'petId' + '}', String(petId));
.replace('{' + 'petId' + '}', encodeURIComponent(String(petId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -913,11 +971,12 @@ export class PetApi {
requestOptions.form = formParams;
}
}
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
return new Promise<{ response: http.ClientResponse; body: ApiResponse; }>((resolve, reject) => {
request(requestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "ApiResponse");
if (response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
@ -986,12 +1045,11 @@ export class StoreApi {
*/
public deleteOrder (orderId: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1043,7 +1101,6 @@ export class StoreApi {
let formParams: any = {};
let useFormData = false;
let requestOptions: request.Options = {
@ -1086,14 +1143,13 @@ export class StoreApi {
* @summary Find purchase order by ID
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById (orderId: string) : Promise<{ response: http.ClientResponse; body: Order; }> {
public getOrderById (orderId: number) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order/{orderId}'
.replace('{' + 'orderId' + '}', String(orderId));
.replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1140,12 +1196,16 @@ export class StoreApi {
* @summary Place an order for a pet
* @param body order placed for purchasing the pet
*/
public placeOrder (body?: Order) : Promise<{ response: http.ClientResponse; body: Order; }> {
public placeOrder (body: Order) : Promise<{ response: http.ClientResponse; body: Order; }> {
const localVarPath = this.basePath + '/store/order';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling placeOrder.');
}
let useFormData = false;
@ -1241,12 +1301,16 @@ export class UserApi {
* @summary Create user
* @param body Created user object
*/
public createUser (body?: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
public createUser (body: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUser.');
}
let useFormData = false;
@ -1289,12 +1353,16 @@ export class UserApi {
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithArrayInput (body?: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
public createUsersWithArrayInput (body: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/createWithArray';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
let useFormData = false;
@ -1337,12 +1405,16 @@ export class UserApi {
* @summary Creates list of users with given input array
* @param body List of user object
*/
public createUsersWithListInput (body?: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
public createUsersWithListInput (body: Array<User>) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/createWithList';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
let useFormData = false;
@ -1387,12 +1459,11 @@ export class UserApi {
*/
public deleteUser (username: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1440,12 +1511,11 @@ export class UserApi {
*/
public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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.');
@ -1493,12 +1563,21 @@ export class UserApi {
* @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; }> {
public loginUser (username: string, password: string) : Promise<{ response: http.ClientResponse; body: string; }> {
const localVarPath = this.basePath + '/user/login';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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) {
queryParameters['username'] = ObjectSerializer.serialize(username, "string");
@ -1555,7 +1634,6 @@ export class UserApi {
let formParams: any = {};
let useFormData = false;
let requestOptions: request.Options = {
@ -1596,19 +1674,23 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUser (username: string, body?: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
public updateUser (username: string, body: User) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/user/{username}'
.replace('{' + 'username' + '}', String(username));
.replace('{' + 'username' + '}', encodeURIComponent(String(username)));
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: 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 'body' is not null or undefined
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling updateUser.');
}
let useFormData = false;