From 0984ef723cbad5ed500827db75ae1c63519a4868 Mon Sep 17 00:00:00 2001 From: qasim Date: Sun, 24 Mar 2024 00:19:02 +0300 Subject: [PATCH 1/2] [typescript-axios] Add support for AWSv4 Signature --- docs/generators/typescript-axios.md | 3 ++- .../TypeScriptAxiosClientCodegen.java | 14 +++++++++- .../resources/typescript-axios/api.mustache | 2 +- .../typescript-axios/apiInner.mustache | 6 ++++- .../typescript-axios/common.mustache | 24 ++++++++++++++++- .../typescript-axios/configuration.mustache | 26 ++++++++++++++++++- .../typescript-axios/package.mustache | 6 +++++ .../echo_api/typescript-axios/build/common.ts | 3 ++- .../typescript-axios/build/configuration.ts | 26 ++++++++++++++++++- .../common.ts | 3 ++- .../configuration.ts | 26 ++++++++++++++++++- .../builds/composed-schemas/common.ts | 3 ++- .../builds/composed-schemas/configuration.ts | 26 ++++++++++++++++++- .../typescript-axios/builds/default/common.ts | 3 ++- .../builds/default/configuration.ts | 26 ++++++++++++++++++- .../builds/es6-target/common.ts | 3 ++- .../builds/es6-target/configuration.ts | 26 ++++++++++++++++++- .../builds/test-petstore/common.ts | 3 ++- .../builds/test-petstore/configuration.ts | 26 ++++++++++++++++++- .../builds/with-complex-headers/common.ts | 3 ++- .../with-complex-headers/configuration.ts | 26 ++++++++++++++++++- .../common.ts | 3 ++- .../configuration.ts | 26 ++++++++++++++++++- .../builds/with-interfaces/common.ts | 3 ++- .../builds/with-interfaces/configuration.ts | 26 ++++++++++++++++++- .../builds/with-node-imports/common.ts | 3 ++- .../builds/with-node-imports/configuration.ts | 26 ++++++++++++++++++- .../common.ts | 3 ++- .../configuration.ts | 26 ++++++++++++++++++- .../builds/with-npm-version/common.ts | 3 ++- .../builds/with-npm-version/configuration.ts | 26 ++++++++++++++++++- .../with-single-request-parameters/common.ts | 3 ++- .../configuration.ts | 26 ++++++++++++++++++- .../builds/with-string-enums/common.ts | 3 ++- .../builds/with-string-enums/configuration.ts | 26 ++++++++++++++++++- 35 files changed, 453 insertions(+), 34 deletions(-) diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 253dbb0801cf..42e7efd3122c 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -44,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |withNodeImports|Setting this property to true adds imports for NodeJS| |false| |withSeparateModelsAndApi|Put the model and api in separate folders and in separate classes. This requires in addition a value for 'apiPackage' and 'modelPackage'| |false| |withoutPrefixEnums|Don't prefix enum names with class names| |false| +|withAWSV4Signature|whether to include AWS v4 signature support| |false| ## IMPORT MAPPING @@ -265,7 +266,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 |SignatureAuth|✗|OAS3 -|AWSV4Signature|✗|ToolingExtension +|AWSV4Signature|✓|ToolingExtension ### Wire Format Feature | Name | Supported | Defined By | diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java index 5b9aba6ab0b3..9436f3486ce4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -42,9 +42,11 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege public static final String WITH_NODE_IMPORTS = "withNodeImports"; public static final String STRING_ENUMS = "stringEnums"; public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values."; + public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature"; protected String npmRepository = null; protected Boolean stringEnums = false; + protected boolean withAWSV4Signature = false; private String tsModelPackage = ""; @@ -53,7 +55,7 @@ public TypeScriptAxiosClientCodegen() { modifyFeatureSet(features -> features .includeDocumentationFeatures(DocumentationFeature.Readme) - .includeSecurityFeatures(SecurityFeature.BearerToken)); + .includeSecurityFeatures(SecurityFeature.BearerToken, SecurityFeature.AWSV4Signature)); // clear import mapping (from default generator) as TS does not use it // at the moment @@ -73,6 +75,7 @@ public TypeScriptAxiosClientCodegen() { this.cliOptions.add(new CliOption(USE_SINGLE_REQUEST_PARAMETER, "Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(WITH_NODE_IMPORTS, "Setting this property to true adds imports for NodeJS", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC).defaultValue(String.valueOf(this.stringEnums))); + this.cliOptions.add(new CliOption(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); // Templates have no mapping between formatted property names and original base names so use only "original" and remove this option removeOption(CodegenConstants.MODEL_PROPERTY_NAMING); } @@ -152,6 +155,11 @@ public void processOpts() { addNpmPackageGeneration(); } + if (additionalProperties.containsKey(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT)) { + this.setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT).toString())); + } + additionalProperties.put(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, withAWSV4Signature); + } @Override @@ -266,6 +274,10 @@ public ModelsMap postProcessModels(ModelsMap objs) { return objs; } + public void setWithAWSV4Signature(boolean withAWSV4Signature) { + this.withAWSV4Signature = withAWSV4Signature; + } + /** * Overriding toRegularExpression() to avoid escapeText() being called, * as it would return a broken regular expression if any escaped character / metacharacter were present. diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache index a6a13e318204..c54984d39b0a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache @@ -16,7 +16,7 @@ import FormData from 'form-data' {{/withNodeImports}} // Some imports not used depending on template conditions // @ts-ignore -import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction{{#withAWSV4Signature}}, setAWS4SignatureInterceptor{{/withAWSV4Signature}} } from './common'; import type { RequestArgs } from './base'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; 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 e008a6d830ec..1ccff18419ae 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache @@ -16,7 +16,7 @@ import FormData from 'form-data' {{/withNodeImports}} // Some imports not used depending on template conditions // @ts-ignore -import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '{{apiRelativeToRoot}}common'; +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction{{#withAWSV4Signature}}, setAWS4SignatureInterceptor{{/withAWSV4Signature}} } from '{{apiRelativeToRoot}}common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '{{apiRelativeToRoot}}base'; {{#imports}} @@ -71,6 +71,10 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{#authMethods}} // authentication {{name}} required {{#isApiKey}} + {{#withAWSV4Signature}} + // aws v4 signature authentication required + await setAWS4SignatureInterceptor(globalAxios, configuration) + {{/withAWSV4Signature}} {{#isKeyInHeader}} await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration) {{/isKeyInHeader}} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache index 004fc11fdae8..ef7ebbb21922 100755 --- a/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/common.mustache @@ -4,7 +4,10 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; +{{#withAWSV4Signature}} +import { aws4Interceptor } from "aws4-axios"; +{{/withAWSV4Signature}} import { RequiredError } from "./base"; {{#withNodeImports}} import { URL, URLSearchParams } from 'url'; @@ -76,6 +79,25 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } +{{#withAWSV4Signature}} +export const setAWS4SignatureInterceptor = async function (globalAxios: AxiosInstance, configuration?: Configuration) { + if (configuration && configuration.awsv4) { + const interceptor = aws4Interceptor({ + options: { + region: configuration.awsv4?.options?.region ?? process.env.AWS_REGION ?? 'us-east-1', + service: configuration.awsv4?.options?.service ?? 'execute-api', + }, + credentials: { + accessKeyId: configuration.awsv4?.credentials?.accessKeyId ?? process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: configuration.awsv4?.credentials?.secretAccessKey ?? process.env.AWS_SECRET_ACCESS_KEY, + sessionToken: configuration.awsv4?.credentials?.sessionToken ?? process.env.AWS_SESSION_TOKEN + }, + }); + globalAxios.interceptors.request.use(interceptor); + } +} +{{/withAWSV4Signature}} + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 836f1275095d..666ae08f0711 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache @@ -1,12 +1,24 @@ /* tslint:disable */ -/* eslint-disable */ {{>licenseInfo}} +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -41,6 +53,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -76,6 +99,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache index da599f177877..7f91056ca4cc 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache @@ -26,7 +26,13 @@ "prepare": "npm run build" }, "dependencies": { + {{#withAWSV4Signature}} + "axios": "^1.6.1", + "aws4-axios": "^3.3.4" + {{/withAWSV4Signature}} + {{^withAWSV4Signature}} "axios": "^1.6.1" + {{/withAWSV4Signature}} }, "devDependencies": { "@types/node": "^12.11.5", diff --git a/samples/client/echo_api/typescript-axios/build/common.ts b/samples/client/echo_api/typescript-axios/build/common.ts index c4b85d352ca7..f37fe38c9afb 100644 --- a/samples/client/echo_api/typescript-axios/build/common.ts +++ b/samples/client/echo_api/typescript-axios/build/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/echo_api/typescript-axios/build/configuration.ts b/samples/client/echo_api/typescript-axios/build/configuration.ts index c952b7aefd76..43b3fdbe2cd1 100644 --- a/samples/client/echo_api/typescript-axios/build/configuration.ts +++ b/samples/client/echo_api/typescript-axios/build/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * Echo Server API * Echo Server API @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts index 71ef49eebeb4..56dfe757b504 100644 --- a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts index 2b516f9129ed..b5f3c65b7c4a 100644 --- a/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts +++ b/samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * Example * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts b/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts index 259040a2b386..b391909a8571 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 46522502419f..00024cde3d3d 100644 --- a/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/composed-schemas/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * Example * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/default/common.ts b/samples/client/petstore/typescript-axios/builds/default/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/default/common.ts +++ b/samples/client/petstore/typescript-axios/builds/default/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/petstore/typescript-axios/builds/default/configuration.ts b/samples/client/petstore/typescript-axios/builds/default/configuration.ts index d05f5a0d0835..c9677227e3d8 100644 --- a/samples/client/petstore/typescript-axios/builds/default/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/default/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/common.ts b/samples/client/petstore/typescript-axios/builds/es6-target/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/common.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 d05f5a0d0835..c9677227e3d8 100644 --- a/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/common.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/common.ts index e1b019a31500..9d9f6f9c1675 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/common.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/petstore/typescript-axios/builds/test-petstore/configuration.ts b/samples/client/petstore/typescript-axios/builds/test-petstore/configuration.ts index c8051a678dcf..0f4f15698e66 100644 --- a/samples/client/petstore/typescript-axios/builds/test-petstore/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/test-petstore/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts b/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 d05f5a0d0835..c9677227e3d8 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 @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts index e1b019a31500..9d9f6f9c1675 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts index c8051a678dcf..0f4f15698e66 100644 --- a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 d05f5a0d0835..c9677227e3d8 100644 --- a/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-node-imports/common.ts b/samples/client/petstore/typescript-axios/builds/with-node-imports/common.ts index 25f8cc331dce..c6cf4a70cf97 100644 --- a/samples/client/petstore/typescript-axios/builds/with-node-imports/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-node-imports/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; import { URL, URLSearchParams } from 'url'; @@ -85,6 +85,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/petstore/typescript-axios/builds/with-node-imports/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-node-imports/configuration.ts index d05f5a0d0835..c9677227e3d8 100644 --- a/samples/client/petstore/typescript-axios/builds/with-node-imports/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-node-imports/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 d05f5a0d0835..c9677227e3d8 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 @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 d05f5a0d0835..c9677227e3d8 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 @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-single-request-parameters/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { 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 d05f5a0d0835..c9677227e3d8 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 @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; diff --git a/samples/client/petstore/typescript-axios/builds/with-string-enums/common.ts b/samples/client/petstore/typescript-axios/builds/with-string-enums/common.ts index c58729d6aaf5..08f5805c6c95 100644 --- a/samples/client/petstore/typescript-axios/builds/with-string-enums/common.ts +++ b/samples/client/petstore/typescript-axios/builds/with-string-enums/common.ts @@ -15,7 +15,7 @@ import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** @@ -84,6 +84,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope } } + function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { if (parameter == null) return; if (typeof parameter === "object") { diff --git a/samples/client/petstore/typescript-axios/builds/with-string-enums/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-string-enums/configuration.ts index d05f5a0d0835..c9677227e3d8 100644 --- a/samples/client/petstore/typescript-axios/builds/with-string-enums/configuration.ts +++ b/samples/client/petstore/typescript-axios/builds/with-string-enums/configuration.ts @@ -1,5 +1,4 @@ /* tslint:disable */ -/* eslint-disable */ /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. @@ -13,11 +12,24 @@ */ +interface AWSv4Configuration { + options?: { + region?: string + service?: string + } + credentials?: { + accessKeyId?: string + secretAccessKey?: string, + sessionToken?: string + } +} + export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + awsv4?: AWSv4Configuration; basePath?: string; serverIndex?: number; baseOptions?: any; @@ -52,6 +64,17 @@ export class Configuration { * @memberof Configuration */ accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * parameter for aws4 signature security + * @param {Object} AWS4Signature - AWS4 Signature security + * @param {string} options.region - aws region + * @param {string} options.service - name of the service. + * @param {string} credentials.accessKeyId - aws access key id + * @param {string} credentials.secretAccessKey - aws access key + * @param {string} credentials.sessionToken - aws session token + * @memberof Configuration + */ + awsv4?: AWSv4Configuration; /** * override base path * @@ -87,6 +110,7 @@ export class Configuration { this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; + this.awsv4 = param.awsv4; this.basePath = param.basePath; this.serverIndex = param.serverIndex; this.baseOptions = param.baseOptions; From d04f4c11cc6b2cd6a9c725b9af9c0456005d0062 Mon Sep 17 00:00:00 2001 From: qasim Date: Sun, 24 Mar 2024 00:52:14 +0300 Subject: [PATCH 2/2] update typescript-axios.md file --- docs/generators/typescript-axios.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 42e7efd3122c..89a9b0e7d501 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -40,11 +40,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl |stringEnums|Generate string enums instead of objects for enum values.| |false| |supportsES6|Generate code that conforms to ES6.| |false| |useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false| +|withAWSV4Signature|whether to include AWS v4 signature support| |false| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| |withNodeImports|Setting this property to true adds imports for NodeJS| |false| |withSeparateModelsAndApi|Put the model and api in separate folders and in separate classes. This requires in addition a value for 'apiPackage' and 'modelPackage'| |false| |withoutPrefixEnums|Don't prefix enum names with class names| |false| -|withAWSV4Signature|whether to include AWS v4 signature support| |false| ## IMPORT MAPPING