update ts angular v2, v4 petstore samples

This commit is contained in:
wing328
2017-09-23 15:55:14 +08:00
parent 07df0759d3
commit 16678b8106
12 changed files with 282 additions and 132 deletions

View File

@@ -74,6 +74,11 @@ export class PetService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
*
* @summary Add a new pet to the store
@@ -230,8 +235,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -289,8 +294,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -343,8 +348,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -397,8 +402,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -448,8 +453,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
@@ -494,8 +499,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -548,8 +553,8 @@ export class PetService {
'application/x-www-form-urlencoded'
];
if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
@@ -564,8 +569,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -624,8 +629,8 @@ export class PetService {
'multipart/form-data'
];
if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
@@ -640,8 +645,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required

View File

@@ -73,6 +73,11 @@ export class StoreService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
@@ -160,8 +165,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -195,8 +200,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
@@ -242,8 +247,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -283,8 +288,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

View File

@@ -73,6 +73,11 @@ export class UserService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* This can only be done by the logged in user.
* @summary Create user
@@ -225,8 +230,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -269,8 +274,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -313,8 +318,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -358,8 +363,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -400,8 +405,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -454,8 +459,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -490,8 +495,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -537,8 +542,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

View File

@@ -74,6 +74,11 @@ export class PetService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
*
* @summary Add a new pet to the store
@@ -230,8 +235,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -289,8 +294,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -343,8 +348,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -397,8 +402,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -448,8 +453,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
@@ -494,8 +499,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -548,8 +553,8 @@ export class PetService {
'application/x-www-form-urlencoded'
];
if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
@@ -564,8 +569,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -624,8 +629,8 @@ export class PetService {
'multipart/form-data'
];
if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
@@ -640,8 +645,8 @@ export class PetService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required

View File

@@ -73,6 +73,11 @@ export class StoreService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
@@ -160,8 +165,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -195,8 +200,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
@@ -242,8 +247,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -283,8 +288,8 @@ export class StoreService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

View File

@@ -73,6 +73,11 @@ export class UserService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* This can only be done by the logged in user.
* @summary Create user
@@ -225,8 +230,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -269,8 +274,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -313,8 +318,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -358,8 +363,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -400,8 +405,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -454,8 +459,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -490,8 +495,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -537,8 +542,8 @@ export class UserService {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

View File

@@ -75,6 +75,11 @@ export class PetService implements PetServiceInterface {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
*
* @summary Add a new pet to the store
@@ -231,8 +236,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -290,8 +295,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -344,8 +349,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -398,8 +403,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -449,8 +454,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
@@ -495,8 +500,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -549,8 +554,8 @@ export class PetService implements PetServiceInterface {
'application/x-www-form-urlencoded'
];
if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
@@ -565,8 +570,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
@@ -625,8 +630,8 @@ export class PetService implements PetServiceInterface {
'multipart/form-data'
];
if ((consumes != null) && (consumes.length > 0)) {
headers.set('Content-Type', consumes.join(';'));
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
@@ -641,8 +646,8 @@ export class PetService implements PetServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required

View File

@@ -74,6 +74,11 @@ export class StoreService implements StoreServiceInterface {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
@@ -161,8 +166,8 @@ export class StoreService implements StoreServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -196,8 +201,8 @@ export class StoreService implements StoreServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
@@ -243,8 +248,8 @@ export class StoreService implements StoreServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -284,8 +289,8 @@ export class StoreService implements StoreServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

View File

@@ -74,6 +74,11 @@ export class UserService implements UserServiceInterface {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* This can only be done by the logged in user.
* @summary Create user
@@ -226,8 +231,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -270,8 +275,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -314,8 +319,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -359,8 +364,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -401,8 +406,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -455,8 +460,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -491,8 +496,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
@@ -538,8 +543,8 @@ export class UserService implements UserServiceInterface {
'application/json'
];
if ((produces != null) && (produces.length > 0)) {
headers.set('Accept', produces.join(';'));
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}

View File

@@ -74,6 +74,11 @@ export class PetService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
*
* @summary Add a new pet to the store
@@ -230,6 +235,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
@@ -285,6 +294,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
@@ -335,6 +348,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
@@ -385,6 +402,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
@@ -432,6 +453,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
@@ -474,6 +499,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
@@ -523,6 +552,11 @@ export class PetService {
let consumes: string[] = [
'application/x-www-form-urlencoded'
];
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
let formParams = new (useForm ? FormData : URLSearchParams as any)() as {
@@ -535,6 +569,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {
@@ -590,6 +628,11 @@ export class PetService {
let consumes: string[] = [
'multipart/form-data'
];
if (consumes != null && consumes.length > 0) {
headers.set('Content-Type', consumes.filter(item => this.isJsonMime(item)).join(";"));
}
let canConsumeForm = this.canConsumeForm(consumes);
let useForm = false;
useForm = canConsumeForm;
@@ -602,6 +645,10 @@ export class PetService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (petstore_auth) required
// oauth required
if (this.configuration.accessToken) {

View File

@@ -73,6 +73,11 @@ export class StoreService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* @summary Delete purchase order by ID
@@ -160,6 +165,10 @@ export class StoreService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
@@ -191,6 +200,10 @@ export class StoreService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
@@ -234,6 +247,10 @@ export class StoreService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
@@ -271,6 +288,10 @@ export class StoreService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
headers.set('Content-Type', 'application/json');

View File

@@ -73,6 +73,11 @@ export class UserService {
return false;
}
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
/**
* This can only be done by the logged in user.
* @summary Create user
@@ -225,6 +230,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
headers.set('Content-Type', 'application/json');
@@ -265,6 +274,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
headers.set('Content-Type', 'application/json');
@@ -305,6 +318,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
headers.set('Content-Type', 'application/json');
@@ -346,6 +363,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Delete,
@@ -384,6 +405,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
@@ -434,6 +459,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
@@ -466,6 +495,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
@@ -509,6 +542,10 @@ export class UserService {
'application/json'
];
if (produces != null && produces.length > 0) {
headers.set('Accept', produces.filter(item => this.isJsonMime(item)).join(';'));
}
headers.set('Content-Type', 'application/json');