|
3 | 3 | {{#if imports}} |
4 | 4 | import type { |
5 | 5 | {{#each imports}} |
6 | | - {{{this}}}, |
| 6 | +{{{this}}}, |
7 | 7 | {{/each}} |
8 | 8 | } from '../models'; |
9 | 9 | {{/if}} |
10 | 10 | {{#if @root.exportClient}} |
11 | | -import type { ApiResult, BaseHttpRequest, ClientConfig } from '../core'; |
12 | | -{{else}} |
13 | | -import type { ApiResult } from '../core'; |
14 | | -import { |
15 | | - request as __request, |
16 | | -{{#if @root.useVersion}} |
17 | | - OpenAPI, |
18 | | -{{/if}} |
19 | | -} from '../core'; |
| 11 | +import type { BaseHttpRequest, ClientConfig } from '../core'; |
20 | 12 | {{/if}} |
| 13 | +import { {{{name}}}Full } from './{{{name}}}Full'; |
21 | 14 |
|
22 | 15 | export class {{{name}}} { |
23 | 16 | {{#if @root.exportClient}} |
24 | 17 | private readonly httpRequest: BaseHttpRequest; |
25 | | - private readonly ClientConfig: ClientConfig; |
| 18 | + private readonly clientConfig: ClientConfig; |
| 19 | + readonly full: {{{name}}}Full; |
26 | 20 |
|
27 | | - constructor(httpRequest: BaseHttpRequest, ClientConfig: ClientConfig) { |
| 21 | + constructor(httpRequest: BaseHttpRequest, clientConfig: ClientConfig) { |
28 | 22 | this.httpRequest = httpRequest; |
29 | | - this.ClientConfig = ClientConfig; |
| 23 | + this.clientConfig = clientConfig; |
| 24 | + this.full = new {{{name}}}Full(httpRequest, clientConfig); |
30 | 25 | } |
31 | 26 | {{/if}} |
32 | 27 |
|
@@ -54,56 +49,12 @@ export class {{{name}}} { |
54 | 49 | {{/each}} |
55 | 50 | * @throws ApiError |
56 | 51 | */ |
57 | | - public{{#unless @root.exportClient}} static{{/unless}} async {{{name}}}({{>parameters}}): Promise<ApiResult<{{>result}}>> { |
58 | | - return {{#if @root.exportClient}}this.httpRequest.request{{else}}__request{{/if}}({ |
59 | | - method: '{{{method}}}', |
60 | | - path: `{{{path}}}`, |
61 | | - {{#if parametersCookie}} |
62 | | - cookies: { |
63 | | - {{#each parametersCookie}} |
64 | | - '{{{prop}}}': {{{name}}}, |
65 | | - {{/each}} |
66 | | - }, |
67 | | - {{/if}} |
68 | | - {{#if parametersHeader}} |
69 | | - headers: { |
70 | | - {{#each parametersHeader}} |
71 | | - '{{{prop}}}': {{{name}}}, |
72 | | - {{/each}} |
73 | | - }, |
74 | | - {{/if}} |
75 | | - {{#if parametersQuery}} |
76 | | - query: { |
77 | | - {{#each parametersQuery}} |
78 | | - '{{{prop}}}': {{{name}}}, |
79 | | - {{/each}} |
80 | | - }, |
81 | | - {{/if}} |
82 | | - {{#if parametersForm}} |
83 | | - formData: { |
84 | | - {{#each parametersForm}} |
85 | | - '{{{prop}}}': {{{name}}}, |
86 | | - {{/each}} |
87 | | - }, |
88 | | - {{/if}} |
89 | | - {{#if parametersBody}} |
90 | | - body: {{{parametersBody.name}}}, |
91 | | - {{#if parametersBody.mediaType}} |
92 | | - mediaType: '{{{parametersBody.mediaType}}}', |
93 | | - {{/if}} |
94 | | - {{/if}} |
95 | | - {{#if responseHeader}} |
96 | | - responseHeader: '{{{responseHeader}}}', |
97 | | - {{/if}} |
98 | | - {{#if errors}} |
99 | | - errors: { |
100 | | - {{#each errors}} |
101 | | - {{{code}}}: `{{{description}}}`, |
102 | | - {{/each}} |
103 | | - }, |
104 | | - {{/if}} |
105 | | - }{{#if @root.exportClient}}, this.ClientConfig, config{{/if}}); |
| 52 | + public{{#unless @root.exportClient}} static{{/unless}} async {{{name}}}({{>parameters}}): Promise<{{>result}}> { |
| 53 | + {{#if @root.exportClient}} |
| 54 | + return (await this.full.{{{name}}}({{>passParameters}})).body; |
| 55 | + {{else}} |
| 56 | + return (await {{{@root.name}}}Full.{{{name}}}({{>passParameters}})).body; |
| 57 | + {{/if}} |
106 | 58 | } |
107 | | - |
108 | 59 | {{/each}} |
109 | 60 | } |
0 commit comments