From f752f29af202885e6b817e5ec002facee1ef0c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20M=C3=BCller?= Date: Wed, 5 Aug 2020 14:23:06 +0200 Subject: [PATCH] [typescript-axios] add promise to bearer and oauth tokens (#7132) --- .../typescript-axios/apiInner.mustache | 8 +++--- .../typescript-axios/configuration.mustache | 10 +++---- .../builds/composed-schemas/configuration.ts | 10 +++---- .../typescript-axios/builds/default/api.ts | 28 +++++++++---------- .../builds/default/configuration.ts | 10 +++---- .../typescript-axios/builds/es6-target/api.ts | 28 +++++++++---------- .../builds/es6-target/configuration.ts | 10 +++---- .../builds/with-complex-headers/api.ts | 28 +++++++++---------- .../with-complex-headers/configuration.ts | 10 +++---- .../builds/with-interfaces/api.ts | 28 +++++++++---------- .../builds/with-interfaces/configuration.ts | 10 +++---- .../api/another/level/pet-api.ts | 28 +++++++++---------- .../configuration.ts | 10 +++---- .../builds/with-npm-version/api.ts | 28 +++++++++---------- .../builds/with-npm-version/configuration.ts | 10 +++---- .../with-single-request-parameters/api.ts | 28 +++++++++---------- .../configuration.ts | 10 +++---- 17 files changed, 147 insertions(+), 147 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache index 832bca8e5132..778e33a9bf89 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache @@ -87,8 +87,8 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur // http bearer authentication required if (configuration && configuration.accessToken) { const accessToken = typeof configuration.accessToken === 'function' - ? configuration.accessToken() - : configuration.accessToken; + ? await configuration.accessToken() + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; } {{/isBasicBearer}} @@ -96,8 +96,8 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) - : configuration.accessToken; + ? await configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } {{/isOAuth}} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache index 49fc09da60a7..ae7e0dcc25c2 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache @@ -6,7 +6,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -20,14 +20,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -38,10 +38,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts index dbeeafb2da99..185f3bbb0025 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/default/api.ts b/samples/client/petstore/typescript-axios/builds/default/api.ts index 3e03d994edf3..6077387d660f 100644 --- a/samples/client/petstore/typescript-axios/builds/default/api.ts +++ b/samples/client/petstore/typescript-axios/builds/default/api.ts @@ -279,8 +279,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -335,8 +335,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -389,8 +389,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -443,8 +443,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -547,8 +547,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -605,8 +605,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -670,8 +670,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/default/configuration.ts b/samples/client/petstore/typescript-axios/builds/default/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/default/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts index 3e03d994edf3..6077387d660f 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts @@ -279,8 +279,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -335,8 +335,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -389,8 +389,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -443,8 +443,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -547,8 +547,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -605,8 +605,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -670,8 +670,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts b/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts b/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts index 8fa42b0091d0..e70e4cf32966 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/api.ts @@ -319,8 +319,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -384,8 +384,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -438,8 +438,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -492,8 +492,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -596,8 +596,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -654,8 +654,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -719,8 +719,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-complex-headers/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts index 2c483d7f6589..3cffd8160208 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts @@ -279,8 +279,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -335,8 +335,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -389,8 +389,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -443,8 +443,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -547,8 +547,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -605,8 +605,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -670,8 +670,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts index 26c6e9639ad6..c7aaed7a17aa 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/api/another/level/pet-api.ts @@ -55,8 +55,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -111,8 +111,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -165,8 +165,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -219,8 +219,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -323,8 +323,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -381,8 +381,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -446,8 +446,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts index 3e03d994edf3..6077387d660f 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts @@ -279,8 +279,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -335,8 +335,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -389,8 +389,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -443,8 +443,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -547,8 +547,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -605,8 +605,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -670,8 +670,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */ diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts index 28f2240908e8..036a01032123 100644 --- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/api.ts @@ -279,8 +279,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -335,8 +335,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -389,8 +389,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -443,8 +443,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -547,8 +547,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -605,8 +605,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } @@ -670,8 +670,8 @@ export const PetApiAxiosParamCreator = function (configuration?: Configuration) // oauth required if (configuration && configuration.accessToken) { const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) - : configuration.accessToken; + ? await configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : await configuration.accessToken; localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; } diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/configuration.ts index 96fa41b21122..11ebab3da28e 100644 --- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/configuration.ts @@ -17,7 +17,7 @@ export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); basePath?: string; baseOptions?: any; } @@ -31,14 +31,14 @@ export class Configuration { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ username?: string; /** * parameter for basic security - * + * * @type {string} * @memberof Configuration */ @@ -49,10 +49,10 @@ export class Configuration { * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | ((name?: string, scopes?: string[]) => string); + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); /** * override base path - * + * * @type {string} * @memberof Configuration */