#4962 Empty Response body handling in typescript-angular2 - added returning an empty object on response.json() failure (#5585)

This commit is contained in:
kenisteward
2017-05-10 03:46:33 -04:00
committed by wing328
parent 5a257a0558
commit ec7b80abab
21 changed files with 381 additions and 241 deletions

View File

@@ -47,7 +47,7 @@ export class {{classname}} {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}

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
@@ -45,13 +45,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.addPetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -68,7 +68,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -78,13 +78,13 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus(status?: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
public findPetsByStatus(status: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -94,21 +94,21 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
public findPetsByTags(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
public findPetsByTags(tags: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* Returns a single pet
* @param petId ID of pet to return
*/
public getPetById(petId: number, extraHttpRequestParams?: any): Observable<models.Pet> {
return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
@@ -116,7 +116,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -144,13 +144,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, extraHttpRequestParams?: any): Observable<{}> {
public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -162,13 +162,13 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> {
public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<models.ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -179,11 +179,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -192,8 +196,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -246,8 +250,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -278,15 +282,17 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
public findPetsByStatusWithHttpInfo(status?: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
public findPetsByStatusWithHttpInfo(status: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/findByStatus';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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) {
status.forEach((element) => {
queryParameters.append('status', <any>element);
})
queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -295,8 +301,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -327,15 +333,17 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
public findPetsByTagsWithHttpInfo(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/findByTags';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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) {
tags.forEach((element) => {
queryParameters.append('tags', <any>element);
})
queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -344,8 +352,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -373,8 +381,8 @@ export class PetApi {
/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* Returns a single pet
* @param petId ID of pet to return
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
@@ -392,8 +400,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (api_key) required
@@ -401,15 +409,6 @@ export class PetApi {
headers.set('api_key', this.configuration.apiKey);
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
@@ -429,11 +428,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -442,8 +445,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -479,7 +482,7 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
@@ -498,8 +501,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -562,8 +565,7 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/json'
];
// authentication (petstore_auth) required

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
@@ -51,7 +51,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -66,7 +66,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -76,13 +76,13 @@ export class StoreApi {
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable<models.Order> {
public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable<models.Order> {
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -92,13 +92,13 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable<models.Order> {
public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable<models.Order> {
return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -125,8 +125,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -158,8 +158,7 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/json'
];
// authentication (api_key) required
@@ -186,7 +185,7 @@ export class StoreApi {
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable<Response> {
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
@@ -202,8 +201,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -225,19 +224,23 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable<Response> {
public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');

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
@@ -45,13 +45,13 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.createUserWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -61,13 +61,13 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithArrayInput(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
public createUsersWithArrayInput(body: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -77,13 +77,13 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithListInput(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
public createUsersWithListInput(body: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -99,7 +99,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -115,7 +115,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ 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, extraHttpRequestParams?: any): Observable<string> {
public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable<string> {
return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -147,7 +147,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -158,13 +158,13 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -175,19 +175,23 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable<Response> {
public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -212,19 +216,23 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithArrayInputWithHttpInfo(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
public createUsersWithArrayInputWithHttpInfo(body: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/createWithArray';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -249,19 +257,23 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithListInputWithHttpInfo(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
public createUsersWithListInputWithHttpInfo(body: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/createWithList';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -302,8 +314,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -341,8 +353,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -365,11 +377,19 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable<Response> {
public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/login';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.set('username', <any>username);
}
@@ -384,8 +404,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -417,8 +437,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -441,7 +461,7 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<Response> {
public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
@@ -451,14 +471,18 @@ 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');

View File

@@ -0,0 +1,25 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
/**
* Describes the result of uploading an image resource
*/
export interface ApiResponse {
code?: number;
type?: string;
message?: string;
}

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A category for a pet
*/
export interface Category {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* An order for a pets from the pet store
*/
export interface Order {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A pet for sale in the pet store
*/
export interface Pet {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A tag for a pet
*/
export interface Tag {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A User who is purchasing from the pet store
*/
export interface User {
id?: number;

View File

@@ -1,3 +1,4 @@
export * from './ApiResponse';
export * from './Category';
export * from './Order';
export * from './Pet';

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
@@ -45,13 +45,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.addPetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -68,7 +68,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -78,13 +78,13 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
public findPetsByStatus(status?: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
public findPetsByStatus(status: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -94,21 +94,21 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
public findPetsByTags(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
public findPetsByTags(tags: Array<string>, extraHttpRequestParams?: any): Observable<Array<models.Pet>> {
return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* Returns a single pet
* @param petId ID of pet to return
*/
public getPetById(petId: number, extraHttpRequestParams?: any): Observable<models.Pet> {
return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
@@ -116,7 +116,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -144,13 +144,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, extraHttpRequestParams?: any): Observable<{}> {
public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -162,13 +162,13 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> {
public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<models.ApiResponse> {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -179,11 +179,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -192,8 +196,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -246,8 +250,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -278,15 +282,17 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
public findPetsByStatusWithHttpInfo(status?: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
public findPetsByStatusWithHttpInfo(status: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/findByStatus';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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) {
status.forEach((element) => {
queryParameters.append('status', <any>element);
})
queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -295,8 +301,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -327,15 +333,17 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
public findPetsByTagsWithHttpInfo(tags?: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
public findPetsByTagsWithHttpInfo(tags: Array<string>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/findByTags';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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) {
tags.forEach((element) => {
queryParameters.append('tags', <any>element);
})
queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -344,8 +352,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -373,8 +381,8 @@ export class PetApi {
/**
* Find pet by ID
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* Returns a single pet
* @param petId ID of pet to return
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
@@ -392,8 +400,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (api_key) required
@@ -401,15 +409,6 @@ export class PetApi {
headers.set('api_key', this.configuration.apiKey);
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
let accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers.set('Authorization', 'Bearer ' + accessToken);
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
@@ -429,11 +428,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -442,8 +445,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -479,7 +482,7 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
@@ -498,8 +501,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
// authentication (petstore_auth) required
@@ -562,8 +565,7 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/json'
];
// authentication (petstore_auth) required

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
@@ -51,7 +51,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -66,7 +66,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -76,13 +76,13 @@ export class StoreApi {
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable<models.Order> {
public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable<models.Order> {
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -92,13 +92,13 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable<models.Order> {
public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable<models.Order> {
return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -125,8 +125,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -158,8 +158,7 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/json'
];
// authentication (api_key) required
@@ -186,7 +185,7 @@ export class StoreApi {
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable<Response> {
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
@@ -202,8 +201,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -225,19 +224,23 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable<Response> {
public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/store/order';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');

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
@@ -45,13 +45,13 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.createUserWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -61,13 +61,13 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithArrayInput(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
public createUsersWithArrayInput(body: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -77,13 +77,13 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithListInput(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
public createUsersWithListInput(body: Array<models.User>, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -99,7 +99,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -115,7 +115,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ 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, extraHttpRequestParams?: any): Observable<string> {
public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable<string> {
return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -147,7 +147,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -158,13 +158,13 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
return response.json() || {};
}
});
}
@@ -175,19 +175,23 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable<Response> {
public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -212,19 +216,23 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithArrayInputWithHttpInfo(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
public createUsersWithArrayInputWithHttpInfo(body: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/createWithArray';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -249,19 +257,23 @@ export class UserApi {
*
* @param body List of user object
*/
public createUsersWithListInputWithHttpInfo(body?: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
public createUsersWithListInputWithHttpInfo(body: Array<models.User>, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/createWithList';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -302,8 +314,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -341,8 +353,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -365,11 +377,19 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable<Response> {
public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/login';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// 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.set('username', <any>username);
}
@@ -384,8 +404,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -417,8 +437,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -441,7 +461,7 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<Response> {
public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
@@ -451,14 +471,18 @@ 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.');
}
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
'application/json',
'application/xml'
'application/xml',
'application/json'
];
headers.set('Content-Type', 'application/json');

View File

@@ -0,0 +1,25 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
/**
* Describes the result of uploading an image resource
*/
export interface ApiResponse {
code?: number;
type?: string;
message?: string;
}

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A category for a pet
*/
export interface Category {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* An order for a pets from the pet store
*/
export interface Order {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A pet for sale in the pet store
*/
export interface Pet {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A tag for a pet
*/
export interface Tag {
id?: number;

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
@@ -12,6 +12,9 @@
import * as models from './models';
/**
* A User who is purchasing from the pet store
*/
export interface User {
id?: number;

View File

@@ -1,3 +1,4 @@
export * from './ApiResponse';
export * from './Category';
export * from './Order';
export * from './Pet';