forked from loafle/openapi-generator-original
[Typescript - Angular2] Add support for multiple API Keys (#5236)
# Conflicts: # modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache # samples/client/petstore/typescript-angular2/default/configuration.ts # samples/client/petstore/typescript-angular2/npm/configuration.ts
This commit is contained in:
@@ -184,14 +184,14 @@ export class {{classname}} {
|
||||
// authentication ({{name}}) required
|
||||
{{#isApiKey}}
|
||||
{{#isKeyInHeader}}
|
||||
if (this.configuration.apiKey) {
|
||||
headers.set('{{keyParamName}}', this.configuration.apiKey);
|
||||
if (this.configuration.apiKeys["{{keyParamName}}"]) {
|
||||
headers.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]);
|
||||
}
|
||||
|
||||
{{/isKeyInHeader}}
|
||||
{{#isKeyInQuery}}
|
||||
if (this.configuration.apiKey) {
|
||||
queryParameters.set('{{keyParamName}}', this.configuration.apiKey);
|
||||
if (this.configuration.apiKeys["{{keyParamName}}"]) {
|
||||
queryParameters.set('{{keyParamName}}', this.configuration.apiKeys["{{keyParamName}}"]);
|
||||
}
|
||||
|
||||
{{/isKeyInQuery}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string;
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string;
|
||||
@@ -7,7 +7,7 @@ export interface ConfigurationParameters {
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
apiKey: string;
|
||||
apiKeys: {[ key: string ]: string};
|
||||
username: string;
|
||||
password: string;
|
||||
accessToken: string | (() => string);
|
||||
@@ -15,7 +15,7 @@ export class Configuration {
|
||||
|
||||
|
||||
constructor(configurationParameters: ConfigurationParameters = {}) {
|
||||
this.apiKey = configurationParameters.apiKey;
|
||||
this.apiKeys = configurationParameters.apiKeys;
|
||||
this.username = configurationParameters.username;
|
||||
this.password = configurationParameters.password;
|
||||
this.accessToken = configurationParameters.accessToken;
|
||||
|
||||
@@ -429,8 +429,8 @@ export class PetService {
|
||||
}
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey) {
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
if (this.configuration.apiKeys["api_key"]) {
|
||||
headers.set('api_key', this.configuration.apiKeys["api_key"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -191,8 +191,8 @@ export class StoreService {
|
||||
];
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey) {
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
if (this.configuration.apiKeys["api_key"]) {
|
||||
headers.set('api_key', this.configuration.apiKeys["api_key"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string;
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string;
|
||||
@@ -7,7 +7,7 @@ export interface ConfigurationParameters {
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
apiKey: string;
|
||||
apiKeys: {[ key: string ]: string};
|
||||
username: string;
|
||||
password: string;
|
||||
accessToken: string | (() => string);
|
||||
@@ -15,7 +15,7 @@ export class Configuration {
|
||||
|
||||
|
||||
constructor(configurationParameters: ConfigurationParameters = {}) {
|
||||
this.apiKey = configurationParameters.apiKey;
|
||||
this.apiKeys = configurationParameters.apiKeys;
|
||||
this.username = configurationParameters.username;
|
||||
this.password = configurationParameters.password;
|
||||
this.accessToken = configurationParameters.accessToken;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703211709
|
||||
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703271250
|
||||
|
||||
### Building
|
||||
|
||||
@@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's.
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703211709 --save
|
||||
npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703271250 --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
||||
@@ -429,8 +429,8 @@ export class PetService {
|
||||
}
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey) {
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
if (this.configuration.apiKeys["api_key"]) {
|
||||
headers.set('api_key', this.configuration.apiKeys["api_key"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -191,8 +191,8 @@ export class StoreService {
|
||||
];
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey) {
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
if (this.configuration.apiKeys["api_key"]) {
|
||||
headers.set('api_key', this.configuration.apiKeys["api_key"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string;
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string;
|
||||
@@ -7,7 +7,7 @@ export interface ConfigurationParameters {
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
apiKey: string;
|
||||
apiKeys: {[ key: string ]: string};
|
||||
username: string;
|
||||
password: string;
|
||||
accessToken: string | (() => string);
|
||||
@@ -15,7 +15,7 @@ export class Configuration {
|
||||
|
||||
|
||||
constructor(configurationParameters: ConfigurationParameters = {}) {
|
||||
this.apiKey = configurationParameters.apiKey;
|
||||
this.apiKeys = configurationParameters.apiKeys;
|
||||
this.username = configurationParameters.username;
|
||||
this.password = configurationParameters.password;
|
||||
this.accessToken = configurationParameters.accessToken;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@swagger/angular2-typescript-petstore",
|
||||
"version": "0.0.1-SNAPSHOT.201703211709",
|
||||
"version": "0.0.1-SNAPSHOT.201703271250",
|
||||
"description": "swagger client for @swagger/angular2-typescript-petstore",
|
||||
"author": "Swagger Codegen Contributors",
|
||||
"keywords": [
|
||||
|
||||
Reference in New Issue
Block a user