From d84e8cee060b42248ed9082f407179790dc20862 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Fri, 6 Dec 2024 15:55:51 -0500 Subject: [PATCH 1/2] SWI-6691 Update to v7.10.0 --- base.ts | 2 - configuration.ts | 8 +- custom_templates/baseApi.mustache | 118 ------------------------ custom_templates/configuration.mustache | 105 +++++++++++++++++++++ 4 files changed, 112 insertions(+), 121 deletions(-) delete mode 100644 custom_templates/baseApi.mustache create mode 100644 custom_templates/configuration.mustache diff --git a/base.ts b/base.ts index e740eb9..248eb2c 100644 --- a/base.ts +++ b/base.ts @@ -21,8 +21,6 @@ import globalAxios from 'axios'; export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); -globalAxios.defaults.headers.common['User-Agent'] = "OpenAPI-Generator/1.0.0-dev/typescript-axios"; - /** * * @export diff --git a/configuration.ts b/configuration.ts index 7d1a91e..93c8cf0 100644 --- a/configuration.ts +++ b/configuration.ts @@ -89,7 +89,13 @@ export class Configuration { this.accessToken = param.accessToken; this.basePath = param.basePath; this.serverIndex = param.serverIndex; - this.baseOptions = param.baseOptions; + this.baseOptions = { + ...param.baseOptions, + headers: { + ...param.baseOptions?.headers, + 'User-Agent': "OpenAPI-Generator/1.0.0-dev/typescript-axios" + } + }; this.formDataCtor = param.formDataCtor; } diff --git a/custom_templates/baseApi.mustache b/custom_templates/baseApi.mustache deleted file mode 100644 index 6f9d669..0000000 --- a/custom_templates/baseApi.mustache +++ /dev/null @@ -1,118 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -{{>licenseInfo}} - -import type { Configuration } from './configuration'; -// Some imports not used depending on template conditions -// @ts-ignore -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; - -export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); - -globalAxios.defaults.headers.common['User-Agent'] = "OpenAPI-Generator{{#npmVersion}}/{{npmVersion}}{{/npmVersion}}/typescript-axios"; - -/** - * - * @export - */ -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -/** - * - * @export - * @interface RequestArgs - */ -export interface RequestArgs { - url: string; - options: RawAxiosRequestConfig; -} - -/** - * - * @export - * @class BaseAPI - */ -export class BaseAPI { - protected configuration: Configuration | undefined; - - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath ?? basePath; - } - } -}; - -/** - * - * @export - * @class RequiredError - * @extends {Error} - */ -export class RequiredError extends Error { - constructor(public field: string, msg?: string) { - super(msg); - this.name = "RequiredError" - } -} - -interface ServerMap { - [key: string]: { - url: string, - description: string, - }[]; -} - -/** - * - * @export - */ -export const operationServerMap: ServerMap = { - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers}} - {{#-first}} - "{{{classname}}}.{{{nickname}}}": [ - {{/-first}} - { - url: "{{{url}}}", - description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - variables: { - {{/-first}} - {{{name}}}: { - description: "{{{description}}}{{^description}}No description provided{{/description}}", - default_value: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - enum_values: [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{#-last}} - ], - {{/-last}} - {{/servers}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} -} diff --git a/custom_templates/configuration.mustache b/custom_templates/configuration.mustache new file mode 100644 index 0000000..0459dda --- /dev/null +++ b/custom_templates/configuration.mustache @@ -0,0 +1,105 @@ +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} + +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); + basePath?: string; + serverIndex?: number; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + this.baseOptions = { + ...param.baseOptions, + headers: { + ...param.baseOptions?.headers, + 'User-Agent': "OpenAPI-Generator{{#npmVersion}}/{{npmVersion}}{{/npmVersion}}/typescript-axios" + } + }; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} From 4f3bbee30ab00111e3e68a2cfec576d3385be435 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Fri, 6 Dec 2024 15:57:26 -0500 Subject: [PATCH 2/2] remove old template and regenerate --- .openapi-generator/VERSION | 2 +- custom_templates/apiInner.mustache | 467 ----------------------------- openapitools.json | 2 +- 3 files changed, 2 insertions(+), 469 deletions(-) delete mode 100644 custom_templates/apiInner.mustache diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 4bc5d61..758bb9c 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.9.0 +7.10.0 diff --git a/custom_templates/apiInner.mustache b/custom_templates/apiInner.mustache deleted file mode 100644 index 48aadcb..0000000 --- a/custom_templates/apiInner.mustache +++ /dev/null @@ -1,467 +0,0 @@ -{{#withSeparateModelsAndApi}} -/* tslint:disable */ -/* eslint-disable */ -{{>licenseInfo}} - -import type { Configuration } from '{{apiRelativeToRoot}}configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; -{{#withNodeImports}} -// URLSearchParams not necessarily used -// @ts-ignore -import { URL, URLSearchParams } from 'url'; -{{#multipartFormData}} -import FormData from 'form-data' -{{/multipartFormData}} -{{/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'; -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '{{apiRelativeToRoot}}base'; -{{#imports}} -// @ts-ignore -import type { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}'; -{{/imports}} -{{/withSeparateModelsAndApi}} -{{^withSeparateModelsAndApi}} -{{/withSeparateModelsAndApi}} -{{#operations}} -/** - * {{classname}} - axios parameter creator{{#description}} - * {{&description}}{{/description}} - * @export - */ -export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) { - return { - {{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{=<% %>=}}{<%#isEnum%><%&datatypeWithEnum%><%/isEnum%><%^isEnum%><%&dataType%><%#isNullable%> | null<%/isNullable%><%/isEnum%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/allParams}} - * @param {*} [options] Override http request option.{{#isDeprecated}} - * @deprecated{{/isDeprecated}} - * @throws {RequiredError} - */ - {{nickname}}: async ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}options: RawAxiosRequestConfig = {}): Promise => { - {{#allParams}} - {{#required}} - // verify required parameter '{{paramName}}' is not null or undefined - assertParamExists('{{nickname}}', '{{paramName}}', {{paramName}}) - {{/required}} - {{/allParams}} - const localVarPath = `{{{path}}}`{{#pathParams}} - .replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}}; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}} - const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}((configuration && configuration.formDataCtor) || FormData)(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}} - - {{#authMethods}} - // authentication {{name}} required - {{#isApiKey}} - {{#isKeyInHeader}} - await setApiKeyToObject(localVarHeaderParameter, "{{keyParamName}}", configuration) - {{/isKeyInHeader}} - {{#isKeyInQuery}} - await setApiKeyToObject(localVarQueryParameter, "{{keyParamName}}", configuration) - {{/isKeyInQuery}} - {{/isApiKey}} - {{#isBasicBasic}} - // http basic authentication required - setBasicAuthToObject(localVarRequestOptions, configuration) - {{/isBasicBasic}} - {{#isBasicBearer}} - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - {{/isBasicBearer}} - {{#isOAuth}} - // oauth required - await setOAuthToObject(localVarHeaderParameter, "{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}], configuration) - {{/isOAuth}} - - {{/authMethods}} - {{#queryParams}} - {{#isArray}} - if ({{paramName}}) { - {{#isCollectionFormatMulti}} - {{#uniqueItems}} - localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}); - {{/uniqueItems}} - {{^uniqueItems}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/uniqueItems}} - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - {{#uniqueItems}} - localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}}); - {{/uniqueItems}} - {{^uniqueItems}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}); - {{/uniqueItems}} - {{/isCollectionFormatMulti}} - } - {{/isArray}} - {{^isArray}} - if ({{paramName}} !== undefined) { - {{#isDateTime}} - localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? - ({{paramName}} as any).toISOString() : - {{paramName}}; - {{/isDateTime}} - {{^isDateTime}} - {{#isDate}} - localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? - ({{paramName}} as any).toISOString().substring(0,10) : - {{paramName}}; - {{/isDate}} - {{^isDate}} - {{#isExplode}} - {{#isPrimitiveType}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/isPrimitiveType}} - {{^isPrimitiveType}} - {{^isEnumRef}} - {{^isEnum}} - for (const [key, value] of Object.entries({{paramName}})) { - localVarQueryParameter[key] = value; - } - {{/isEnum}} - {{/isEnumRef}} - {{#isEnum}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/isEnum}} - {{#isEnumRef}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/isEnumRef}} - {{/isPrimitiveType}} - {{/isExplode}} - {{^isExplode}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/isExplode}} - {{/isDate}} - {{/isDateTime}} - } - {{/isArray}} - - {{/queryParams}} - {{#vendorExtensions}} - {{#formParams}} - {{#isArray}} - if ({{paramName}}) { - {{#isCollectionFormatMulti}} - {{#contentType}} - localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "{{contentType}}", })); - {{/contentType}} - {{^contentType}} - {{paramName}}.forEach((element) => { - localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', element as any); - }) - {{/contentType}} - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - localVarFormParams.{{#multipartFormData}}append{{/multipartFormData}}{{^multipartFormData}}set{{/multipartFormData}}('{{baseName}}{{#useSquareBracketsInArrayNames}}[]{{/useSquareBracketsInArrayNames}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}})); - {{/isCollectionFormatMulti}} - }{{/isArray}} - {{^isArray}} - if ({{paramName}} !== undefined) { {{^multipartFormData}} - localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}}{{#isPrimitiveType}}{{^isBoolean}} - localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isBoolean}}{{/isPrimitiveType}}{{#isPrimitiveType}}{{#isBoolean}} - localVarFormParams.append('{{baseName}}', String({{paramName}}) as any);{{/isBoolean}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isEnumRef}} - localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/isEnumRef}}{{^isEnumRef}} - localVarFormParams.append('{{baseName}}', new Blob([JSON.stringify({{paramName}})], { type: "application/json", }));{{/isEnumRef}}{{/isPrimitiveType}}{{/multipartFormData}} - }{{/isArray}} - {{/formParams}}{{/vendorExtensions}} - {{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}} - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}} - localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}} - {{/hasFormParams}}{{/vendorExtensions}} - {{#bodyParam}} - {{^consumes}} - localVarHeaderParameter['Content-Type'] = 'application/json'; - {{/consumes}} - {{#consumes.0}} - localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}'; - {{/consumes.0}} - - {{/bodyParam}} - {{#headerParams}} - {{#isArray}} - if ({{paramName}}) { - {{#uniqueItems}} - let mapped = Array.from({{paramName}}).map(value => ("{{{dataType}}}" !== "Set") ? JSON.stringify(value) : (value || "")); - {{/uniqueItems}} - {{^uniqueItems}} - let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); - {{/uniqueItems}} - localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); - } - {{/isArray}} - {{^isArray}} - {{! `val == null` covers for both `null` and `undefined`}} - if ({{paramName}} != null) { - {{#isString}} - localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); - {{/isString}} - {{^isString}} - {{! isString is falsy also for $ref that defines a string or enum type}} - localVarHeaderParameter['{{baseName}}'] = typeof {{paramName}} === 'string' - ? {{paramName}} - : JSON.stringify({{paramName}}); - {{/isString}} - } - {{/isArray}} - {{/headerParams}} - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions,{{#hasFormParams}}{{#multipartFormData}} ...(localVarFormParams as any).getHeaders?.(),{{/multipartFormData}}{{/hasFormParams}} ...options.headers}; - {{#hasFormParams}} - localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}}; - {{/hasFormParams}} - {{#bodyParam}} - localVarRequestOptions.data = serializeDataIfNeeded({{paramName}}, localVarRequestOptions, configuration) - {{/bodyParam}} - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - {{/operation}} - } -}; - -/** - * {{classname}} - functional programming interface{{#description}} - * {{{.}}}{{/description}} - * @export - */ -export const {{classname}}Fp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = {{classname}}AxiosParamCreator(configuration) - return { - {{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{=<% %>=}}{<%#isEnum%><%&datatypeWithEnum%><%/isEnum%><%^isEnum%><%&dataType%><%#isNullable%> | null<%/isNullable%><%/isEnum%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/allParams}} - * @param {*} [options] Override http request option.{{#isDeprecated}} - * @deprecated{{/isDeprecated}} - * @throws {RequiredError} - */ - async {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['{{classname}}.{{nickname}}']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - {{/operation}} - } -}; - -/** - * {{classname}} - factory interface{{#description}} - * {{&description}}{{/description}} - * @export - */ -export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = {{classname}}Fp(configuration) - return { - {{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#useSingleRequestParameter}} - {{#allParams.0}} - * @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters. - {{/allParams.0}} - {{/useSingleRequestParameter}} - {{^useSingleRequestParameter}} - {{#allParams}} - * @param {{=<% %>=}}{<%#isEnum%><%&datatypeWithEnum%><%/isEnum%><%^isEnum%><%&dataType%><%#isNullable%> | null<%/isNullable%><%/isEnum%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/allParams}} - {{/useSingleRequestParameter}} - * @param {*} [options] Override http request option.{{#isDeprecated}} - * @deprecated{{/isDeprecated}} - * @throws {RequiredError} - */ - {{#useSingleRequestParameter}} - {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: RawAxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> { - return localVarFp.{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(axios, basePath)); - }, - {{/useSingleRequestParameter}} - {{^useSingleRequestParameter}} - {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}options?: RawAxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}> { - return localVarFp.{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(axios, basePath)); - }, - {{/useSingleRequestParameter}} - {{/operation}} - }; -}; - -{{#withInterfaces}} -/** - * {{classname}} - interface{{#description}} - * {{&description}}{{/description}} - * @export - * @interface {{classname}} - */ -export interface {{classname}}Interface { -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#useSingleRequestParameter}} - {{#allParams.0}} - * @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters. - {{/allParams.0}} - {{/useSingleRequestParameter}} - {{^useSingleRequestParameter}} - {{#allParams}} - * @param {{=<% %>=}}{<%#isEnum%><%&datatypeWithEnum%><%/isEnum%><%^isEnum%><%&dataType%><%#isNullable%> | null<%/isNullable%><%/isEnum%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/allParams}} - {{/useSingleRequestParameter}} - * @param {*} [options] Override http request option.{{#isDeprecated}} - * @deprecated{{/isDeprecated}} - * @throws {RequiredError} - * @memberof {{classname}}Interface - */ - {{#useSingleRequestParameter}} - {{nickname}}({{#allParams.0}}requestParameters{{^hasRequiredParams}}?{{/hasRequiredParams}}: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}options?: RawAxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>; - {{/useSingleRequestParameter}} - {{^useSingleRequestParameter}} - {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}options?: RawAxiosRequestConfig): AxiosPromise<{{{returnType}}}{{^returnType}}void{{/returnType}}>; - {{/useSingleRequestParameter}} - -{{/operation}} -} - -{{/withInterfaces}} -{{#useSingleRequestParameter}} -{{#operation}} -{{#allParams.0}} -/** - * Request parameters for {{nickname}} operation in {{classname}}. - * @export - * @interface {{classname}}{{operationIdCamelCase}}Request - */ -export interface {{classname}}{{operationIdCamelCase}}Request { - {{#allParams}} - /** - * {{description}} - * @type {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> - * @memberof {{classname}}{{operationIdCamelCase}} - */ - readonly {{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}} - {{^-last}} - - {{/-last}} - {{/allParams}} -} - -{{/allParams.0}} -{{/operation}} -{{/useSingleRequestParameter}} -/** - * {{classname}} - object-oriented interface{{#description}} - * {{{.}}}{{/description}} - * @export - * @class {{classname}} - * @extends {BaseAPI} - */ -{{#withInterfaces}} -export class {{classname}} extends BaseAPI implements {{classname}}Interface { -{{/withInterfaces}} -{{^withInterfaces}} -export class {{classname}} extends BaseAPI { -{{/withInterfaces}} - {{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#useSingleRequestParameter}} - {{#allParams.0}} - * @param {{=<% %>=}}{<%& classname %><%& operationIdCamelCase %>Request}<%={{ }}=%> requestParameters Request parameters. - {{/allParams.0}} - {{/useSingleRequestParameter}} - {{^useSingleRequestParameter}} - {{#allParams}} - * @param {{=<% %>=}}{<%#isEnum%><%&datatypeWithEnum%><%/isEnum%><%^isEnum%><%&dataType%><%#isNullable%> | null<%/isNullable%><%/isEnum%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/allParams}} - {{/useSingleRequestParameter}} - * @param {*} [options] Override http request option.{{#isDeprecated}} - * @deprecated{{/isDeprecated}} - * @throws {RequiredError} - * @memberof {{classname}} - */ - {{#useSingleRequestParameter}} - public {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options?: RawAxiosRequestConfig) { - return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams.0}}{{#allParams}}requestParameters.{{paramName}}, {{/allParams}}{{/allParams.0}}options).then((request) => request(this.axios, this.basePath)); - } - {{/useSingleRequestParameter}} - {{^useSingleRequestParameter}} - public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}, {{/allParams}}options?: RawAxiosRequestConfig) { - return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options).then((request) => request(this.axios, this.basePath)); - } - {{/useSingleRequestParameter}} - {{^-last}} - - {{/-last}} - {{/operation}} -} -{{/operations}} - -{{#operations}} -{{#operation}} -{{#allParams}} -{{#isEnum}} -{{#stringEnums}} -/** - * @export - * @enum {string} - */ -export enum {{operationIdCamelCase}}{{enumName}} { -{{#allowableValues}} - {{#enumVars}} - {{{name}}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} -{{/allowableValues}} -} -{{/stringEnums}} -{{^stringEnums}} -/** - * @export - */ -export const {{operationIdCamelCase}}{{enumName}} = { -{{#allowableValues}} - {{#enumVars}} - {{{name}}}: {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} -{{/allowableValues}} -} as const; -export type {{operationIdCamelCase}}{{enumName}} = typeof {{operationIdCamelCase}}{{enumName}}[keyof typeof {{operationIdCamelCase}}{{enumName}}]; -{{/stringEnums}} -{{/isEnum}} -{{/allParams}} -{{/operation}} -{{/operations}} diff --git a/openapitools.json b/openapitools.json index f80faaa..f8d07ce 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.9.0" + "version": "7.10.0" } }