Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept Promises for the apiKey configuration in the typescript-fetch generator. #17758

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ export class {{classname}} extends runtime.BaseAPI {
{{#isApiKey}}
{{#isKeyInHeader}}
if (this.configuration && this.configuration.apiKey) {
headerParameters["{{keyParamName}}"] = this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
headerParameters["{{keyParamName}}"] = await this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
}

{{/isKeyInHeader}}
{{#isKeyInQuery}}
if (this.configuration && this.configuration.apiKey) {
queryParameters["{{keyParamName}}"] = this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
queryParameters["{{keyParamName}}"] = await this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication
}

{{/isKeyInQuery}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -48,7 +48,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
queryParameters["api_key_query"] = this.configuration.apiKey("api_key_query"); // api_key_query authentication
queryParameters["api_key_query"] = await this.configuration.apiKey("api_key_query"); // api_key_query authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ConfigurationParameters {
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Configuration {
return this.configuration.password;
}

get apiKey(): ((name: string) => string) | undefined {
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.apiKey) {
queryParameters["api_key_query"] = this.configuration.apiKey("api_key_query"); // api_key_query authentication
queryParameters["api_key_query"] = await this.configuration.apiKey("api_key_query"); // api_key_query authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class PetApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class StoreApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

if (this.configuration && this.configuration.apiKey) {
headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
}

const response = await this.request({
Expand Down