forked from loafle/openapi-generator-original
Added support for async accessToken in typescript-fetch (#9659)
This commit is contained in:
@@ -167,7 +167,7 @@ export class {{classname}} extends runtime.BaseAPI {
|
||||
{{#isBasicBearer}}
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
const token = this.configuration.accessToken;
|
||||
const tokenString = typeof token === 'function' ? token("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) : token;
|
||||
const tokenString = await token("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
|
||||
|
||||
if (tokenString) {
|
||||
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
||||
@@ -192,11 +192,7 @@ export class {{classname}} extends runtime.BaseAPI {
|
||||
{{#isOAuth}}
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]);
|
||||
}
|
||||
|
||||
{{/isOAuth}}
|
||||
|
||||
@@ -124,7 +124,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -164,10 +164,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ export class FakeApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
const token = this.configuration.accessToken;
|
||||
const tokenString = typeof token === 'function' ? token("bearer_test", []) : token;
|
||||
const tokenString = await token("bearer_test", []);
|
||||
|
||||
if (tokenString) {
|
||||
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
||||
|
||||
@@ -87,11 +87,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -130,11 +126,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -173,11 +165,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -218,11 +206,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -296,11 +280,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -335,11 +315,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -396,11 +372,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -464,11 +436,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -124,11 +120,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -167,11 +159,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -212,11 +200,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -290,11 +274,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -329,11 +309,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -390,11 +366,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -124,11 +120,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -167,11 +159,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -212,11 +200,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -290,11 +274,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -329,11 +309,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -390,11 +366,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -124,11 +120,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -167,11 +159,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -212,11 +200,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -290,11 +274,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -329,11 +309,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -390,11 +366,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -124,11 +120,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -167,11 +159,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -212,11 +200,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -290,11 +274,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -329,11 +309,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -390,11 +366,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -124,11 +120,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -167,11 +159,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -212,11 +200,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -290,11 +274,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -329,11 +309,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -390,11 +366,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -261,11 +257,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -304,11 +296,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -349,11 +337,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -427,11 +411,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -466,11 +446,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -527,11 +503,7 @@ export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -124,11 +120,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -167,11 +159,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -212,11 +200,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -290,11 +274,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -329,11 +309,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -390,11 +366,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -77,11 +77,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -120,11 +116,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -163,11 +155,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -208,11 +196,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -286,11 +270,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -325,11 +305,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
@@ -386,11 +362,7 @@ export class PetApi extends runtime.BaseAPI {
|
||||
|
||||
if (this.configuration && this.configuration.accessToken) {
|
||||
// oauth required
|
||||
if (typeof this.configuration.accessToken === 'function') {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
} else {
|
||||
headerParameters["Authorization"] = this.configuration.accessToken;
|
||||
}
|
||||
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
||||
}
|
||||
|
||||
const consumes: runtime.Consume[] = [
|
||||
|
||||
@@ -135,7 +135,7 @@ export interface ConfigurationParameters {
|
||||
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
|
||||
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
|
||||
}
|
||||
@@ -175,10 +175,10 @@ export class Configuration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
|
||||
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
|
||||
const accessToken = this.configuration.accessToken;
|
||||
if (accessToken) {
|
||||
return typeof accessToken === 'function' ? accessToken : () => accessToken;
|
||||
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user