|
| 1 | +{{>header}} |
| 2 | + |
| 3 | +{{#if imports}} |
| 4 | +{{#each imports}} |
| 5 | +import type { {{{this}}} } from '../models/{{{this}}}'; |
| 6 | +{{/each}} |
| 7 | +{{/if}} |
| 8 | +import { request as __request } from '../core/request'; |
| 9 | +{{#if @root.useVersion}} |
| 10 | +import { OpenAPI } from '../core/OpenAPI'; |
| 11 | +{{/if}} |
| 12 | + |
| 13 | +export class {{{name}}} { |
| 14 | + |
| 15 | + {{#each operations}} |
| 16 | + /** |
| 17 | + {{#if deprecated}} |
| 18 | + * @deprecated |
| 19 | + {{/if}} |
| 20 | + {{#if summary}} |
| 21 | + * {{{summary}}} |
| 22 | + {{/if}} |
| 23 | + {{#if description}} |
| 24 | + * {{{description}}} |
| 25 | + {{/if}} |
| 26 | + {{#if parameters}} |
| 27 | + {{#each parameters}} |
| 28 | + * @param {{{name}}} {{{description}}} |
| 29 | + {{/each}} |
| 30 | + {{/if}} |
| 31 | + {{#each results}} |
| 32 | + * @result {{{type}}} {{{description}}} |
| 33 | + {{/each}} |
| 34 | + * @throws ApiError |
| 35 | + */ |
| 36 | + public static async {{{name}}}({{>parameters}}): Promise<{{>result}}> { |
| 37 | + const result = await __request({ |
| 38 | + method: '{{{method}}}', |
| 39 | + path: `{{{path}}}`, |
| 40 | + {{#if parametersCookie}} |
| 41 | + cookies: { |
| 42 | + {{#each parametersCookie}} |
| 43 | + '{{{prop}}}': {{{name}}}, |
| 44 | + {{/each}} |
| 45 | + }, |
| 46 | + {{/if}} |
| 47 | + {{#if parametersHeader}} |
| 48 | + headers: { |
| 49 | + {{#each parametersHeader}} |
| 50 | + '{{{prop}}}': {{{name}}}, |
| 51 | + {{/each}} |
| 52 | + }, |
| 53 | + {{/if}} |
| 54 | + {{#if parametersQuery}} |
| 55 | + query: { |
| 56 | + {{#each parametersQuery}} |
| 57 | + '{{{prop}}}': {{{name}}}, |
| 58 | + {{/each}} |
| 59 | + }, |
| 60 | + {{/if}} |
| 61 | + {{#if parametersForm}} |
| 62 | + formData: { |
| 63 | + {{#each parametersForm}} |
| 64 | + '{{{prop}}}': {{{name}}}, |
| 65 | + {{/each}} |
| 66 | + }, |
| 67 | + {{/if}} |
| 68 | + {{#if parametersBody}} |
| 69 | + body: {{{parametersBody.name}}}, |
| 70 | + {{/if}} |
| 71 | + {{#if responseHeader}} |
| 72 | + responseHeader: '{{{responseHeader}}}', |
| 73 | + {{/if}} |
| 74 | + {{#if errors}} |
| 75 | + errors: { |
| 76 | + {{#each errors}} |
| 77 | + {{{code}}}: `{{{description}}}`, |
| 78 | + {{/each}} |
| 79 | + }, |
| 80 | + {{/if}} |
| 81 | + }); |
| 82 | + return result.body; |
| 83 | + } |
| 84 | + |
| 85 | + {{/each}} |
| 86 | +} |
0 commit comments