|
5 | 5 |
|
6 | 6 |
|
7 | 7 | import type { Configuration } from '{{apiRelativeToRoot}}configuration{{importFileExtension}}'; |
8 | | -import type { AxiosInstance, RawAxiosRequestConfig } from 'axios'; |
| 8 | +import type { AxiosInstance, RawAxiosRequestConfig, AxiosResponse } from 'axios'; |
9 | 9 | import globalAxios from 'axios'; |
10 | 10 | {{#withNodeImports}} |
11 | 11 | // URLSearchParams not necessarily used |
@@ -59,7 +59,7 @@ export interface {{classname}}Interface { |
59 | 59 | * @deprecated{{/isDeprecated}} |
60 | 60 | * @throws {RequiredError} |
61 | 61 | */ |
62 | | - {{nickname}}({{#allParams.0}}requestParameters{{^hasRequiredParams}}?{{/hasRequiredParams}}: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}options?: RawAxiosRequestConfig): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>; |
| 62 | + {{nickname}}({{#allParams.0}}requestParameters{{^hasRequiredParams}}?{{/hasRequiredParams}}: {{classname}}{{operationIdCamelCase}}Request, {{/allParams.0}}options?: RawAxiosRequestConfig): {{#unwrapResponseData}}Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>{{/unwrapResponseData}}{{^unwrapResponseData}}Promise<AxiosResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>>{{/unwrapResponseData}}; |
63 | 63 |
|
64 | 64 | {{/operation}} |
65 | 65 | } |
@@ -105,7 +105,7 @@ export class {{classname}} extends BaseAPI { |
105 | 105 | * @deprecated{{/isDeprecated}} |
106 | 106 | * @throws {RequiredError} |
107 | 107 | */ |
108 | | - public async {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options: RawAxiosRequestConfig = {}): Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}> { |
| 108 | + public async {{nickname}}({{#allParams.0}}requestParameters: {{classname}}{{operationIdCamelCase}}Request{{^hasRequiredParams}} = {}{{/hasRequiredParams}}, {{/allParams.0}}options: RawAxiosRequestConfig = {}): {{#unwrapResponseData}}Promise<{{{returnType}}}{{^returnType}}void{{/returnType}}>{{/unwrapResponseData}}{{^unwrapResponseData}}Promise<AxiosResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>>{{/unwrapResponseData}} { |
109 | 109 | {{#allParams.0}} |
110 | 110 | validateRequestParameters('{{nickname}}', {{nickname}}RequestSchema, requestParameters); |
111 | 111 | {{/allParams.0}} |
@@ -299,8 +299,8 @@ export class {{classname}} extends BaseAPI { |
299 | 299 | const effectiveBasePath = localVarOperationServerBasePath || this.basePath || BASE_PATH; |
300 | 300 | localVarRequestOptions.url = (this.axios.defaults.baseURL ? '' : this.configuration?.basePath ?? effectiveBasePath) + toPathString(localVarUrlObj); |
301 | 301 |
|
302 | | - const localVarResponse = await this.axios.request<{{{returnType}}}{{^returnType}}void{{/returnType}}>(localVarRequestOptions); |
303 | | - return localVarResponse.data; |
| 302 | + {{#unwrapResponseData}}const localVarResponse = await this.axios.request<{{{returnType}}}{{^returnType}}void{{/returnType}}>(localVarRequestOptions); |
| 303 | + return localVarResponse.data;{{/unwrapResponseData}}{{^unwrapResponseData}}return this.axios.request<{{{returnType}}}{{^returnType}}void{{/returnType}}, AxiosResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>>(localVarRequestOptions);{{/unwrapResponseData}} |
304 | 304 | } |
305 | 305 | {{^-last}} |
306 | 306 |
|
|
0 commit comments