[typescript] Avoid strictNullChecks errors for apiKeys (#1611)

* [typescript] Avoid strictNullChecks errors for apiKeys

fix #1607

* Run ./bin/{LANG}-petstore.sh

- ./bin/typescript-angular-petstore-all.sh
- ./bin/typescript-inversify-petstore.sh

* Run ./bin/security/{LANG}-petstore.sh

- ./bin/security/typescript-angular.sh
- ./bin/security/typescript-angular2.sh
- ./bin/security/typescript-inversify.sh

* [typescript] Fix parameter name sanitization

* Fix invalid consumes of petstore-security-test.yaml

* Run ./bin/security/typescript-*.sh
This commit is contained in:
Atsushi Hanaoka 2018-12-06 18:10:45 +09:00 committed by William Cheng
parent 314b4cc54f
commit ced6e0502e
56 changed files with 636 additions and 148 deletions

View File

@ -161,7 +161,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
@Override
public String toParamName(String name) {
// sanitize name
name = sanitizeName(name, "\\W-[\\$]");
name = sanitizeName(name, "[^\\w$]");
if ("_".equals(name)) {
name = "_u";

View File

@ -192,13 +192,13 @@ export class {{classname}} {
// authentication ({{name}}) required
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.configuration.apiKeys["{{keyParamName}}"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["{{keyParamName}}"]) {
{{#useHttpClient}}headers = {{/useHttpClient}}headers.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]);
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.configuration.apiKeys["{{keyParamName}}"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["{{keyParamName}}"]) {
{{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]);
}

View File

@ -106,12 +106,12 @@ export class {{classname}} {
// authentication ({{name}}) required
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
if (this.APIConfiguration.apiKeys && this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
headers['{{keyParamName}}'] = this.APIConfiguration.apiKeys["{{keyParamName}}"];
}
{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
if (this.APIConfiguration.apiKeys && this.APIConfiguration.apiKeys["{{keyParamName}}"]) {
queryParameters.push("{{paramName}}="+encodeURIComponent(String(this.APIConfiguration.apiKeys["{{keyParamName}}"])));
}
{{/isKeyInQuery}}

View File

@ -15,5 +15,6 @@ public class TypeScriptNodeClientCodegenTest {
Assert.assertEquals(codegen.toVarName("user-name"), "userName");
Assert.assertEquals(codegen.toVarName("user_name"), "userName");
Assert.assertEquals(codegen.toVarName("user|name"), "userName");
Assert.assertEquals(codegen.toVarName("user !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~name"), "user$Name");
}
}

View File

@ -28,8 +28,7 @@ paths:
description: To test code injection */ ' " =end -- \r\n \n \r
operationId: testCodeInject */ ' " =end -- \r\n \n \r
consumes:
- application/json
- "*/ ' \" =end -- \r\n \n \r"
- application/x-www-form-urlencoded
produces:
- application/json
- "*/ ' \" =end -- \r\n \n \r"

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
4.0.0-SNAPSHOT

View File

@ -2,7 +2,7 @@
### Building
To build an compile the typescript sources to javascript use:
To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@ -10,11 +10,11 @@ npm run build
### publishing
First build the package than run ```npm publish```
First build the package then run ```npm publish```
### consuming
navigate to the folder of your consuming project and run one of next commando's.
Navigate to the folder of your consuming project and run one of next commands.
_published:_
@ -22,7 +22,7 @@ _published:_
npm install @ --save
```
_unPublished (not recommended):_
_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
@ -37,9 +37,16 @@ npm link
In your project:
```
npm link @
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
@ -94,8 +101,8 @@ export class AppComponent {
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple swagger files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different swagger files,
#### Using multiple OpenAPI files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different OpenAPI files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```

View File

@ -17,7 +17,7 @@ export class ApiModule {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
}
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,

View File

@ -1,12 +1,12 @@
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
@ -26,17 +26,18 @@ import { Configuration } from '../configurat
@Injectable()
export class FakeService {
protected basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
protected basePath = 'http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@ -46,7 +47,7 @@ export class FakeService {
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (let consume of consumes) {
for (const consume of consumes) {
if (form === consume) {
return true;
}
@ -57,8 +58,8 @@ export class FakeService {
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
@ -71,23 +72,20 @@ export class FakeService {
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json',
'*_/ =end -- '
];
let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set("Accept", httpHeaderAcceptSelected);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
'*_/ =end -- '
const consumes: string[] = [
'application/x-www-form-urlencoded'
];
const canConsumeForm = this.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): void; };
let formParams: { append(param: string, value: any): any; };
let useForm = false;
let convertFormParamsToString = false;
if (useForm) {
@ -100,7 +98,7 @@ export class FakeService {
formParams = formParams.append('test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r', <any>testCodeInjectEndRnNR) || formParams;
}
return this.httpClient.put<any>(`${this.basePath}/fake`,
return this.httpClient.put<any>(`${this.configuration.basePath}/fake`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,

View File

@ -28,11 +28,11 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {string[]} contentTypes - the array of content types that are available for selection
* @returns {string} the selected content-type or <code>undefined</code> if no selection could be made.
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
if (contentTypes.length === 0) {
return undefined;
}
@ -47,11 +47,11 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {string[]} accepts - the array of content types that are available for selection.
* @returns {string} the selected content-type or <code>undefined</code> if no selection could be made.
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
if (accepts.length === 0) {
return undefined;
}
@ -69,11 +69,11 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
* @return {boolean} True if the given MIME is JSON, false otherwise.
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View File

@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2

View File

@ -1 +1 @@
export * from './modelReturn';
export * from './return';

View File

@ -0,0 +1,22 @@
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
*/
export interface Return {
/**
* property description *_/ ' \" =end -- \\r\\n \\n \\r
*/
_return?: number;
}

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
4.0.0-SNAPSHOT

View File

@ -2,7 +2,7 @@
### Building
To build an compile the typescript sources to javascript use:
To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
@ -10,11 +10,11 @@ npm run build
### publishing
First build the package than run ```npm publish```
First build the package then run ```npm publish```
### consuming
navigate to the folder of your consuming project and run one of next commando's.
Navigate to the folder of your consuming project and run one of next commands.
_published:_
@ -22,7 +22,7 @@ _published:_
npm install @ --save
```
_unPublished (not recommended):_
_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE --save
@ -37,9 +37,16 @@ npm link
In your project:
```
npm link @
npm link
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
@ -94,8 +101,8 @@ export class AppComponent {
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple swagger files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different swagger files,
#### Using multiple OpenAPI files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different OpenAPI files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```

View File

@ -17,7 +17,7 @@ export class ApiModule {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
}
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,

View File

@ -1,12 +1,12 @@
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
@ -26,17 +26,18 @@ import { Configuration } from '../configurat
@Injectable()
export class FakeService {
protected basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
protected basePath = 'http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@ -46,7 +47,7 @@ export class FakeService {
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (let consume of consumes) {
for (const consume of consumes) {
if (form === consume) {
return true;
}
@ -57,8 +58,8 @@ export class FakeService {
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
@ -71,23 +72,20 @@ export class FakeService {
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json',
'*_/ =end -- '
];
let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
headers = headers.set("Accept", httpHeaderAcceptSelected);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
'*_/ =end -- '
const consumes: string[] = [
'application/x-www-form-urlencoded'
];
const canConsumeForm = this.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): void; };
let formParams: { append(param: string, value: any): any; };
let useForm = false;
let convertFormParamsToString = false;
if (useForm) {
@ -100,7 +98,7 @@ export class FakeService {
formParams = formParams.append('test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r', <any>testCodeInjectEndRnNR) || formParams;
}
return this.httpClient.put<any>(`${this.basePath}/fake`,
return this.httpClient.put<any>(`${this.configuration.basePath}/fake`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,

View File

@ -28,11 +28,11 @@ export class Configuration {
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {string[]} contentTypes - the array of content types that are available for selection
* @returns {string} the selected content-type or <code>undefined</code> if no selection could be made.
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
if (contentTypes.length === 0) {
return undefined;
}
@ -47,11 +47,11 @@ export class Configuration {
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param {string[]} accepts - the array of content types that are available for selection.
* @returns {string} the selected content-type or <code>undefined</code> if no selection could be made.
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
if (accepts.length === 0) {
return undefined;
}
@ -69,11 +69,11 @@ export class Configuration {
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param {string} mime - MIME (Multipurpose Internet Mail Extensions)
* @return {boolean} True if the given MIME is JSON, false otherwise.
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View File

@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2

View File

@ -1 +1 @@
export * from './modelReturn';
export * from './return';

View File

@ -0,0 +1,22 @@
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
*/
export interface Return {
/**
* property description *_/ ' \" =end -- \\r\\n \\n \\r
*/
_return?: number;
}

View File

@ -1 +1 @@
3.1.2-SNAPSHOT
4.0.0-SNAPSHOT

View File

@ -0,0 +1,56 @@
// tslint:disable
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
export interface TestCodeInjectEndRnNRRequest {
testCodeInjectEndRnNR?: string;
}
/**
* no description
*/
export class FakeApi extends runtime.BaseAPI {
/**
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
*/
async testCodeInjectEndRnNRRaw(requestParameters: TestCodeInjectEndRnNRRequest): Promise<runtime.ApiResponse<void>> {
const headerParameters: runtime.HTTPHeaders = {};
const formData = new FormData();
if (requestParameters.testCodeInjectEndRnNR !== undefined) {
formData.append('test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r', requestParameters.testCodeInjectEndRnNR as any);
}
const response = await this.request({
path: `/fake`,
method: 'PUT',
headers: headerParameters,
body: formData,
});
return new runtime.VoidApiResponse(response);
}
/**
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
*/
async testCodeInjectEndRnNR(requestParameters: TestCodeInjectEndRnNRRequest): Promise<void> {
await this.testCodeInjectEndRnNRRaw(requestParameters);
}
}

View File

@ -0,0 +1 @@
export * from './FakeApi';

View File

@ -1,16 +1,3 @@
// tslint:disable
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export * from "./api";
export * from "./configuration";
export * from './runtime';
export * from './apis';
export * from './models';

View File

@ -0,0 +1,44 @@
// tslint:disable
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists } from '../runtime';
/**
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
* @export
* @interface Return
*/
export interface Return {
/**
* property description *_/ ' \" =end -- \\r\\n \\n \\r
* @type {number}
* @memberof Return
*/
_return?: number;
}
export function ReturnFromJSON(json: any): Return {
return {
'_return': !exists(json, 'return') ? undefined : json['return'],
};
}
export function ReturnToJSON(value?: Return): any {
if (value === undefined) {
return undefined;
}
return {
'return': value._return,
};
}

View File

@ -0,0 +1 @@
export * from './Return';

View File

@ -0,0 +1,267 @@
// tslint:disable
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export const BASE_PATH = "http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r".replace(/\/+$/, "");
/**
* This is the base class for all generated API classes.
*/
export class BaseAPI {
private middleware: Middleware[];
constructor(protected configuration = new Configuration()) {
this.middleware = configuration.middleware;
}
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
const next = this.clone<T>();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware<T>(...middlewares);
}
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware<T>(...middlewares);
}
protected async request(context: RequestOpts): Promise<Response> {
const { url, init } = this.createFetchParams(context);
const response = await this.fetchApi(url, init);
if (response.status >= 200 && response.status < 300) {
return response;
}
throw response;
}
private createFetchParams(context: RequestOpts) {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + querystring(context.query);
}
const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body);
const init = {
method: context.method,
headers: context.headers,
body,
};
return { url, init };
}
private fetchApi = async (url: string, init: RequestInit) => {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = await middleware.pre({
fetch: this.fetchApi,
...fetchParams,
}) || fetchParams;
}
}
let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init);
for (const middleware of this.middleware) {
if (middleware.post) {
response = await middleware.post({
fetch: this.fetchApi,
url,
init,
response: response.clone(),
}) || response;
}
}
return response;
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone<T extends BaseAPI>(this: T): T {
const constructor = this.constructor as any;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
};
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export type FetchAPI = GlobalFetch['fetch'];
export interface ConfigurationParameters {
basePath?: string; // override base path
fetchApi?: FetchAPI; // override for fetch implementation
middleware?: Middleware[]; // middleware to apply before/after fetch requests
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
accessToken?: string | ((name: string, scopes?: string[]) => string); // parameter for oauth2 security
}
export class Configuration {
constructor(private configuration: ConfigurationParameters = {}) {}
get basePath(): string {
return this.configuration.basePath || BASE_PATH;
}
get fetchApi(): FetchAPI {
return this.configuration.fetchApi || window.fetch.bind(window);
}
get middleware(): Middleware[] {
return this.configuration.middleware || [];
}
get username(): string | undefined {
return this.configuration.username;
}
get password(): string | undefined {
return this.configuration.password;
}
get apiKey(): ((name: string) => string) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : () => accessToken;
}
return undefined;
}
}
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
export type HTTPHeaders = { [key: string]: string };
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> };
export type HTTPBody = Json | FormData;
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}
export function querystring(params: HTTPQuery) {
return Object.keys(params)
.map((key) => {
const value = params[key];
if (value instanceof Array) {
const multiValue = value.join(`&${encodeURIComponent(key)}=`);
return `${encodeURIComponent(key)}=${multiValue}`;
}
return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`
})
.join('&');
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export class JSONApiResponse<T> {
constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
async value() {
return this.transformer(await this.raw.json());
}
}
export class VoidApiResponse {
constructor(public raw: Response) {}
async value() {
return undefined;
}
}
export class BlobApiResponse {
constructor(public raw: Response) {}
async value() {
return await this.raw.blob();
};
}
export class TextApiResponse {
constructor(public raw: Response) {}
async value() {
return await this.raw.text();
};
}

View File

@ -0,0 +1,17 @@
{
"compilerOptions": {
"declaration": true,
"target": "es5",
"module": "commonjs",
"outDir": "dist",
"rootDir": ".",
"lib": [
"es6",
"dom"
]
},
"exclude": [
"dist",
"node_modules"
]
}

View File

@ -1,12 +1,12 @@
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
@ -27,7 +27,7 @@ import { COLLECTION_FORMATS } from '../variables';
@injectable()
export class FakeService {
private basePath: string = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
private basePath: string = 'http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
constructor(@inject("IApiHttpClient") private httpClient: IHttpClient,
@inject("IAPIConfiguration") private APIConfiguration: IAPIConfiguration ) {
@ -37,8 +37,8 @@ export class FakeService {
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r
*/
public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, observe?: 'body', headers?: Headers): Observable<any>;

View File

@ -0,0 +1,22 @@
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
*/
export interface Return {
/**
* property description *_/ ' \" =end -- \\r\\n \\n \\r
*/
_return?: number;
}

View File

@ -1 +1 @@
3.0.3-SNAPSHOT
4.0.0-SNAPSHOT

View File

@ -18,7 +18,7 @@ import Promise = require('bluebird');
import { ObjectSerializer, Authentication, HttpBasicAuth, ApiKeyAuth, OAuth, VoidAuth } from '../model/models';
let defaultBasePath = 'petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
let defaultBasePath = 'http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r';
// ===============================================
// This file is autogenerated - Please do not edit
@ -70,11 +70,11 @@ export class FakeApi {
}
/**
*
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
* @param UNKNOWN_BASE_TYPE
* @param testCodeInjectEndRnNR To test code injection *_/ &#39; \\\&quot; &#x3D;end -- \\\\r\\\\n \\\\n \\\\r
*/
public testCodeInjectEndRnNR (UNKNOWN_BASE_TYPE?: any) : Promise<{ response: http.ClientResponse; body?: any; }> {
public testCodeInjectEndRnNR (testCodeInjectEndRnNR?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/fake';
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
@ -83,6 +83,10 @@ export class FakeApi {
let localVarUseFormData = false;
if (testCodeInjectEndRnNR !== undefined) {
localVarFormParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = ObjectSerializer.serialize(testCodeInjectEndRnNR, "string");
}
let localVarRequestOptions: localVarRequest.Options = {
method: 'PUT',
qs: localVarQueryParameters,
@ -90,7 +94,6 @@ export class FakeApi {
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: ObjectSerializer.serialize(UNKNOWN_BASE_TYPE, "any")
};
this.authentications.default.applyToRequest(localVarRequestOptions);

View File

@ -1,8 +1,8 @@
export * from './modelReturn';
export * from './return';
import localVarRequest = require('request');
import { ModelReturn } from './modelReturn';
import { Return } from './return';
/* tslint:disable:no-unused-variable */
let primitives = [
@ -20,7 +20,7 @@ let enumsMap: {[index: string]: any} = {
}
let typeMap: {[index: string]: any} = {
"ModelReturn": ModelReturn,
"Return": Return,
}
export class ObjectSerializer {
@ -74,7 +74,7 @@ export class ObjectSerializer {
}
return transformedData;
} else if (type === "Date") {
return data.toString();
return data.toISOString();
} else {
if (enumsMap[type]) {
return data;

View File

@ -0,0 +1,36 @@
/**
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
*/
export class Return {
/**
* property description *_/ ' \" =end -- \\r\\n \\n \\r
*/
'_return'?: number;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "_return",
"baseName": "return",
"type": "number"
} ];
static getAttributeTypeMap() {
return Return.attributeTypeMap;
}
}

View File

@ -418,7 +418,7 @@ export class PetService {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -170,7 +170,7 @@ export class StoreService {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -418,7 +418,7 @@ export class PetService {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -170,7 +170,7 @@ export class StoreService {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -419,7 +419,7 @@ export class PetService implements PetServiceInterface {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -171,7 +171,7 @@ export class StoreService implements StoreServiceInterface {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -291,7 +291,7 @@ export class PetService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -110,7 +110,7 @@ export class StoreService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -418,7 +418,7 @@ export class PetService {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -170,7 +170,7 @@ export class StoreService {
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -291,7 +291,7 @@ export class PetService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -110,7 +110,7 @@ export class StoreService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -291,7 +291,7 @@ export class PetService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -110,7 +110,7 @@ export class StoreService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -293,7 +293,7 @@ export class PetService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -112,7 +112,7 @@ export class StoreService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -293,7 +293,7 @@ export class PetService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -112,7 +112,7 @@ export class StoreService {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
if (this.configuration.apiKeys && this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}

View File

@ -187,7 +187,7 @@ export class PetService {
}
// authentication (api_key) required
if (this.APIConfiguration.apiKeys["api_key"]) {
if (this.APIConfiguration.apiKeys && this.APIConfiguration.apiKeys["api_key"]) {
headers['api_key'] = this.APIConfiguration.apiKeys["api_key"];
}
headers['Accept'] = 'application/xml';

View File

@ -68,7 +68,7 @@ export class StoreService {
public getInventory(observe?: 'response', headers?: Headers): Observable<HttpResponse<{ [key: string]: number; }>>;
public getInventory(observe: any = 'body', headers: Headers = {}): Observable<any> {
// authentication (api_key) required
if (this.APIConfiguration.apiKeys["api_key"]) {
if (this.APIConfiguration.apiKeys && this.APIConfiguration.apiKeys["api_key"]) {
headers['api_key'] = this.APIConfiguration.apiKeys["api_key"];
}
headers['Accept'] = 'application/json';