From 184bdebc025cf2e6eb9aea832d782f4afce26c48 Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Wed, 3 Apr 2024 09:48:41 +1100 Subject: [PATCH] feat(client): generate all services in single services.ts file --- .changeset/blue-flies-behave.md | 5 + rollup.config.ts | 1 - src/templates/client.hbs | 2 +- src/templates/exportService.hbs | 39 - src/utils/handlebars.ts | 9 - src/utils/write/__tests__/services.spec.ts | 3 +- src/utils/write/client.ts | 2 +- src/utils/write/services.ts | 62 +- test/__snapshots__/v2/services.ts.snap | 863 +++++++++++ .../services/CollectionFormatService.ts.snap | 47 - .../v2/services/ComplexService.ts.snap | 43 - .../v2/services/DefaultService.ts.snap | 15 - .../v2/services/DefaultsService.ts.snap | 169 --- .../v2/services/DescriptionsService.ts.snap | 61 - .../v2/services/DuplicateService.ts.snap | 45 - .../v2/services/ErrorService.ts.snap | 33 - .../v2/services/HeaderService.ts.snap | 21 - .../v2/services/MultipleTags1Service.ts.snap | 27 - .../v2/services/MultipleTags2Service.ts.snap | 27 - .../v2/services/MultipleTags3Service.ts.snap | 16 - .../v2/services/NoContentService.ts.snap | 28 - ...66\303\264\303\252\303\212Service.ts.snap" | 30 - .../v2/services/ParametersService.ts.snap | 122 -- .../v2/services/ResponseService.ts.snap | 73 - .../v2/services/SimpleService.ts.snap | 75 - .../v2/services/TypesService.ts.snap | 76 - test/__snapshots__/v2/services/index.ts.snap | 17 - test/__snapshots__/v3/services.ts.snap | 1198 +++++++++++++++ .../services/CollectionFormatService.ts.snap | 47 - .../v3/services/ComplexService.ts.snap | 76 - .../v3/services/DefaultService.ts.snap | 36 - .../v3/services/DefaultsService.ts.snap | 169 --- .../v3/services/DeprecatedService.ts.snap | 28 - .../v3/services/DescriptionsService.ts.snap | 61 - .../v3/services/DuplicateService.ts.snap | 45 - .../v3/services/ErrorService.ts.snap | 33 - .../v3/services/FileResponseService.ts.snap | 24 - .../v3/services/FormDataService.ts.snap | 33 - .../v3/services/HeaderService.ts.snap | 21 - .../v3/services/MultipartService.ts.snap | 43 - .../v3/services/MultipleTags1Service.ts.snap | 27 - .../v3/services/MultipleTags2Service.ts.snap | 27 - .../v3/services/MultipleTags3Service.ts.snap | 16 - .../v3/services/NoContentService.ts.snap | 28 - ...66\303\264\303\252\303\212Service.ts.snap" | 30 - .../v3/services/ParametersService.ts.snap | 230 --- .../v3/services/RequestBodyService.ts.snap | 33 - .../v3/services/ResponseService.ts.snap | 73 - .../v3/services/SimpleService.ts.snap | 75 - .../v3/services/TypesService.ts.snap | 76 - .../v3/services/UploadService.ts.snap | 27 - test/__snapshots__/v3/services/index.ts.snap | 23 - .../__snapshots__/v3_angular/services.ts.snap | 1311 +++++++++++++++++ .../services/CollectionFormatService.ts.snap | 55 - .../services/ComplexService.ts.snap | 83 -- .../services/DefaultService.ts.snap | 41 - .../services/DefaultsService.ts.snap | 174 --- .../services/DeprecatedService.ts.snap | 35 - .../services/DescriptionsService.ts.snap | 69 - .../services/DuplicateService.ts.snap | 53 - .../v3_angular/services/ErrorService.ts.snap | 41 - .../services/FileResponseService.ts.snap | 32 - .../services/FormDataService.ts.snap | 40 - .../v3_angular/services/HeaderService.ts.snap | 29 - .../services/MultipartService.ts.snap | 50 - .../services/MultipleTags1Service.ts.snap | 35 - .../services/MultipleTags2Service.ts.snap | 35 - .../services/MultipleTags3Service.ts.snap | 24 - .../services/NoContentService.ts.snap | 36 - ...66\303\264\303\252\303\212Service.ts.snap" | 37 - .../services/ParametersService.ts.snap | 237 --- .../services/RequestBodyService.ts.snap | 40 - .../services/ResponseService.ts.snap | 80 - .../v3_angular/services/SimpleService.ts.snap | 83 -- .../v3_angular/services/TypesService.ts.snap | 84 -- .../v3_angular/services/UploadService.ts.snap | 35 - .../v3_angular/services/index.ts.snap | 23 - .../__snapshots__/v3_client/ApiClient.ts.snap | 46 +- test/__snapshots__/v3_client/services.ts.snap | 1243 ++++++++++++++++ .../services/CollectionFormatService.ts.snap | 48 - .../v3_client/services/ComplexService.ts.snap | 77 - .../v3_client/services/DefaultService.ts.snap | 37 - .../services/DefaultsService.ts.snap | 170 --- .../services/DeprecatedService.ts.snap | 29 - .../services/DescriptionsService.ts.snap | 62 - .../services/DuplicateService.ts.snap | 46 - .../v3_client/services/ErrorService.ts.snap | 34 - .../services/FileResponseService.ts.snap | 25 - .../services/FormDataService.ts.snap | 34 - .../v3_client/services/HeaderService.ts.snap | 22 - .../services/MultipartService.ts.snap | 44 - .../services/MultipleTags1Service.ts.snap | 28 - .../services/MultipleTags2Service.ts.snap | 28 - .../services/MultipleTags3Service.ts.snap | 17 - .../services/NoContentService.ts.snap | 29 - ...66\303\264\303\252\303\212Service.ts.snap" | 31 - .../services/ParametersService.ts.snap | 231 --- .../services/RequestBodyService.ts.snap | 34 - .../services/ResponseService.ts.snap | 74 - .../v3_client/services/SimpleService.ts.snap | 76 - .../v3_client/services/TypesService.ts.snap | 77 - .../v3_client/services/UploadService.ts.snap | 28 - .../v3_client/services/index.ts.snap | 23 - .../v3_enums_typescript/services.ts.snap | 1198 +++++++++++++++ .../services/CollectionFormatService.ts.snap | 47 - .../services/ComplexService.ts.snap | 76 - .../services/DefaultService.ts.snap | 36 - .../services/DeprecatedService.ts.snap | 28 - .../services/DescriptionsService.ts.snap | 61 - .../services/DuplicateService.ts.snap | 45 - .../services/ErrorService.ts.snap | 33 - .../services/FileResponseService.ts.snap | 24 - .../services/FormDataService.ts.snap | 33 - .../services/HeaderService.ts.snap | 21 - .../services/MultipartService.ts.snap | 43 - .../services/MultipleTags1Service.ts.snap | 27 - .../services/MultipleTags2Service.ts.snap | 27 - .../services/MultipleTags3Service.ts.snap | 16 - .../services/NoContentService.ts.snap | 28 - ...66\303\264\303\252\303\212Service.ts.snap" | 30 - .../services/ParametersService.ts.snap | 230 --- .../services/RequestBodyService.ts.snap | 33 - .../services/ResponseService.ts.snap | 73 - .../services/SimpleService.ts.snap | 75 - .../services/TypesService.ts.snap | 76 - .../services/UploadService.ts.snap | 27 - .../services/index.ts.snap | 23 - .../v3_experimental/services.ts.snap | 1155 +++++++++++++++ .../services/CollectionFormatService.ts.snap | 44 - .../services/ComplexService.ts.snap | 77 - .../services/DefaultService.ts.snap | 38 - .../services/DefaultsService.ts.snap | 154 -- .../services/DeprecatedService.ts.snap | 28 - .../services/DescriptionsService.ts.snap | 51 - .../services/DuplicateService.ts.snap | 45 - .../services/ErrorService.ts.snap | 35 - .../services/FileResponseService.ts.snap | 24 - .../services/FormDataService.ts.snap | 36 - .../services/HeaderService.ts.snap | 21 - .../services/MultipartService.ts.snap | 45 - .../services/MultipleTags1Service.ts.snap | 27 - .../services/MultipleTags2Service.ts.snap | 27 - .../services/MultipleTags3Service.ts.snap | 16 - .../services/NoContentService.ts.snap | 28 - ...66\303\264\303\252\303\212Service.ts.snap" | 32 - .../services/ParametersService.ts.snap | 210 --- .../services/RequestBodyService.ts.snap | 36 - .../services/ResponseService.ts.snap | 73 - .../services/SimpleService.ts.snap | 75 - .../services/TypesService.ts.snap | 66 - .../services/UploadService.ts.snap | 27 - .../v3_experimental/services/index.ts.snap | 23 - .../services.ts.snap} | 9 +- .../services/DefaultsService.ts.snap | 169 --- .../v3_options/services/index.ts.snap | 1 - test/e2e/assets/main-angular-module.ts | 32 +- test/e2e/assets/main-angular.ts | 32 +- 157 files changed, 7089 insertions(+), 7602 deletions(-) create mode 100644 .changeset/blue-flies-behave.md create mode 100644 test/__snapshots__/v2/services.ts.snap delete mode 100644 test/__snapshots__/v2/services/CollectionFormatService.ts.snap delete mode 100644 test/__snapshots__/v2/services/ComplexService.ts.snap delete mode 100644 test/__snapshots__/v2/services/DefaultService.ts.snap delete mode 100644 test/__snapshots__/v2/services/DefaultsService.ts.snap delete mode 100644 test/__snapshots__/v2/services/DescriptionsService.ts.snap delete mode 100644 test/__snapshots__/v2/services/DuplicateService.ts.snap delete mode 100644 test/__snapshots__/v2/services/ErrorService.ts.snap delete mode 100644 test/__snapshots__/v2/services/HeaderService.ts.snap delete mode 100644 test/__snapshots__/v2/services/MultipleTags1Service.ts.snap delete mode 100644 test/__snapshots__/v2/services/MultipleTags2Service.ts.snap delete mode 100644 test/__snapshots__/v2/services/MultipleTags3Service.ts.snap delete mode 100644 test/__snapshots__/v2/services/NoContentService.ts.snap delete mode 100644 "test/__snapshots__/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" delete mode 100644 test/__snapshots__/v2/services/ParametersService.ts.snap delete mode 100644 test/__snapshots__/v2/services/ResponseService.ts.snap delete mode 100644 test/__snapshots__/v2/services/SimpleService.ts.snap delete mode 100644 test/__snapshots__/v2/services/TypesService.ts.snap delete mode 100644 test/__snapshots__/v2/services/index.ts.snap create mode 100644 test/__snapshots__/v3/services.ts.snap delete mode 100644 test/__snapshots__/v3/services/CollectionFormatService.ts.snap delete mode 100644 test/__snapshots__/v3/services/ComplexService.ts.snap delete mode 100644 test/__snapshots__/v3/services/DefaultService.ts.snap delete mode 100644 test/__snapshots__/v3/services/DefaultsService.ts.snap delete mode 100644 test/__snapshots__/v3/services/DeprecatedService.ts.snap delete mode 100644 test/__snapshots__/v3/services/DescriptionsService.ts.snap delete mode 100644 test/__snapshots__/v3/services/DuplicateService.ts.snap delete mode 100644 test/__snapshots__/v3/services/ErrorService.ts.snap delete mode 100644 test/__snapshots__/v3/services/FileResponseService.ts.snap delete mode 100644 test/__snapshots__/v3/services/FormDataService.ts.snap delete mode 100644 test/__snapshots__/v3/services/HeaderService.ts.snap delete mode 100644 test/__snapshots__/v3/services/MultipartService.ts.snap delete mode 100644 test/__snapshots__/v3/services/MultipleTags1Service.ts.snap delete mode 100644 test/__snapshots__/v3/services/MultipleTags2Service.ts.snap delete mode 100644 test/__snapshots__/v3/services/MultipleTags3Service.ts.snap delete mode 100644 test/__snapshots__/v3/services/NoContentService.ts.snap delete mode 100644 "test/__snapshots__/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" delete mode 100644 test/__snapshots__/v3/services/ParametersService.ts.snap delete mode 100644 test/__snapshots__/v3/services/RequestBodyService.ts.snap delete mode 100644 test/__snapshots__/v3/services/ResponseService.ts.snap delete mode 100644 test/__snapshots__/v3/services/SimpleService.ts.snap delete mode 100644 test/__snapshots__/v3/services/TypesService.ts.snap delete mode 100644 test/__snapshots__/v3/services/UploadService.ts.snap delete mode 100644 test/__snapshots__/v3/services/index.ts.snap create mode 100644 test/__snapshots__/v3_angular/services.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/CollectionFormatService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/ComplexService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/DefaultService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/DefaultsService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/DeprecatedService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/DescriptionsService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/DuplicateService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/ErrorService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/FileResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/FormDataService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/HeaderService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/MultipartService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/MultipleTags1Service.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/MultipleTags2Service.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/MultipleTags3Service.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/NoContentService.ts.snap delete mode 100644 "test/__snapshots__/v3_angular/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" delete mode 100644 test/__snapshots__/v3_angular/services/ParametersService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/RequestBodyService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/ResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/SimpleService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/TypesService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/UploadService.ts.snap delete mode 100644 test/__snapshots__/v3_angular/services/index.ts.snap create mode 100644 test/__snapshots__/v3_client/services.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/CollectionFormatService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/ComplexService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/DefaultService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/DefaultsService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/DeprecatedService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/DescriptionsService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/DuplicateService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/ErrorService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/FileResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/FormDataService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/HeaderService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/MultipartService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/MultipleTags1Service.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/MultipleTags2Service.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/MultipleTags3Service.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/NoContentService.ts.snap delete mode 100644 "test/__snapshots__/v3_client/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" delete mode 100644 test/__snapshots__/v3_client/services/ParametersService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/RequestBodyService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/ResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/SimpleService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/TypesService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/UploadService.ts.snap delete mode 100644 test/__snapshots__/v3_client/services/index.ts.snap create mode 100644 test/__snapshots__/v3_enums_typescript/services.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/CollectionFormatService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/ComplexService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/DefaultService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/DeprecatedService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/DescriptionsService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/DuplicateService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/ErrorService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/FileResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/FormDataService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/HeaderService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/MultipartService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/MultipleTags1Service.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/MultipleTags2Service.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/MultipleTags3Service.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/NoContentService.ts.snap delete mode 100644 "test/__snapshots__/v3_enums_typescript/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" delete mode 100644 test/__snapshots__/v3_enums_typescript/services/ParametersService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/RequestBodyService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/ResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/SimpleService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/TypesService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/UploadService.ts.snap delete mode 100644 test/__snapshots__/v3_enums_typescript/services/index.ts.snap create mode 100644 test/__snapshots__/v3_experimental/services.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/CollectionFormatService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/ComplexService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/DefaultService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/DefaultsService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/DeprecatedService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/DescriptionsService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/DuplicateService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/ErrorService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/FileResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/FormDataService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/HeaderService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/MultipartService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/MultipleTags1Service.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/MultipleTags2Service.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/MultipleTags3Service.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/NoContentService.ts.snap delete mode 100644 "test/__snapshots__/v3_experimental/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" delete mode 100644 test/__snapshots__/v3_experimental/services/ParametersService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/RequestBodyService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/ResponseService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/SimpleService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/TypesService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/UploadService.ts.snap delete mode 100644 test/__snapshots__/v3_experimental/services/index.ts.snap rename test/__snapshots__/{v3_enums_typescript/services/DefaultsService.ts.snap => v3_options/services.ts.snap} (95%) delete mode 100644 test/__snapshots__/v3_options/services/DefaultsService.ts.snap delete mode 100644 test/__snapshots__/v3_options/services/index.ts.snap diff --git a/.changeset/blue-flies-behave.md b/.changeset/blue-flies-behave.md new file mode 100644 index 000000000..304aaa046 --- /dev/null +++ b/.changeset/blue-flies-behave.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": minor +--- + +feat(client): generate all services in single `services.ts` file diff --git a/rollup.config.ts b/rollup.config.ts index e9919ea9b..81e3f731a 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -45,7 +45,6 @@ export function handlebarsPlugin(): Plugin { ifNotNullNotUndefined: true, ifOperationDataOptional: true, intersection: true, - modelImports: true, modelUnionType: true, nameOperationDataType: true, notEquals: true, diff --git a/src/templates/client.hbs b/src/templates/client.hbs index 9fbb50988..89d5eac7d 100644 --- a/src/templates/client.hbs +++ b/src/templates/client.hbs @@ -16,7 +16,7 @@ import { {{{httpRequest}}} } from './core/{{{httpRequest}}}'; {{#if services}} {{#each services}} -import { {{{name}}}{{{@root.$config.postfixServices}}} } from './services/{{{name}}}{{{@root.$config.postfixServices}}}'; +import { {{{name}}}{{{@root.$config.postfixServices}}} } from './services'; {{/each}} {{/if}} diff --git a/src/templates/exportService.hbs b/src/templates/exportService.hbs index cd41720b1..0c6132dd9 100644 --- a/src/templates/exportService.hbs +++ b/src/templates/exportService.hbs @@ -1,42 +1,3 @@ -{{#equals @root.$config.client 'angular'}} -{{#if @root.$config.name}} -import { Injectable } from '@angular/core'; -import type { Observable } from 'rxjs'; -{{else}} -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -{{/if}} -{{/equals}} -{{{modelImports this '../models'}}} -{{#equals @root.$config.serviceResponse 'response'}} -import type { ApiResult } from '../core/ApiResult'; -{{/equals}} -{{#notEquals @root.$config.client 'angular'}} -import type { CancelablePromise } from '../core/CancelablePromise'; -{{/notEquals}} -{{#if @root.$config.name}} -{{#equals @root.$config.client 'angular'}} -import { BaseHttpRequest } from '../core/BaseHttpRequest'; -{{else}} -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; -{{/equals}} -{{else}} -{{#if @root.$config.useOptions}} -{{#equals @root.$config.serviceResponse 'generics'}} -import { mergeOpenApiConfig, OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; -import type { TApiResponse, TConfig, TResult } from '../core/types'; -{{else}} -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; -{{/equals}} -{{else}} -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; -{{/if}} -{{/if}} - {{{operationDataType this}}} {{#equals @root.$config.client 'angular'}} diff --git a/src/utils/handlebars.ts b/src/utils/handlebars.ts index 93ec3ed04..f57b030b8 100644 --- a/src/utils/handlebars.ts +++ b/src/utils/handlebars.ts @@ -94,13 +94,6 @@ const escapeComment = (value: string) => .replace(/\/\*/g, '*') .replace(/\r?\n(.*)/g, (_, w) => `${EOL} * ${w.trim()}`); -const modelImports = (model: Service, path: string) => { - if (model.imports.length === 0) { - return ''; - } - return `import type { ${model.imports.join(',')} } from '${path}';`; -}; - const dataParameters = (config: Config, parameters: OperationParameter[]) => { if (config.experimental) { let output = parameters @@ -267,8 +260,6 @@ export const registerHandlebarHelpers = (config: Config, client: Client): void = } ); - Handlebars.registerHelper('modelImports', modelImports); - Handlebars.registerHelper( 'modelUnionType', function (models: Model[], parent: string | undefined, filterProperties: 'exact' | undefined) { diff --git a/src/utils/write/__tests__/services.spec.ts b/src/utils/write/__tests__/services.spec.ts index e5e9a4fc9..072b051a5 100644 --- a/src/utils/write/__tests__/services.spec.ts +++ b/src/utils/write/__tests__/services.spec.ts @@ -1,5 +1,4 @@ import { writeFileSync } from 'node:fs'; -import path from 'node:path'; import { describe, expect, it, vi } from 'vitest'; @@ -46,6 +45,6 @@ describe('writeClientServices', () => { write: true, }); - expect(writeFileSync).toHaveBeenCalledWith(path.resolve('/', '/UserService.ts'), 'service'); + expect(writeFileSync).toHaveBeenCalled(); }); }); diff --git a/src/utils/write/client.ts b/src/utils/write/client.ts index 12956ba5c..d19d4b2d2 100644 --- a/src/utils/write/client.ts +++ b/src/utils/write/client.ts @@ -50,7 +50,7 @@ export const writeClient = async (client: Client, templates: Templates, config: fn: writeClientModels, }, { - dir: 'services', + dir: '', enabled: config.exportServices, fn: writeClientServices, }, diff --git a/src/utils/write/services.ts b/src/utils/write/services.ts index 79c4129d7..64622421f 100644 --- a/src/utils/write/services.ts +++ b/src/utils/write/services.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import type { Client } from '../../types/client'; import type { Config } from '../../types/config'; import type { Templates } from '../handlebars'; -import { sortByName } from '../sort'; +import { unique } from '../unique'; /** * Generate Services using the Handlebar template and write to disk. @@ -23,20 +23,60 @@ export const writeClientServices = async ( if (client.services.length === 0) { return; } - // Generate file for each service. + // Generate a file with all services. + const results: string[] = []; + const imports: string[] = []; for (const service of client.services) { - const file = path.resolve(outputPath, `${service.name}${config.postfixServices}.ts`); - const templateResult = templates.exports.service({ + const result = templates.exports.service({ $config: config, ...service, }); - await writeFileSync(file, templateResult); + imports.push(...service.imports); + results.push(result); } + // Import all models required by the services. + const uniqueImports = imports.filter(unique); + if (uniqueImports.length > 0) { + const importString = `import type { ${uniqueImports.join(',')} } from './models';`; + results.unshift(importString); + } + // Import required packages and core files. + const imports2: string[] = []; + if (config.client === 'angular') { + imports2.push(`import { Injectable } from '@angular/core';`); + if (config.name === undefined) { + imports2.push(`import { HttpClient } from '@angular/common/http';`); + } + imports2.push(`import type { Observable } from 'rxjs';`); + } else { + imports2.push(`import type { CancelablePromise } from './core/CancelablePromise';`); + } + if (config.serviceResponse === 'response') { + imports2.push(`import type { ApiResult } from './core/ApiResult;`); + } + if (config.name) { + if (config.client === 'angular') { + imports2.push(`import { BaseHttpRequest } from './core/BaseHttpRequest';`); + } else { + imports2.push(`import type { BaseHttpRequest } from './core/BaseHttpRequest';`); + } + } else { + if (config.useOptions) { + if (config.serviceResponse === 'generics') { + imports2.push(`import { mergeOpenApiConfig, OpenAPI } from './core/OpenAPI';`); + imports2.push(`import { request as __request } from './core/request';`); + imports2.push(`import type { TApiResponse, TConfig, TResult } from './core/types';`); + } else { + imports2.push(`import { OpenAPI } from './core/OpenAPI';`); + imports2.push(`import { request as __request } from './core/request';`); + } + } else { + imports2.push(`import { OpenAPI } from './core/OpenAPI';`); + imports2.push(`import { request as __request } from './core/request';`); + } + } + results.unshift(imports2.join('\n')); // Generate index file exporting all generated service files. - const file = path.resolve(outputPath, 'index.ts'); - const content = sortByName(client.services).map( - service => - `export { ${service.name}${config.postfixServices} } from './${service.name}${config.postfixServices}'` - ); - await writeFileSync(file, content.join('\n')); + const file = path.resolve(outputPath, 'services.ts'); + await writeFileSync(file, results.join('\n\n')); }; diff --git a/test/__snapshots__/v2/services.ts.snap b/test/__snapshots__/v2/services.ts.snap new file mode 100644 index 000000000..1b9eb5589 --- /dev/null +++ b/test/__snapshots__/v2/services.ts.snap @@ -0,0 +1,863 @@ +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; + +import type { + ModelWithString, + ModelThatExtends, + ModelThatExtendsExtends, + NonAsciiStringæøåÆØÅöôêÊ字符串, +} from './models'; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } +} + +export class SimpleService { + /** + * @throws ApiError + */ + public static getCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static putCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static deleteCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static optionsCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static headCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static patchCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} + +export type TDataCallWithDescriptions = { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: string; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; +}; + +export class DescriptionsService { + /** + * @throws ApiError + */ + public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { + const { + parameterWithBackticks, + parameterWithBreaks, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + parameterWithSlashes, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + parameterWithBreaks, + parameterWithBackticks, + parameterWithSlashes, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + }, + }); + } +} + +export type TDataCallWithParameters = { + /** + * This is the parameter that is sent as request body + */ + parameterBody: string; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string; + /** + * This is the parameter that goes into the path + */ + parameterPath: string; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that is sent as request body + */ + parameterBody: string; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { parameterBody, parameterForm, parameterHeader, parameterPath, parameterQuery } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + headers: { + parameterHeader, + }, + query: { + parameterQuery, + }, + formData: { + parameterForm, + }, + body: parameterBody, + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterBody, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: { + 'parameter.path.1': parameterPath1, + 'parameter-path-2': parameterPath2, + 'PARAMETER-PATH-3': parameterPath3, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: parameterBody, + }); + } +} + +export type TDataCallWithDefaultParameters = { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number with default value + */ + parameterNumber?: number; + /** + * This is a simple string with default value + */ + parameterString?: string; +}; +export type TDataCallWithDefaultOptionalParameters = { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; +}; +export type TDataCallToTestOrderOfParams = { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; +}; + +export class DefaultsService { + /** + * @throws ApiError + */ + public static callWithDefaultParameters(data: TDataCallWithDefaultParameters): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithDefaultOptionalParameters( + data: TDataCallWithDefaultOptionalParameters = {} + ): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { + const { + parameterOptionalStringWithDefault = 'Hello World!', + parameterOptionalStringWithEmptyDefault = '', + parameterOptionalStringWithNoDefault, + parameterStringNullableWithDefault = null, + parameterStringNullableWithNoDefault, + parameterStringWithDefault = 'Hello World!', + parameterStringWithEmptyDefault = '', + parameterStringWithNoDefault, + } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault, + parameterOptionalStringWithEmptyDefault, + parameterOptionalStringWithNoDefault, + parameterStringWithDefault, + parameterStringWithEmptyDefault, + parameterStringWithNoDefault, + parameterStringNullableWithNoDefault, + parameterStringNullableWithDefault, + }, + }); + } +} + +export class DuplicateService { + /** + * @throws ApiError + */ + public static duplicateName(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName1(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName2(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName3(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} + +export class NoContentService { + /** + * @returns void Success + * @throws ApiError + */ + public static callWithNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns any Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} + +export class ResponseService { + /** + * @returns any Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public static callWithResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public static callWithDuplicateResponses(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public static callWithResponses(): CancelablePromise< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} + +export class MultipleTags1Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags2Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags3Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export type TDataCollectionFormat = { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array; +}; + +export class CollectionFormatService { + /** + * @throws ApiError + */ + public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { + const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = + data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + parameterArrayCSV: parameterArrayCsv, + parameterArraySSV: parameterArraySsv, + parameterArrayTSV: parameterArrayTsv, + parameterArrayPipes, + parameterArrayMulti, + }, + }); + } +} + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + /** + * This is an array parameter + */ + parameterArray: Array; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: unknown; + /** + * This is a string parameter + */ + parameterString?: string; +}; + +export class TypesService { + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns any Response is a simple object + * @throws ApiError + */ + public static types(data: TDataTypes): CancelablePromise { + const { + id, + parameterArray, + parameterBoolean = true, + parameterDictionary, + parameterEnum, + parameterNumber = 123, + parameterObject = null, + parameterString = 'default', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/types', + path: { + id, + }, + query: { + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, + parameterEnum, + }, + }); + } +} + +export type TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; + +export class ComplexService { + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public static complexTypes(data: TDataComplexTypes): CancelablePromise> { + const { parameterObject, parameterReference } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + parameterObject, + parameterReference, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export class HeaderService { + /** + * @returns string Successful response + * @throws ApiError + */ + public static callWithResultFromHeader(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export type TDataTestErrorCode = { + /** + * Status code to return + */ + status: string; +}; + +export class ErrorService { + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { + const { status } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/error', + query: { + status, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; +}; + +export class NonAsciiÆøåÆøÅöôêÊService { + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public static nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): CancelablePromise { + const { nonAsciiParamæøåÆøÅöôêÊ } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, + }, + }); + } +} diff --git a/test/__snapshots__/v2/services/CollectionFormatService.ts.snap b/test/__snapshots__/v2/services/CollectionFormatService.ts.snap deleted file mode 100644 index 35cb1d748..000000000 --- a/test/__snapshots__/v2/services/CollectionFormatService.ts.snap +++ /dev/null @@ -1,47 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCollectionFormat = { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCsv: Array; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array; -}; - -export class CollectionFormatService { - /** - * @throws ApiError - */ - public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { - const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = - data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/collectionFormat', - query: { - parameterArrayCSV: parameterArrayCsv, - parameterArraySSV: parameterArraySsv, - parameterArrayTSV: parameterArrayTsv, - parameterArrayPipes, - parameterArrayMulti, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/ComplexService.ts.snap b/test/__snapshots__/v2/services/ComplexService.ts.snap deleted file mode 100644 index 402761a1c..000000000 --- a/test/__snapshots__/v2/services/ComplexService.ts.snap +++ /dev/null @@ -1,43 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataComplexTypes = { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; -}; - -export class ComplexService { - /** - * @returns ModelWithString Successful response - * @throws ApiError - */ - public static complexTypes(data: TDataComplexTypes): CancelablePromise> { - const { parameterObject, parameterReference } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/complex', - query: { - parameterObject, - parameterReference, - }, - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/DefaultService.ts.snap b/test/__snapshots__/v2/services/DefaultService.ts.snap deleted file mode 100644 index f8039bead..000000000 --- a/test/__snapshots__/v2/services/DefaultService.ts.snap +++ /dev/null @@ -1,15 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class DefaultService { - /** - * @throws ApiError - */ - public static serviceWithEmptyTag(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } -} diff --git a/test/__snapshots__/v2/services/DefaultsService.ts.snap b/test/__snapshots__/v2/services/DefaultsService.ts.snap deleted file mode 100644 index dfe4f1917..000000000 --- a/test/__snapshots__/v2/services/DefaultsService.ts.snap +++ /dev/null @@ -1,169 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDefaultParameters = { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number with default value - */ - parameterNumber?: number; - /** - * This is a simple string with default value - */ - parameterString?: string; -}; -export type TDataCallWithDefaultOptionalParameters = { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; -}; -export type TDataCallToTestOrderOfParams = { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: string | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: string | null; - /** - * This is a string with default - */ - parameterStringWithDefault?: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault?: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; -}; - -export class DefaultsService { - /** - * @throws ApiError - */ - public static callWithDefaultParameters(data: TDataCallWithDefaultParameters): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public static callWithDefaultOptionalParameters( - data: TDataCallWithDefaultOptionalParameters = {} - ): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { - const { - parameterOptionalStringWithDefault = 'Hello World!', - parameterOptionalStringWithEmptyDefault = '', - parameterOptionalStringWithNoDefault, - parameterStringNullableWithDefault = null, - parameterStringNullableWithNoDefault, - parameterStringWithDefault = 'Hello World!', - parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, - } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/defaults', - query: { - parameterOptionalStringWithDefault, - parameterOptionalStringWithEmptyDefault, - parameterOptionalStringWithNoDefault, - parameterStringWithDefault, - parameterStringWithEmptyDefault, - parameterStringWithNoDefault, - parameterStringNullableWithNoDefault, - parameterStringNullableWithDefault, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/DescriptionsService.ts.snap b/test/__snapshots__/v2/services/DescriptionsService.ts.snap deleted file mode 100644 index 78d1d560b..000000000 --- a/test/__snapshots__/v2/services/DescriptionsService.ts.snap +++ /dev/null @@ -1,61 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDescriptions = { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: string; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: string; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: string; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: string; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: string; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: string; -}; - -export class DescriptionsService { - /** - * @throws ApiError - */ - public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { - const { - parameterWithBackticks, - parameterWithBreaks, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - parameterWithSlashes, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/descriptions/', - query: { - parameterWithBreaks, - parameterWithBackticks, - parameterWithSlashes, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/DuplicateService.ts.snap b/test/__snapshots__/v2/services/DuplicateService.ts.snap deleted file mode 100644 index 7381aac77..000000000 --- a/test/__snapshots__/v2/services/DuplicateService.ts.snap +++ /dev/null @@ -1,45 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class DuplicateService { - /** - * @throws ApiError - */ - public static duplicateName(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName1(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName2(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName3(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/duplicate', - }); - } -} diff --git a/test/__snapshots__/v2/services/ErrorService.ts.snap b/test/__snapshots__/v2/services/ErrorService.ts.snap deleted file mode 100644 index 35b6cd253..000000000 --- a/test/__snapshots__/v2/services/ErrorService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTestErrorCode = { - /** - * Status code to return - */ - status: string; -}; - -export class ErrorService { - /** - * @returns any Custom message: Successful response - * @throws ApiError - */ - public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { - const { status } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/error', - query: { - status, - }, - errors: { - 500: `Custom message: Internal Server Error`, - 501: `Custom message: Not Implemented`, - 502: `Custom message: Bad Gateway`, - 503: `Custom message: Service Unavailable`, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/HeaderService.ts.snap b/test/__snapshots__/v2/services/HeaderService.ts.snap deleted file mode 100644 index e451c3035..000000000 --- a/test/__snapshots__/v2/services/HeaderService.ts.snap +++ /dev/null @@ -1,21 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class HeaderService { - /** - * @returns string Successful response - * @throws ApiError - */ - public static callWithResultFromHeader(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/header', - responseHeader: 'operation-location', - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v2/services/MultipleTags1Service.ts.snap deleted file mode 100644 index 21cac6e19..000000000 --- a/test/__snapshots__/v2/services/MultipleTags1Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags1Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v2/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v2/services/MultipleTags2Service.ts.snap deleted file mode 100644 index 1c86961ad..000000000 --- a/test/__snapshots__/v2/services/MultipleTags2Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags2Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v2/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v2/services/MultipleTags3Service.ts.snap deleted file mode 100644 index 15fc09d44..000000000 --- a/test/__snapshots__/v2/services/MultipleTags3Service.ts.snap +++ /dev/null @@ -1,16 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags3Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v2/services/NoContentService.ts.snap b/test/__snapshots__/v2/services/NoContentService.ts.snap deleted file mode 100644 index c7836aaf8..000000000 --- a/test/__snapshots__/v2/services/NoContentService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class NoContentService { - /** - * @returns void Success - * @throws ApiError - */ - public static callWithNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-content', - }); - } - - /** - * @returns any Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } -} diff --git "a/test/__snapshots__/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" deleted file mode 100644 index e70a2394c..000000000 --- "a/test/__snapshots__/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" +++ /dev/null @@ -1,30 +0,0 @@ -import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { - /** - * Dummy input param - */ - nonAsciiParamæøåÆøÅöôêÊ: number; -}; - -export class NonAsciiÆøåÆøÅöôêÊService { - /** - * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response - * @throws ApiError - */ - public static nonAsciiæøåÆøÅöôêÊ字符串( - data: TDataNonAsciiæøåÆøÅöôêÊ字符串 - ): CancelablePromise { - const { nonAsciiParamæøåÆøÅöôêÊ } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', - query: { - nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/ParametersService.ts.snap b/test/__snapshots__/v2/services/ParametersService.ts.snap deleted file mode 100644 index 9dd6a1267..000000000 --- a/test/__snapshots__/v2/services/ParametersService.ts.snap +++ /dev/null @@ -1,122 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithParameters = { - /** - * This is the parameter that is sent as request body - */ - parameterBody: string; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string; - /** - * This is the parameter that goes into the path - */ - parameterPath: string; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that is sent as request body - */ - parameterBody: string; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string; - /** - * This is the parameter that goes into the path - */ - parameterPath1?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath2?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath3?: string; - /** - * This is the parameter that goes into the request query params - */ - parameterQuery: string; -}; - -export class ParametersService { - /** - * @throws ApiError - */ - public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { - const { parameterBody, parameterForm, parameterHeader, parameterPath, parameterQuery } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: { - parameterPath, - }, - headers: { - parameterHeader, - }, - query: { - parameterQuery, - }, - formData: { - parameterForm, - }, - body: parameterBody, - }); - } - - /** - * @throws ApiError - */ - public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { - const { - _default, - parameterBody, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - parameterQuery, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', - path: { - 'parameter.path.1': parameterPath1, - 'parameter-path-2': parameterPath2, - 'PARAMETER-PATH-3': parameterPath3, - }, - headers: { - 'parameter.header': parameterHeader, - }, - query: { - default: _default, - 'parameter-query': parameterQuery, - }, - formData: { - parameter_form: parameterForm, - }, - body: parameterBody, - }); - } -} diff --git a/test/__snapshots__/v2/services/ResponseService.ts.snap b/test/__snapshots__/v2/services/ResponseService.ts.snap deleted file mode 100644 index 3ec2aeba9..000000000 --- a/test/__snapshots__/v2/services/ResponseService.ts.snap +++ /dev/null @@ -1,73 +0,0 @@ -import type { ModelThatExtends, ModelThatExtendsExtends, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class ResponseService { - /** - * @returns any Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public static callWithResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/response', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public static callWithDuplicateResponses(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } - - /** - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public static callWithResponses(): CancelablePromise< - | { - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; - } - | ModelWithString - | ModelThatExtends - | ModelThatExtendsExtends - > { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/SimpleService.ts.snap b/test/__snapshots__/v2/services/SimpleService.ts.snap deleted file mode 100644 index 733ff7439..000000000 --- a/test/__snapshots__/v2/services/SimpleService.ts.snap +++ /dev/null @@ -1,75 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class SimpleService { - /** - * @throws ApiError - */ - public static getCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static putCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static deleteCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static optionsCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'OPTIONS', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static headCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'HEAD', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static patchCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PATCH', - url: '/api/v{api-version}/simple', - }); - } -} diff --git a/test/__snapshots__/v2/services/TypesService.ts.snap b/test/__snapshots__/v2/services/TypesService.ts.snap deleted file mode 100644 index a0bee9c3d..000000000 --- a/test/__snapshots__/v2/services/TypesService.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTypes = { - /** - * This is a number parameter - */ - id?: number; - /** - * This is an array parameter - */ - parameterArray: Array; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error'; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: unknown; - /** - * This is a string parameter - */ - parameterString?: string; -}; - -export class TypesService { - /** - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns any Response is a simple object - * @throws ApiError - */ - public static types(data: TDataTypes): CancelablePromise { - const { - id, - parameterArray, - parameterBoolean = true, - parameterDictionary, - parameterEnum, - parameterNumber = 123, - parameterObject = null, - parameterString = 'default', - } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/types', - path: { - id, - }, - query: { - parameterNumber, - parameterString, - parameterBoolean, - parameterObject, - parameterArray, - parameterDictionary, - parameterEnum, - }, - }); - } -} diff --git a/test/__snapshots__/v2/services/index.ts.snap b/test/__snapshots__/v2/services/index.ts.snap deleted file mode 100644 index f55f810d9..000000000 --- a/test/__snapshots__/v2/services/index.ts.snap +++ /dev/null @@ -1,17 +0,0 @@ -export { CollectionFormatService } from './CollectionFormatService'; -export { ComplexService } from './ComplexService'; -export { DefaultService } from './DefaultService'; -export { DefaultsService } from './DefaultsService'; -export { DescriptionsService } from './DescriptionsService'; -export { DuplicateService } from './DuplicateService'; -export { ErrorService } from './ErrorService'; -export { HeaderService } from './HeaderService'; -export { MultipleTags1Service } from './MultipleTags1Service'; -export { MultipleTags2Service } from './MultipleTags2Service'; -export { MultipleTags3Service } from './MultipleTags3Service'; -export { NoContentService } from './NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './ParametersService'; -export { ResponseService } from './ResponseService'; -export { SimpleService } from './SimpleService'; -export { TypesService } from './TypesService'; diff --git a/test/__snapshots__/v3/services.ts.snap b/test/__snapshots__/v3/services.ts.snap new file mode 100644 index 000000000..5ed220f66 --- /dev/null +++ b/test/__snapshots__/v3/services.ts.snap @@ -0,0 +1,1198 @@ +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; + +import type { + ModelWithArrayReadOnlyAndWriteOnly, + ModelWithReadOnlyAndWriteOnly, + ModelWithNestedArrayEnumsDataFoo, + ModelWithOneOfEnum, + ModelWithString, + Pageable, + DeprecatedModel, + ModelThatExtends, + ModelThatExtendsExtends, + ModelWithArray, + ModelWithDictionary, + ModelWithEnum, + NonAsciiStringæøåÆØÅöôêÊ字符串, +} from './models'; + +export type TDataPostServiceWithEmptyTag = { + requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; +}; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } + + /** + * @returns ModelWithReadOnlyAndWriteOnly + * @throws ApiError + */ + public static postServiceWithEmptyTag( + data: TDataPostServiceWithEmptyTag + ): CancelablePromise { + const { requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/no-tag', + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export class SimpleService { + /** + * @throws ApiError + */ + public static getCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static putCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static deleteCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static optionsCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static headCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static patchCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} + +export type TDataDeleteFoo = { + /** + * bar in method + */ + bar: string; + /** + * foo in method + */ + foo: string; +}; +export type TDataCallWithParameters = { + fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; + fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataGetCallWithOptionalParam = { + /** + * This is an optional parameter + */ + parameter?: string; + /** + * This is a required parameter + */ + requestBody: ModelWithOneOfEnum; +}; +export type TDataPostCallWithOptionalParam = { + /** + * This is a required parameter + */ + parameter: Pageable; + /** + * This is an optional parameter + */ + requestBody?: ModelWithString; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { + const { bar, foo } = data; + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/foo/{foo}/bar/{bar}', + path: { + foo, + bar, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { + fooAllOfEnum, + fooRefEnum, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + cookies: { + parameterCookie, + }, + headers: { + parameterHeader, + }, + query: { + foo_ref_enum: fooRefEnum, + foo_all_of_enum: fooAllOfEnum, + parameterQuery, + }, + formData: { + parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: { + 'parameter.path.1': parameterPath1, + 'parameter-path-2': parameterPath2, + 'PARAMETER-PATH-3': parameterPath3, + }, + cookies: { + 'PARAMETER-COOKIE': parameterCookie, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export type TDataCallWithDescriptions = { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; +}; + +export class DescriptionsService { + /** + * @throws ApiError + */ + public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { + const { + parameterWithBackticks, + parameterWithBreaks, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + parameterWithSlashes, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + parameterWithBreaks, + parameterWithBackticks, + parameterWithSlashes, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + }, + }); + } +} + +export type TDataDeprecatedCall = { + /** + * This parameter is deprecated + */ + parameter: DeprecatedModel | null; +}; + +export class DeprecatedService { + /** + * @deprecated + * @throws ApiError + */ + public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { + const { parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/deprecated', + headers: { + parameter, + }, + }); + } +} + +export type TDataPostApiRequestBody = { + /** + * A reusable request body + */ + foo?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class RequestBodyService { + /** + * @throws ApiError + */ + public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { + const { foo, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/requestBody/', + query: { + parameter, + }, + body: foo, + mediaType: 'application/json', + }); + } +} + +export type TDataPostApiFormData = { + /** + * A reusable request body + */ + formData?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class FormDataService { + /** + * @throws ApiError + */ + public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { + const { formData, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/formData/', + query: { + parameter, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } +} + +export type TDataCallWithDefaultParameters = { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * This is a simple string with default value + */ + parameterString?: string | null; +}; +export type TDataCallWithDefaultOptionalParameters = { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; +}; +export type TDataCallToTestOrderOfParams = { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; +}; + +export class DefaultsService { + /** + * @throws ApiError + */ + public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithDefaultOptionalParameters( + data: TDataCallWithDefaultOptionalParameters = {} + ): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { + const { + parameterOptionalStringWithDefault = 'Hello World!', + parameterOptionalStringWithEmptyDefault = '', + parameterOptionalStringWithNoDefault, + parameterStringNullableWithDefault = null, + parameterStringNullableWithNoDefault, + parameterStringWithDefault = 'Hello World!', + parameterStringWithEmptyDefault = '', + parameterStringWithNoDefault, + } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault, + parameterOptionalStringWithEmptyDefault, + parameterOptionalStringWithNoDefault, + parameterStringWithDefault, + parameterStringWithEmptyDefault, + parameterStringWithNoDefault, + parameterStringNullableWithNoDefault, + parameterStringNullableWithDefault, + }, + }); + } +} + +export class DuplicateService { + /** + * @throws ApiError + */ + public static duplicateName(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName1(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName2(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName3(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} + +export class NoContentService { + /** + * @returns void Success + * @throws ApiError + */ + public static callWithNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} + +export class ResponseService { + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString + * @throws ApiError + */ + public static callWithResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public static callWithDuplicateResponses(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public static callWithResponses(): CancelablePromise< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} + +export class MultipleTags1Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags2Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags3Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export type TDataCollectionFormat = { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array | null; +}; + +export class CollectionFormatService { + /** + * @throws ApiError + */ + public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { + const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = + data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + parameterArrayCSV: parameterArrayCsv, + parameterArraySSV: parameterArraySsv, + parameterArrayTSV: parameterArrayTsv, + parameterArrayPipes, + parameterArrayMulti, + }, + }); + } +} + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: Record | null; + /** + * This is a string parameter + */ + parameterString?: string | null; +}; + +export class TypesService { + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns unknown Response is a simple object + * @throws ApiError + */ + public static types(data: TDataTypes): CancelablePromise> { + const { + id, + parameterArray, + parameterBoolean = true, + parameterDictionary, + parameterEnum, + parameterNumber = 123, + parameterObject = null, + parameterString = 'default', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/types', + path: { + id, + }, + query: { + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, + parameterEnum, + }, + }); + } +} + +export type TDataUploadFile = { + /** + * Supply a file reference for upload + */ + file: Blob | File; +}; + +export class UploadService { + /** + * @returns boolean + * @throws ApiError + */ + public static uploadFile(data: TDataUploadFile): CancelablePromise { + const { file } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/upload', + formData: { + file, + }, + }); + } +} + +export type TDataFileResponse = { + id: string; +}; + +export class FileResponseService { + /** + * @returns binary Success + * @throws ApiError + */ + public static fileResponse(data: TDataFileResponse): CancelablePromise { + const { id } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/file/{id}', + path: { + id, + }, + }); + } +} + +export type TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; +export type TDataComplexParams = { + id: number; + requestBody?: { + readonly key: string | null; + name: string | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string | null; + }; + }; +}; + +export class ComplexService { + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public static complexTypes(data: TDataComplexTypes): CancelablePromise> { + const { parameterObject, parameterReference } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + parameterObject, + parameterReference, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } + + /** + * @returns ModelWithString Success + * @throws ApiError + */ + public static complexParams(data: TDataComplexParams): CancelablePromise { + const { id, requestBody } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/complex/{id}', + path: { + id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } +} + +export type TDataMultipartRequest = { + formData?: { + content?: Blob | File; + data?: ModelWithString | null; + }; +}; + +export class MultipartService { + /** + * @throws ApiError + */ + public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { + const { formData } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/multipart', + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * @returns any OK + * @throws ApiError + */ + public static multipartResponse(): CancelablePromise<{ + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multipart', + }); + } +} + +export class HeaderService { + /** + * @returns string Successful response + * @throws ApiError + */ + public static callWithResultFromHeader(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export type TDataTestErrorCode = { + /** + * Status code to return + */ + status: number; +}; + +export class ErrorService { + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { + const { status } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/error', + query: { + status, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; +}; + +export class NonAsciiÆøåÆøÅöôêÊService { + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public static nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): CancelablePromise> { + const { nonAsciiParamæøåÆøÅöôêÊ } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, + }, + }); + } +} diff --git a/test/__snapshots__/v3/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3/services/CollectionFormatService.ts.snap deleted file mode 100644 index 82db211fd..000000000 --- a/test/__snapshots__/v3/services/CollectionFormatService.ts.snap +++ /dev/null @@ -1,47 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCollectionFormat = { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCsv: Array | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array | null; -}; - -export class CollectionFormatService { - /** - * @throws ApiError - */ - public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { - const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = - data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/collectionFormat', - query: { - parameterArrayCSV: parameterArrayCsv, - parameterArraySSV: parameterArraySsv, - parameterArrayTSV: parameterArrayTsv, - parameterArrayPipes, - parameterArrayMulti, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/ComplexService.ts.snap b/test/__snapshots__/v3/services/ComplexService.ts.snap deleted file mode 100644 index fc3af8ed9..000000000 --- a/test/__snapshots__/v3/services/ComplexService.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -import type { ModelWithArray, ModelWithDictionary, ModelWithEnum, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataComplexTypes = { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; -}; -export type TDataComplexParams = { - id: number; - requestBody?: { - readonly key: string | null; - name: string | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array | null; - parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; - readonly user?: { - readonly id?: number; - readonly name?: string | null; - }; - }; -}; - -export class ComplexService { - /** - * @returns ModelWithString Successful response - * @throws ApiError - */ - public static complexTypes(data: TDataComplexTypes): CancelablePromise> { - const { parameterObject, parameterReference } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/complex', - query: { - parameterObject, - parameterReference, - }, - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } - - /** - * @returns ModelWithString Success - * @throws ApiError - */ - public static complexParams(data: TDataComplexParams): CancelablePromise { - const { id, requestBody } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/complex/{id}', - path: { - id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } -} diff --git a/test/__snapshots__/v3/services/DefaultService.ts.snap b/test/__snapshots__/v3/services/DefaultService.ts.snap deleted file mode 100644 index 7a42ade9a..000000000 --- a/test/__snapshots__/v3/services/DefaultService.ts.snap +++ /dev/null @@ -1,36 +0,0 @@ -import type { ModelWithArrayReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnly } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostServiceWithEmptyTag = { - requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; -}; - -export class DefaultService { - /** - * @throws ApiError - */ - public static serviceWithEmptyTag(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } - - /** - * @returns ModelWithReadOnlyAndWriteOnly - * @throws ApiError - */ - public static postServiceWithEmptyTag( - data: TDataPostServiceWithEmptyTag - ): CancelablePromise { - const { requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/no-tag', - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3/services/DefaultsService.ts.snap b/test/__snapshots__/v3/services/DefaultsService.ts.snap deleted file mode 100644 index d8512f64c..000000000 --- a/test/__snapshots__/v3/services/DefaultsService.ts.snap +++ /dev/null @@ -1,169 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDefaultParameters = { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: boolean | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString | null; - /** - * This is a simple number with default value - */ - parameterNumber?: number | null; - /** - * This is a simple string with default value - */ - parameterString?: string | null; -}; -export type TDataCallWithDefaultOptionalParameters = { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; -}; -export type TDataCallToTestOrderOfParams = { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: string | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: string | null; - /** - * This is a string with default - */ - parameterStringWithDefault?: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault?: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; -}; - -export class DefaultsService { - /** - * @throws ApiError - */ - public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public static callWithDefaultOptionalParameters( - data: TDataCallWithDefaultOptionalParameters = {} - ): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { - const { - parameterOptionalStringWithDefault = 'Hello World!', - parameterOptionalStringWithEmptyDefault = '', - parameterOptionalStringWithNoDefault, - parameterStringNullableWithDefault = null, - parameterStringNullableWithNoDefault, - parameterStringWithDefault = 'Hello World!', - parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, - } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/defaults', - query: { - parameterOptionalStringWithDefault, - parameterOptionalStringWithEmptyDefault, - parameterOptionalStringWithNoDefault, - parameterStringWithDefault, - parameterStringWithEmptyDefault, - parameterStringWithNoDefault, - parameterStringNullableWithNoDefault, - parameterStringNullableWithDefault, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/DeprecatedService.ts.snap b/test/__snapshots__/v3/services/DeprecatedService.ts.snap deleted file mode 100644 index ea66c58d8..000000000 --- a/test/__snapshots__/v3/services/DeprecatedService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { DeprecatedModel } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeprecatedCall = { - /** - * This parameter is deprecated - */ - parameter: DeprecatedModel | null; -}; - -export class DeprecatedService { - /** - * @deprecated - * @throws ApiError - */ - public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { - const { parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/deprecated', - headers: { - parameter, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/DescriptionsService.ts.snap b/test/__snapshots__/v3/services/DescriptionsService.ts.snap deleted file mode 100644 index 4542a21a4..000000000 --- a/test/__snapshots__/v3/services/DescriptionsService.ts.snap +++ /dev/null @@ -1,61 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDescriptions = { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; -}; - -export class DescriptionsService { - /** - * @throws ApiError - */ - public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { - const { - parameterWithBackticks, - parameterWithBreaks, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - parameterWithSlashes, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/descriptions/', - query: { - parameterWithBreaks, - parameterWithBackticks, - parameterWithSlashes, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/DuplicateService.ts.snap b/test/__snapshots__/v3/services/DuplicateService.ts.snap deleted file mode 100644 index 7381aac77..000000000 --- a/test/__snapshots__/v3/services/DuplicateService.ts.snap +++ /dev/null @@ -1,45 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class DuplicateService { - /** - * @throws ApiError - */ - public static duplicateName(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName1(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName2(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName3(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/duplicate', - }); - } -} diff --git a/test/__snapshots__/v3/services/ErrorService.ts.snap b/test/__snapshots__/v3/services/ErrorService.ts.snap deleted file mode 100644 index 751c848e3..000000000 --- a/test/__snapshots__/v3/services/ErrorService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTestErrorCode = { - /** - * Status code to return - */ - status: number; -}; - -export class ErrorService { - /** - * @returns any Custom message: Successful response - * @throws ApiError - */ - public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { - const { status } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/error', - query: { - status, - }, - errors: { - 500: `Custom message: Internal Server Error`, - 501: `Custom message: Not Implemented`, - 502: `Custom message: Bad Gateway`, - 503: `Custom message: Service Unavailable`, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/FileResponseService.ts.snap b/test/__snapshots__/v3/services/FileResponseService.ts.snap deleted file mode 100644 index 15f852507..000000000 --- a/test/__snapshots__/v3/services/FileResponseService.ts.snap +++ /dev/null @@ -1,24 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataFileResponse = { - id: string; -}; - -export class FileResponseService { - /** - * @returns binary Success - * @throws ApiError - */ - public static fileResponse(data: TDataFileResponse): CancelablePromise { - const { id } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/file/{id}', - path: { - id, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/FormDataService.ts.snap b/test/__snapshots__/v3/services/FormDataService.ts.snap deleted file mode 100644 index 7c7624b4d..000000000 --- a/test/__snapshots__/v3/services/FormDataService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiFormData = { - /** - * A reusable request body - */ - formData?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -export class FormDataService { - /** - * @throws ApiError - */ - public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { - const { formData, parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/formData/', - query: { - parameter, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } -} diff --git a/test/__snapshots__/v3/services/HeaderService.ts.snap b/test/__snapshots__/v3/services/HeaderService.ts.snap deleted file mode 100644 index e451c3035..000000000 --- a/test/__snapshots__/v3/services/HeaderService.ts.snap +++ /dev/null @@ -1,21 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class HeaderService { - /** - * @returns string Successful response - * @throws ApiError - */ - public static callWithResultFromHeader(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/header', - responseHeader: 'operation-location', - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/MultipartService.ts.snap b/test/__snapshots__/v3/services/MultipartService.ts.snap deleted file mode 100644 index be7e46083..000000000 --- a/test/__snapshots__/v3/services/MultipartService.ts.snap +++ /dev/null @@ -1,43 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataMultipartRequest = { - formData?: { - content?: Blob | File; - data?: ModelWithString | null; - }; -}; - -export class MultipartService { - /** - * @throws ApiError - */ - public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { - const { formData } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/multipart', - formData: formData, - mediaType: 'multipart/form-data', - }); - } - - /** - * @returns any OK - * @throws ApiError - */ - public static multipartResponse(): CancelablePromise<{ - file?: Blob | File; - metadata?: { - foo?: string; - bar?: string; - }; - }> { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multipart', - }); - } -} diff --git a/test/__snapshots__/v3/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3/services/MultipleTags1Service.ts.snap deleted file mode 100644 index 21cac6e19..000000000 --- a/test/__snapshots__/v3/services/MultipleTags1Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags1Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3/services/MultipleTags2Service.ts.snap deleted file mode 100644 index 1c86961ad..000000000 --- a/test/__snapshots__/v3/services/MultipleTags2Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags2Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3/services/MultipleTags3Service.ts.snap deleted file mode 100644 index 15fc09d44..000000000 --- a/test/__snapshots__/v3/services/MultipleTags3Service.ts.snap +++ /dev/null @@ -1,16 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags3Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3/services/NoContentService.ts.snap b/test/__snapshots__/v3/services/NoContentService.ts.snap deleted file mode 100644 index 4af0ece57..000000000 --- a/test/__snapshots__/v3/services/NoContentService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class NoContentService { - /** - * @returns void Success - * @throws ApiError - */ - public static callWithNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-content', - }); - } - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } -} diff --git "a/test/__snapshots__/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" deleted file mode 100644 index c48469f26..000000000 --- "a/test/__snapshots__/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" +++ /dev/null @@ -1,30 +0,0 @@ -import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { - /** - * Dummy input param - */ - nonAsciiParamæøåÆøÅöôêÊ: number; -}; - -export class NonAsciiÆøåÆøÅöôêÊService { - /** - * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response - * @throws ApiError - */ - public static nonAsciiæøåÆøÅöôêÊ字符串( - data: TDataNonAsciiæøåÆøÅöôêÊ字符串 - ): CancelablePromise> { - const { nonAsciiParamæøåÆøÅöôêÊ } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', - query: { - nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/ParametersService.ts.snap b/test/__snapshots__/v3/services/ParametersService.ts.snap deleted file mode 100644 index 26e9b22a5..000000000 --- a/test/__snapshots__/v3/services/ParametersService.ts.snap +++ /dev/null @@ -1,230 +0,0 @@ -import type { ModelWithNestedArrayEnumsDataFoo, ModelWithOneOfEnum, ModelWithString, Pageable } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeleteFoo = { - /** - * bar in method - */ - bar: string; - /** - * foo in method - */ - foo: string; -}; -export type TDataCallWithParameters = { - fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; - fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: string | null; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath1?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath2?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath3?: string; - /** - * This is the parameter that goes into the request query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataGetCallWithOptionalParam = { - /** - * This is an optional parameter - */ - parameter?: string; - /** - * This is a required parameter - */ - requestBody: ModelWithOneOfEnum; -}; -export type TDataPostCallWithOptionalParam = { - /** - * This is a required parameter - */ - parameter: Pageable; - /** - * This is an optional parameter - */ - requestBody?: ModelWithString; -}; - -export class ParametersService { - /** - * @throws ApiError - */ - public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { - const { bar, foo } = data; - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/foo/{foo}/bar/{bar}', - path: { - foo, - bar, - }, - }); - } - - /** - * @throws ApiError - */ - public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { - const { - fooAllOfEnum, - fooRefEnum, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath, - parameterQuery, - requestBody, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: { - parameterPath, - }, - cookies: { - parameterCookie, - }, - headers: { - parameterHeader, - }, - query: { - foo_ref_enum: fooRefEnum, - foo_all_of_enum: fooAllOfEnum, - parameterQuery, - }, - formData: { - parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { - const { - _default, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - parameterQuery, - requestBody, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', - path: { - 'parameter.path.1': parameterPath1, - 'parameter-path-2': parameterPath2, - 'PARAMETER-PATH-3': parameterPath3, - }, - cookies: { - 'PARAMETER-COOKIE': parameterCookie, - }, - headers: { - 'parameter.header': parameterHeader, - }, - query: { - default: _default, - 'parameter-query': parameterQuery, - }, - formData: { - parameter_form: parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { - const { parameter, requestBody } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { - const { parameter, requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3/services/RequestBodyService.ts.snap b/test/__snapshots__/v3/services/RequestBodyService.ts.snap deleted file mode 100644 index 248524bb9..000000000 --- a/test/__snapshots__/v3/services/RequestBodyService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiRequestBody = { - /** - * A reusable request body - */ - foo?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -export class RequestBodyService { - /** - * @throws ApiError - */ - public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { - const { foo, parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/requestBody/', - query: { - parameter, - }, - body: foo, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3/services/ResponseService.ts.snap b/test/__snapshots__/v3/services/ResponseService.ts.snap deleted file mode 100644 index d25e4d887..000000000 --- a/test/__snapshots__/v3/services/ResponseService.ts.snap +++ /dev/null @@ -1,73 +0,0 @@ -import type { ModelThatExtends, ModelThatExtendsExtends, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class ResponseService { - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } - - /** - * @returns ModelWithString - * @throws ApiError - */ - public static callWithResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/response', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public static callWithDuplicateResponses(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } - - /** - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public static callWithResponses(): CancelablePromise< - | { - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; - } - | ModelWithString - | ModelThatExtends - | ModelThatExtendsExtends - > { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/SimpleService.ts.snap b/test/__snapshots__/v3/services/SimpleService.ts.snap deleted file mode 100644 index 733ff7439..000000000 --- a/test/__snapshots__/v3/services/SimpleService.ts.snap +++ /dev/null @@ -1,75 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class SimpleService { - /** - * @throws ApiError - */ - public static getCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static putCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static deleteCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static optionsCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'OPTIONS', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static headCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'HEAD', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static patchCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PATCH', - url: '/api/v{api-version}/simple', - }); - } -} diff --git a/test/__snapshots__/v3/services/TypesService.ts.snap b/test/__snapshots__/v3/services/TypesService.ts.snap deleted file mode 100644 index 992dac546..000000000 --- a/test/__snapshots__/v3/services/TypesService.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTypes = { - /** - * This is a number parameter - */ - id?: number; - /** - * This is an array parameter - */ - parameterArray: Array | null; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record | null; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error' | null; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: Record | null; - /** - * This is a string parameter - */ - parameterString?: string | null; -}; - -export class TypesService { - /** - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns unknown Response is a simple object - * @throws ApiError - */ - public static types(data: TDataTypes): CancelablePromise> { - const { - id, - parameterArray, - parameterBoolean = true, - parameterDictionary, - parameterEnum, - parameterNumber = 123, - parameterObject = null, - parameterString = 'default', - } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/types', - path: { - id, - }, - query: { - parameterNumber, - parameterString, - parameterBoolean, - parameterObject, - parameterArray, - parameterDictionary, - parameterEnum, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/UploadService.ts.snap b/test/__snapshots__/v3/services/UploadService.ts.snap deleted file mode 100644 index 22847f40c..000000000 --- a/test/__snapshots__/v3/services/UploadService.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataUploadFile = { - /** - * Supply a file reference for upload - */ - file: Blob | File; -}; - -export class UploadService { - /** - * @returns boolean - * @throws ApiError - */ - public static uploadFile(data: TDataUploadFile): CancelablePromise { - const { file } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/upload', - formData: { - file, - }, - }); - } -} diff --git a/test/__snapshots__/v3/services/index.ts.snap b/test/__snapshots__/v3/services/index.ts.snap deleted file mode 100644 index 3243a2fb1..000000000 --- a/test/__snapshots__/v3/services/index.ts.snap +++ /dev/null @@ -1,23 +0,0 @@ -export { CollectionFormatService } from './CollectionFormatService'; -export { ComplexService } from './ComplexService'; -export { DefaultService } from './DefaultService'; -export { DefaultsService } from './DefaultsService'; -export { DeprecatedService } from './DeprecatedService'; -export { DescriptionsService } from './DescriptionsService'; -export { DuplicateService } from './DuplicateService'; -export { ErrorService } from './ErrorService'; -export { FileResponseService } from './FileResponseService'; -export { FormDataService } from './FormDataService'; -export { HeaderService } from './HeaderService'; -export { MultipartService } from './MultipartService'; -export { MultipleTags1Service } from './MultipleTags1Service'; -export { MultipleTags2Service } from './MultipleTags2Service'; -export { MultipleTags3Service } from './MultipleTags3Service'; -export { NoContentService } from './NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './ParametersService'; -export { RequestBodyService } from './RequestBodyService'; -export { ResponseService } from './ResponseService'; -export { SimpleService } from './SimpleService'; -export { TypesService } from './TypesService'; -export { UploadService } from './UploadService'; diff --git a/test/__snapshots__/v3_angular/services.ts.snap b/test/__snapshots__/v3_angular/services.ts.snap new file mode 100644 index 000000000..cf66b6202 --- /dev/null +++ b/test/__snapshots__/v3_angular/services.ts.snap @@ -0,0 +1,1311 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import type { Observable } from 'rxjs'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; + +import type { + ModelWithArrayReadOnlyAndWriteOnly, + ModelWithReadOnlyAndWriteOnly, + ModelWithNestedArrayEnumsDataFoo, + ModelWithOneOfEnum, + ModelWithString, + Pageable, + DeprecatedModel, + ModelThatExtends, + ModelThatExtendsExtends, + ModelWithArray, + ModelWithDictionary, + ModelWithEnum, + NonAsciiStringæøåÆØÅöôêÊ字符串, +} from './models'; + +export type TDataPostServiceWithEmptyTag = { + requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; +}; + +@Injectable({ + providedIn: 'root', +}) +export class DefaultService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public serviceWithEmptyTag(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } + + /** + * @returns ModelWithReadOnlyAndWriteOnly + * @throws ApiError + */ + public postServiceWithEmptyTag(data: TDataPostServiceWithEmptyTag): Observable { + const { requestBody } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/no-tag', + body: requestBody, + mediaType: 'application/json', + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class SimpleService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public getCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public putCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public postCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public deleteCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public optionsCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public headCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public patchCallWithoutParametersAndResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} + +export type TDataDeleteFoo = { + /** + * bar in method + */ + bar: string; + /** + * foo in method + */ + foo: string; +}; +export type TDataCallWithParameters = { + fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; + fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataGetCallWithOptionalParam = { + /** + * This is an optional parameter + */ + parameter?: string; + /** + * This is a required parameter + */ + requestBody: ModelWithOneOfEnum; +}; +export type TDataPostCallWithOptionalParam = { + /** + * This is a required parameter + */ + parameter: Pageable; + /** + * This is an optional parameter + */ + requestBody?: ModelWithString; +}; + +@Injectable({ + providedIn: 'root', +}) +export class ParametersService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public deleteFoo(data: TDataDeleteFoo): Observable { + const { bar, foo } = data; + return __request(OpenAPI, this.http, { + method: 'DELETE', + url: '/api/v{api-version}/foo/{foo}/bar/{bar}', + path: { + foo, + bar, + }, + }); + } + + /** + * @throws ApiError + */ + public callWithParameters(data: TDataCallWithParameters): Observable { + const { + fooAllOfEnum, + fooRefEnum, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + cookies: { + parameterCookie, + }, + headers: { + parameterHeader, + }, + query: { + foo_ref_enum: fooRefEnum, + foo_all_of_enum: fooAllOfEnum, + parameterQuery, + }, + formData: { + parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): Observable { + const { + _default, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: { + 'parameter.path.1': parameterPath1, + 'parameter-path-2': parameterPath2, + 'PARAMETER-PATH-3': parameterPath3, + }, + cookies: { + 'PARAMETER-COOKIE': parameterCookie, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): Observable { + const { parameter, requestBody } = data; + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): Observable { + const { parameter, requestBody } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export type TDataCallWithDescriptions = { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; +}; + +@Injectable({ + providedIn: 'root', +}) +export class DescriptionsService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public callWithDescriptions(data: TDataCallWithDescriptions = {}): Observable { + const { + parameterWithBackticks, + parameterWithBreaks, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + parameterWithSlashes, + } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + parameterWithBreaks, + parameterWithBackticks, + parameterWithSlashes, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + }, + }); + } +} + +export type TDataDeprecatedCall = { + /** + * This parameter is deprecated + */ + parameter: DeprecatedModel | null; +}; + +@Injectable({ + providedIn: 'root', +}) +export class DeprecatedService { + constructor(public readonly http: HttpClient) {} + + /** + * @deprecated + * @throws ApiError + */ + public deprecatedCall(data: TDataDeprecatedCall): Observable { + const { parameter } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/parameters/deprecated', + headers: { + parameter, + }, + }); + } +} + +export type TDataPostApiRequestBody = { + /** + * A reusable request body + */ + foo?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +@Injectable({ + providedIn: 'root', +}) +export class RequestBodyService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public postApiRequestBody(data: TDataPostApiRequestBody = {}): Observable { + const { foo, parameter } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/requestBody/', + query: { + parameter, + }, + body: foo, + mediaType: 'application/json', + }); + } +} + +export type TDataPostApiFormData = { + /** + * A reusable request body + */ + formData?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +@Injectable({ + providedIn: 'root', +}) +export class FormDataService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public postApiFormData(data: TDataPostApiFormData = {}): Observable { + const { formData, parameter } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/formData/', + query: { + parameter, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } +} + +export type TDataCallWithDefaultParameters = { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * This is a simple string with default value + */ + parameterString?: string | null; +}; +export type TDataCallWithDefaultOptionalParameters = { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; +}; +export type TDataCallToTestOrderOfParams = { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; +}; + +@Injectable({ + providedIn: 'root', +}) +export class DefaultsService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): Observable { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public callWithDefaultOptionalParameters(data: TDataCallWithDefaultOptionalParameters = {}): Observable { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): Observable { + const { + parameterOptionalStringWithDefault = 'Hello World!', + parameterOptionalStringWithEmptyDefault = '', + parameterOptionalStringWithNoDefault, + parameterStringNullableWithDefault = null, + parameterStringNullableWithNoDefault, + parameterStringWithDefault = 'Hello World!', + parameterStringWithEmptyDefault = '', + parameterStringWithNoDefault, + } = data; + return __request(OpenAPI, this.http, { + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault, + parameterOptionalStringWithEmptyDefault, + parameterOptionalStringWithNoDefault, + parameterStringWithDefault, + parameterStringWithEmptyDefault, + parameterStringWithNoDefault, + parameterStringNullableWithNoDefault, + parameterStringNullableWithDefault, + }, + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class DuplicateService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public duplicateName(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public duplicateName1(): Observable { + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public duplicateName2(): Observable { + return __request(OpenAPI, this.http, { + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public duplicateName3(): Observable { + return __request(OpenAPI, this.http, { + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class NoContentService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns void Success + * @throws ApiError + */ + public callWithNoContentResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public callWithResponseAndNoContentResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class ResponseService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public callWithResponseAndNoContentResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString + * @throws ApiError + */ + public callWithResponse(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public callWithDuplicateResponses(): Observable { + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public callWithResponses(): Observable< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return __request(OpenAPI, this.http, { + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class MultipleTags1Service { + constructor(public readonly http: HttpClient) {} + + /** + * @returns void Success + * @throws ApiError + */ + public dummyA(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public dummyB(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class MultipleTags2Service { + constructor(public readonly http: HttpClient) {} + + /** + * @returns void Success + * @throws ApiError + */ + public dummyA(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public dummyB(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class MultipleTags3Service { + constructor(public readonly http: HttpClient) {} + + /** + * @returns void Success + * @throws ApiError + */ + public dummyB(): Observable { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export type TDataCollectionFormat = { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array | null; +}; + +@Injectable({ + providedIn: 'root', +}) +export class CollectionFormatService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public collectionFormat(data: TDataCollectionFormat): Observable { + const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = + data; + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + parameterArrayCSV: parameterArrayCsv, + parameterArraySSV: parameterArraySsv, + parameterArrayTSV: parameterArrayTsv, + parameterArrayPipes, + parameterArrayMulti, + }, + }); + } +} + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: Record | null; + /** + * This is a string parameter + */ + parameterString?: string | null; +}; + +@Injectable({ + providedIn: 'root', +}) +export class TypesService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns unknown Response is a simple object + * @throws ApiError + */ + public types(data: TDataTypes): Observable> { + const { + id, + parameterArray, + parameterBoolean = true, + parameterDictionary, + parameterEnum, + parameterNumber = 123, + parameterObject = null, + parameterString = 'default', + } = data; + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/types', + path: { + id, + }, + query: { + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, + parameterEnum, + }, + }); + } +} + +export type TDataUploadFile = { + /** + * Supply a file reference for upload + */ + file: Blob | File; +}; + +@Injectable({ + providedIn: 'root', +}) +export class UploadService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns boolean + * @throws ApiError + */ + public uploadFile(data: TDataUploadFile): Observable { + const { file } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/upload', + formData: { + file, + }, + }); + } +} + +export type TDataFileResponse = { + id: string; +}; + +@Injectable({ + providedIn: 'root', +}) +export class FileResponseService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns binary Success + * @throws ApiError + */ + public fileResponse(data: TDataFileResponse): Observable { + const { id } = data; + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/file/{id}', + path: { + id, + }, + }); + } +} + +export type TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; +export type TDataComplexParams = { + id: number; + requestBody?: { + readonly key: string | null; + name: string | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string | null; + }; + }; +}; + +@Injectable({ + providedIn: 'root', +}) +export class ComplexService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public complexTypes(data: TDataComplexTypes): Observable> { + const { parameterObject, parameterReference } = data; + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + parameterObject, + parameterReference, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } + + /** + * @returns ModelWithString Success + * @throws ApiError + */ + public complexParams(data: TDataComplexParams): Observable { + const { id, requestBody } = data; + return __request(OpenAPI, this.http, { + method: 'PUT', + url: '/api/v{api-version}/complex/{id}', + path: { + id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } +} + +export type TDataMultipartRequest = { + formData?: { + content?: Blob | File; + data?: ModelWithString | null; + }; +}; + +@Injectable({ + providedIn: 'root', +}) +export class MultipartService { + constructor(public readonly http: HttpClient) {} + + /** + * @throws ApiError + */ + public multipartRequest(data: TDataMultipartRequest = {}): Observable { + const { formData } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/multipart', + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * @returns any OK + * @throws ApiError + */ + public multipartResponse(): Observable<{ + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }> { + return __request(OpenAPI, this.http, { + method: 'GET', + url: '/api/v{api-version}/multipart', + }); + } +} + +@Injectable({ + providedIn: 'root', +}) +export class HeaderService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns string Successful response + * @throws ApiError + */ + public callWithResultFromHeader(): Observable { + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export type TDataTestErrorCode = { + /** + * Status code to return + */ + status: number; +}; + +@Injectable({ + providedIn: 'root', +}) +export class ErrorService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public testErrorCode(data: TDataTestErrorCode): Observable { + const { status } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/error', + query: { + status, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; +}; + +@Injectable({ + providedIn: 'root', +}) +export class NonAsciiÆøåÆøÅöôêÊService { + constructor(public readonly http: HttpClient) {} + + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): Observable> { + const { nonAsciiParamæøåÆøÅöôêÊ } = data; + return __request(OpenAPI, this.http, { + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, + }, + }); + } +} diff --git a/test/__snapshots__/v3_angular/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3_angular/services/CollectionFormatService.ts.snap deleted file mode 100644 index 5f6053f35..000000000 --- a/test/__snapshots__/v3_angular/services/CollectionFormatService.ts.snap +++ /dev/null @@ -1,55 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCollectionFormat = { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCsv: Array | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array | null; -}; - -@Injectable({ - providedIn: 'root', -}) -export class CollectionFormatService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public collectionFormat(data: TDataCollectionFormat): Observable { - const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = - data; - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/collectionFormat', - query: { - parameterArrayCSV: parameterArrayCsv, - parameterArraySSV: parameterArraySsv, - parameterArrayTSV: parameterArrayTsv, - parameterArrayPipes, - parameterArrayMulti, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/ComplexService.ts.snap b/test/__snapshots__/v3_angular/services/ComplexService.ts.snap deleted file mode 100644 index d89d51a49..000000000 --- a/test/__snapshots__/v3_angular/services/ComplexService.ts.snap +++ /dev/null @@ -1,83 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithArray, ModelWithDictionary, ModelWithEnum, ModelWithString } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataComplexTypes = { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; -}; -export type TDataComplexParams = { - id: number; - requestBody?: { - readonly key: string | null; - name: string | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array | null; - parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; - readonly user?: { - readonly id?: number; - readonly name?: string | null; - }; - }; -}; - -@Injectable({ - providedIn: 'root', -}) -export class ComplexService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns ModelWithString Successful response - * @throws ApiError - */ - public complexTypes(data: TDataComplexTypes): Observable> { - const { parameterObject, parameterReference } = data; - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/complex', - query: { - parameterObject, - parameterReference, - }, - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } - - /** - * @returns ModelWithString Success - * @throws ApiError - */ - public complexParams(data: TDataComplexParams): Observable { - const { id, requestBody } = data; - return __request(OpenAPI, this.http, { - method: 'PUT', - url: '/api/v{api-version}/complex/{id}', - path: { - id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/DefaultService.ts.snap b/test/__snapshots__/v3_angular/services/DefaultService.ts.snap deleted file mode 100644 index f5c8c2cc3..000000000 --- a/test/__snapshots__/v3_angular/services/DefaultService.ts.snap +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithArrayReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnly } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostServiceWithEmptyTag = { - requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; -}; - -@Injectable({ - providedIn: 'root', -}) -export class DefaultService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public serviceWithEmptyTag(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } - - /** - * @returns ModelWithReadOnlyAndWriteOnly - * @throws ApiError - */ - public postServiceWithEmptyTag(data: TDataPostServiceWithEmptyTag): Observable { - const { requestBody } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/no-tag', - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/DefaultsService.ts.snap b/test/__snapshots__/v3_angular/services/DefaultsService.ts.snap deleted file mode 100644 index 7d2dab76c..000000000 --- a/test/__snapshots__/v3_angular/services/DefaultsService.ts.snap +++ /dev/null @@ -1,174 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithString } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDefaultParameters = { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: boolean | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString | null; - /** - * This is a simple number with default value - */ - parameterNumber?: number | null; - /** - * This is a simple string with default value - */ - parameterString?: string | null; -}; -export type TDataCallWithDefaultOptionalParameters = { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; -}; -export type TDataCallToTestOrderOfParams = { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: string | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: string | null; - /** - * This is a string with default - */ - parameterStringWithDefault?: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault?: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; -}; - -@Injectable({ - providedIn: 'root', -}) -export class DefaultsService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): Observable { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public callWithDefaultOptionalParameters(data: TDataCallWithDefaultOptionalParameters = {}): Observable { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): Observable { - const { - parameterOptionalStringWithDefault = 'Hello World!', - parameterOptionalStringWithEmptyDefault = '', - parameterOptionalStringWithNoDefault, - parameterStringNullableWithDefault = null, - parameterStringNullableWithNoDefault, - parameterStringWithDefault = 'Hello World!', - parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, - } = data; - return __request(OpenAPI, this.http, { - method: 'PUT', - url: '/api/v{api-version}/defaults', - query: { - parameterOptionalStringWithDefault, - parameterOptionalStringWithEmptyDefault, - parameterOptionalStringWithNoDefault, - parameterStringWithDefault, - parameterStringWithEmptyDefault, - parameterStringWithNoDefault, - parameterStringNullableWithNoDefault, - parameterStringNullableWithDefault, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/DeprecatedService.ts.snap b/test/__snapshots__/v3_angular/services/DeprecatedService.ts.snap deleted file mode 100644 index ea44320f7..000000000 --- a/test/__snapshots__/v3_angular/services/DeprecatedService.ts.snap +++ /dev/null @@ -1,35 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { DeprecatedModel } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeprecatedCall = { - /** - * This parameter is deprecated - */ - parameter: DeprecatedModel | null; -}; - -@Injectable({ - providedIn: 'root', -}) -export class DeprecatedService { - constructor(public readonly http: HttpClient) {} - - /** - * @deprecated - * @throws ApiError - */ - public deprecatedCall(data: TDataDeprecatedCall): Observable { - const { parameter } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/parameters/deprecated', - headers: { - parameter, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/DescriptionsService.ts.snap b/test/__snapshots__/v3_angular/services/DescriptionsService.ts.snap deleted file mode 100644 index 12aae77b9..000000000 --- a/test/__snapshots__/v3_angular/services/DescriptionsService.ts.snap +++ /dev/null @@ -1,69 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDescriptions = { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; -}; - -@Injectable({ - providedIn: 'root', -}) -export class DescriptionsService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public callWithDescriptions(data: TDataCallWithDescriptions = {}): Observable { - const { - parameterWithBackticks, - parameterWithBreaks, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - parameterWithSlashes, - } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/descriptions/', - query: { - parameterWithBreaks, - parameterWithBackticks, - parameterWithSlashes, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/DuplicateService.ts.snap b/test/__snapshots__/v3_angular/services/DuplicateService.ts.snap deleted file mode 100644 index 55b0c72e8..000000000 --- a/test/__snapshots__/v3_angular/services/DuplicateService.ts.snap +++ /dev/null @@ -1,53 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class DuplicateService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public duplicateName(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public duplicateName1(): Observable { - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public duplicateName2(): Observable { - return __request(OpenAPI, this.http, { - method: 'PUT', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public duplicateName3(): Observable { - return __request(OpenAPI, this.http, { - method: 'DELETE', - url: '/api/v{api-version}/duplicate', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/ErrorService.ts.snap b/test/__snapshots__/v3_angular/services/ErrorService.ts.snap deleted file mode 100644 index de9bf6143..000000000 --- a/test/__snapshots__/v3_angular/services/ErrorService.ts.snap +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTestErrorCode = { - /** - * Status code to return - */ - status: number; -}; - -@Injectable({ - providedIn: 'root', -}) -export class ErrorService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns any Custom message: Successful response - * @throws ApiError - */ - public testErrorCode(data: TDataTestErrorCode): Observable { - const { status } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/error', - query: { - status, - }, - errors: { - 500: `Custom message: Internal Server Error`, - 501: `Custom message: Not Implemented`, - 502: `Custom message: Bad Gateway`, - 503: `Custom message: Service Unavailable`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/FileResponseService.ts.snap b/test/__snapshots__/v3_angular/services/FileResponseService.ts.snap deleted file mode 100644 index 477a57612..000000000 --- a/test/__snapshots__/v3_angular/services/FileResponseService.ts.snap +++ /dev/null @@ -1,32 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataFileResponse = { - id: string; -}; - -@Injectable({ - providedIn: 'root', -}) -export class FileResponseService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns binary Success - * @throws ApiError - */ - public fileResponse(data: TDataFileResponse): Observable { - const { id } = data; - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/file/{id}', - path: { - id, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/FormDataService.ts.snap b/test/__snapshots__/v3_angular/services/FormDataService.ts.snap deleted file mode 100644 index 93fef2ab6..000000000 --- a/test/__snapshots__/v3_angular/services/FormDataService.ts.snap +++ /dev/null @@ -1,40 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithString } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiFormData = { - /** - * A reusable request body - */ - formData?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -@Injectable({ - providedIn: 'root', -}) -export class FormDataService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public postApiFormData(data: TDataPostApiFormData = {}): Observable { - const { formData, parameter } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/formData/', - query: { - parameter, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/HeaderService.ts.snap b/test/__snapshots__/v3_angular/services/HeaderService.ts.snap deleted file mode 100644 index ce02d3f58..000000000 --- a/test/__snapshots__/v3_angular/services/HeaderService.ts.snap +++ /dev/null @@ -1,29 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class HeaderService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns string Successful response - * @throws ApiError - */ - public callWithResultFromHeader(): Observable { - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/header', - responseHeader: 'operation-location', - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/MultipartService.ts.snap b/test/__snapshots__/v3_angular/services/MultipartService.ts.snap deleted file mode 100644 index 6fc5e3a1e..000000000 --- a/test/__snapshots__/v3_angular/services/MultipartService.ts.snap +++ /dev/null @@ -1,50 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithString } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataMultipartRequest = { - formData?: { - content?: Blob | File; - data?: ModelWithString | null; - }; -}; - -@Injectable({ - providedIn: 'root', -}) -export class MultipartService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public multipartRequest(data: TDataMultipartRequest = {}): Observable { - const { formData } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/multipart', - formData: formData, - mediaType: 'multipart/form-data', - }); - } - - /** - * @returns any OK - * @throws ApiError - */ - public multipartResponse(): Observable<{ - file?: Blob | File; - metadata?: { - foo?: string; - bar?: string; - }; - }> { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multipart', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3_angular/services/MultipleTags1Service.ts.snap deleted file mode 100644 index 7480c3955..000000000 --- a/test/__snapshots__/v3_angular/services/MultipleTags1Service.ts.snap +++ /dev/null @@ -1,35 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class MultipleTags1Service { - constructor(public readonly http: HttpClient) {} - - /** - * @returns void Success - * @throws ApiError - */ - public dummyA(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public dummyB(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3_angular/services/MultipleTags2Service.ts.snap deleted file mode 100644 index 187c68fe6..000000000 --- a/test/__snapshots__/v3_angular/services/MultipleTags2Service.ts.snap +++ /dev/null @@ -1,35 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class MultipleTags2Service { - constructor(public readonly http: HttpClient) {} - - /** - * @returns void Success - * @throws ApiError - */ - public dummyA(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public dummyB(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3_angular/services/MultipleTags3Service.ts.snap deleted file mode 100644 index 4361ff7ee..000000000 --- a/test/__snapshots__/v3_angular/services/MultipleTags3Service.ts.snap +++ /dev/null @@ -1,24 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class MultipleTags3Service { - constructor(public readonly http: HttpClient) {} - - /** - * @returns void Success - * @throws ApiError - */ - public dummyB(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/NoContentService.ts.snap b/test/__snapshots__/v3_angular/services/NoContentService.ts.snap deleted file mode 100644 index cd0cc4cd3..000000000 --- a/test/__snapshots__/v3_angular/services/NoContentService.ts.snap +++ /dev/null @@ -1,36 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class NoContentService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns void Success - * @throws ApiError - */ - public callWithNoContentResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/no-content', - }); - } - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public callWithResponseAndNoContentResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } -} diff --git "a/test/__snapshots__/v3_angular/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v3_angular/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" deleted file mode 100644 index 2f931c93e..000000000 --- "a/test/__snapshots__/v3_angular/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" +++ /dev/null @@ -1,37 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { - /** - * Dummy input param - */ - nonAsciiParamæøåÆøÅöôêÊ: number; -}; - -@Injectable({ - providedIn: 'root', -}) -export class NonAsciiÆøåÆøÅöôêÊService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response - * @throws ApiError - */ - public nonAsciiæøåÆøÅöôêÊ字符串( - data: TDataNonAsciiæøåÆøÅöôêÊ字符串 - ): Observable> { - const { nonAsciiParamæøåÆøÅöôêÊ } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', - query: { - nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/ParametersService.ts.snap b/test/__snapshots__/v3_angular/services/ParametersService.ts.snap deleted file mode 100644 index a912f22dd..000000000 --- a/test/__snapshots__/v3_angular/services/ParametersService.ts.snap +++ /dev/null @@ -1,237 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithNestedArrayEnumsDataFoo, ModelWithOneOfEnum, ModelWithString, Pageable } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeleteFoo = { - /** - * bar in method - */ - bar: string; - /** - * foo in method - */ - foo: string; -}; -export type TDataCallWithParameters = { - fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; - fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: string | null; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath1?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath2?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath3?: string; - /** - * This is the parameter that goes into the request query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataGetCallWithOptionalParam = { - /** - * This is an optional parameter - */ - parameter?: string; - /** - * This is a required parameter - */ - requestBody: ModelWithOneOfEnum; -}; -export type TDataPostCallWithOptionalParam = { - /** - * This is a required parameter - */ - parameter: Pageable; - /** - * This is an optional parameter - */ - requestBody?: ModelWithString; -}; - -@Injectable({ - providedIn: 'root', -}) -export class ParametersService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public deleteFoo(data: TDataDeleteFoo): Observable { - const { bar, foo } = data; - return __request(OpenAPI, this.http, { - method: 'DELETE', - url: '/api/v{api-version}/foo/{foo}/bar/{bar}', - path: { - foo, - bar, - }, - }); - } - - /** - * @throws ApiError - */ - public callWithParameters(data: TDataCallWithParameters): Observable { - const { - fooAllOfEnum, - fooRefEnum, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath, - parameterQuery, - requestBody, - } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: { - parameterPath, - }, - cookies: { - parameterCookie, - }, - headers: { - parameterHeader, - }, - query: { - foo_ref_enum: fooRefEnum, - foo_all_of_enum: fooAllOfEnum, - parameterQuery, - }, - formData: { - parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): Observable { - const { - _default, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - parameterQuery, - requestBody, - } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', - path: { - 'parameter.path.1': parameterPath1, - 'parameter-path-2': parameterPath2, - 'PARAMETER-PATH-3': parameterPath3, - }, - cookies: { - 'PARAMETER-COOKIE': parameterCookie, - }, - headers: { - 'parameter.header': parameterHeader, - }, - query: { - default: _default, - 'parameter-query': parameterQuery, - }, - formData: { - parameter_form: parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): Observable { - const { parameter, requestBody } = data; - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): Observable { - const { parameter, requestBody } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/RequestBodyService.ts.snap b/test/__snapshots__/v3_angular/services/RequestBodyService.ts.snap deleted file mode 100644 index 7338ef5a4..000000000 --- a/test/__snapshots__/v3_angular/services/RequestBodyService.ts.snap +++ /dev/null @@ -1,40 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelWithString } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiRequestBody = { - /** - * A reusable request body - */ - foo?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -@Injectable({ - providedIn: 'root', -}) -export class RequestBodyService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public postApiRequestBody(data: TDataPostApiRequestBody = {}): Observable { - const { foo, parameter } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/requestBody/', - query: { - parameter, - }, - body: foo, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/ResponseService.ts.snap b/test/__snapshots__/v3_angular/services/ResponseService.ts.snap deleted file mode 100644 index 7a842859a..000000000 --- a/test/__snapshots__/v3_angular/services/ResponseService.ts.snap +++ /dev/null @@ -1,80 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; -import type { ModelThatExtends, ModelThatExtendsExtends, ModelWithString } from '../models'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class ResponseService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public callWithResponseAndNoContentResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } - - /** - * @returns ModelWithString - * @throws ApiError - */ - public callWithResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/response', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public callWithDuplicateResponses(): Observable { - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } - - /** - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public callWithResponses(): Observable< - | { - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; - } - | ModelWithString - | ModelThatExtends - | ModelThatExtendsExtends - > { - return __request(OpenAPI, this.http, { - method: 'PUT', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/SimpleService.ts.snap b/test/__snapshots__/v3_angular/services/SimpleService.ts.snap deleted file mode 100644 index 6ae527765..000000000 --- a/test/__snapshots__/v3_angular/services/SimpleService.ts.snap +++ /dev/null @@ -1,83 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -@Injectable({ - providedIn: 'root', -}) -export class SimpleService { - constructor(public readonly http: HttpClient) {} - - /** - * @throws ApiError - */ - public getCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public putCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'PUT', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public postCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public deleteCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'DELETE', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public optionsCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'OPTIONS', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public headCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'HEAD', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public patchCallWithoutParametersAndResponse(): Observable { - return __request(OpenAPI, this.http, { - method: 'PATCH', - url: '/api/v{api-version}/simple', - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/TypesService.ts.snap b/test/__snapshots__/v3_angular/services/TypesService.ts.snap deleted file mode 100644 index a72f87f76..000000000 --- a/test/__snapshots__/v3_angular/services/TypesService.ts.snap +++ /dev/null @@ -1,84 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTypes = { - /** - * This is a number parameter - */ - id?: number; - /** - * This is an array parameter - */ - parameterArray: Array | null; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record | null; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error' | null; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: Record | null; - /** - * This is a string parameter - */ - parameterString?: string | null; -}; - -@Injectable({ - providedIn: 'root', -}) -export class TypesService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns unknown Response is a simple object - * @throws ApiError - */ - public types(data: TDataTypes): Observable> { - const { - id, - parameterArray, - parameterBoolean = true, - parameterDictionary, - parameterEnum, - parameterNumber = 123, - parameterObject = null, - parameterString = 'default', - } = data; - return __request(OpenAPI, this.http, { - method: 'GET', - url: '/api/v{api-version}/types', - path: { - id, - }, - query: { - parameterNumber, - parameterString, - parameterBoolean, - parameterObject, - parameterArray, - parameterDictionary, - parameterEnum, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/UploadService.ts.snap b/test/__snapshots__/v3_angular/services/UploadService.ts.snap deleted file mode 100644 index 6bdb2979e..000000000 --- a/test/__snapshots__/v3_angular/services/UploadService.ts.snap +++ /dev/null @@ -1,35 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import type { Observable } from 'rxjs'; - -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataUploadFile = { - /** - * Supply a file reference for upload - */ - file: Blob | File; -}; - -@Injectable({ - providedIn: 'root', -}) -export class UploadService { - constructor(public readonly http: HttpClient) {} - - /** - * @returns boolean - * @throws ApiError - */ - public uploadFile(data: TDataUploadFile): Observable { - const { file } = data; - return __request(OpenAPI, this.http, { - method: 'POST', - url: '/api/v{api-version}/upload', - formData: { - file, - }, - }); - } -} diff --git a/test/__snapshots__/v3_angular/services/index.ts.snap b/test/__snapshots__/v3_angular/services/index.ts.snap deleted file mode 100644 index 3243a2fb1..000000000 --- a/test/__snapshots__/v3_angular/services/index.ts.snap +++ /dev/null @@ -1,23 +0,0 @@ -export { CollectionFormatService } from './CollectionFormatService'; -export { ComplexService } from './ComplexService'; -export { DefaultService } from './DefaultService'; -export { DefaultsService } from './DefaultsService'; -export { DeprecatedService } from './DeprecatedService'; -export { DescriptionsService } from './DescriptionsService'; -export { DuplicateService } from './DuplicateService'; -export { ErrorService } from './ErrorService'; -export { FileResponseService } from './FileResponseService'; -export { FormDataService } from './FormDataService'; -export { HeaderService } from './HeaderService'; -export { MultipartService } from './MultipartService'; -export { MultipleTags1Service } from './MultipleTags1Service'; -export { MultipleTags2Service } from './MultipleTags2Service'; -export { MultipleTags3Service } from './MultipleTags3Service'; -export { NoContentService } from './NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './ParametersService'; -export { RequestBodyService } from './RequestBodyService'; -export { ResponseService } from './ResponseService'; -export { SimpleService } from './SimpleService'; -export { TypesService } from './TypesService'; -export { UploadService } from './UploadService'; diff --git a/test/__snapshots__/v3_client/ApiClient.ts.snap b/test/__snapshots__/v3_client/ApiClient.ts.snap index 9eb9abcdc..4d69de743 100644 --- a/test/__snapshots__/v3_client/ApiClient.ts.snap +++ b/test/__snapshots__/v3_client/ApiClient.ts.snap @@ -3,29 +3,29 @@ import type { OpenAPIConfig } from './core/OpenAPI'; import { Interceptors } from './core/OpenAPI'; import { FetchHttpRequest } from './core/FetchHttpRequest'; -import { CollectionFormatService } from './services/CollectionFormatService'; -import { ComplexService } from './services/ComplexService'; -import { DefaultService } from './services/DefaultService'; -import { DefaultsService } from './services/DefaultsService'; -import { DeprecatedService } from './services/DeprecatedService'; -import { DescriptionsService } from './services/DescriptionsService'; -import { DuplicateService } from './services/DuplicateService'; -import { ErrorService } from './services/ErrorService'; -import { FileResponseService } from './services/FileResponseService'; -import { FormDataService } from './services/FormDataService'; -import { HeaderService } from './services/HeaderService'; -import { MultipartService } from './services/MultipartService'; -import { MultipleTags1Service } from './services/MultipleTags1Service'; -import { MultipleTags2Service } from './services/MultipleTags2Service'; -import { MultipleTags3Service } from './services/MultipleTags3Service'; -import { NoContentService } from './services/NoContentService'; -import { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; -import { ParametersService } from './services/ParametersService'; -import { RequestBodyService } from './services/RequestBodyService'; -import { ResponseService } from './services/ResponseService'; -import { SimpleService } from './services/SimpleService'; -import { TypesService } from './services/TypesService'; -import { UploadService } from './services/UploadService'; +import { CollectionFormatService } from './services'; +import { ComplexService } from './services'; +import { DefaultService } from './services'; +import { DefaultsService } from './services'; +import { DeprecatedService } from './services'; +import { DescriptionsService } from './services'; +import { DuplicateService } from './services'; +import { ErrorService } from './services'; +import { FileResponseService } from './services'; +import { FormDataService } from './services'; +import { HeaderService } from './services'; +import { MultipartService } from './services'; +import { MultipleTags1Service } from './services'; +import { MultipleTags2Service } from './services'; +import { MultipleTags3Service } from './services'; +import { NoContentService } from './services'; +import { NonAsciiÆøåÆøÅöôêÊService } from './services'; +import { ParametersService } from './services'; +import { RequestBodyService } from './services'; +import { ResponseService } from './services'; +import { SimpleService } from './services'; +import { TypesService } from './services'; +import { UploadService } from './services'; type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest; diff --git a/test/__snapshots__/v3_client/services.ts.snap b/test/__snapshots__/v3_client/services.ts.snap new file mode 100644 index 000000000..b8873e09a --- /dev/null +++ b/test/__snapshots__/v3_client/services.ts.snap @@ -0,0 +1,1243 @@ +import type { CancelablePromise } from './core/CancelablePromise'; +import type { BaseHttpRequest } from './core/BaseHttpRequest'; + +import type { + ModelWithArrayReadOnlyAndWriteOnly, + ModelWithReadOnlyAndWriteOnly, + ModelWithNestedArrayEnumsDataFoo, + ModelWithOneOfEnum, + ModelWithString, + Pageable, + DeprecatedModel, + ModelThatExtends, + ModelThatExtendsExtends, + ModelWithArray, + ModelWithDictionary, + ModelWithEnum, + NonAsciiStringæøåÆØÅöôêÊ字符串, +} from './models'; + +export type TDataPostServiceWithEmptyTag = { + requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; +}; + +export class DefaultService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public serviceWithEmptyTag(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } + + /** + * @returns ModelWithReadOnlyAndWriteOnly + * @throws ApiError + */ + public postServiceWithEmptyTag( + data: TDataPostServiceWithEmptyTag + ): CancelablePromise { + const { requestBody } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/no-tag', + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export class SimpleService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public getCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public putCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public postCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public deleteCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public optionsCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public headCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public patchCallWithoutParametersAndResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} + +export type TDataDeleteFoo = { + /** + * bar in method + */ + bar: string; + /** + * foo in method + */ + foo: string; +}; +export type TDataCallWithParameters = { + fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; + fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataGetCallWithOptionalParam = { + /** + * This is an optional parameter + */ + parameter?: string; + /** + * This is a required parameter + */ + requestBody: ModelWithOneOfEnum; +}; +export type TDataPostCallWithOptionalParam = { + /** + * This is a required parameter + */ + parameter: Pageable; + /** + * This is an optional parameter + */ + requestBody?: ModelWithString; +}; + +export class ParametersService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public deleteFoo(data: TDataDeleteFoo): CancelablePromise { + const { bar, foo } = data; + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v{api-version}/foo/{foo}/bar/{bar}', + path: { + foo, + bar, + }, + }); + } + + /** + * @throws ApiError + */ + public callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { + fooAllOfEnum, + fooRefEnum, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath, + parameterQuery, + requestBody, + } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + cookies: { + parameterCookie, + }, + headers: { + parameterHeader, + }, + query: { + foo_ref_enum: fooRefEnum, + foo_all_of_enum: fooAllOfEnum, + parameterQuery, + }, + formData: { + parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + requestBody, + } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: { + 'parameter.path.1': parameterPath1, + 'parameter-path-2': parameterPath2, + 'PARAMETER-PATH-3': parameterPath3, + }, + cookies: { + 'PARAMETER-COOKIE': parameterCookie, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export type TDataCallWithDescriptions = { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; +}; + +export class DescriptionsService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { + const { + parameterWithBackticks, + parameterWithBreaks, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + parameterWithSlashes, + } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + parameterWithBreaks, + parameterWithBackticks, + parameterWithSlashes, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + }, + }); + } +} + +export type TDataDeprecatedCall = { + /** + * This parameter is deprecated + */ + parameter: DeprecatedModel | null; +}; + +export class DeprecatedService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @deprecated + * @throws ApiError + */ + public deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { + const { parameter } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/parameters/deprecated', + headers: { + parameter, + }, + }); + } +} + +export type TDataPostApiRequestBody = { + /** + * A reusable request body + */ + foo?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class RequestBodyService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { + const { foo, parameter } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/requestBody/', + query: { + parameter, + }, + body: foo, + mediaType: 'application/json', + }); + } +} + +export type TDataPostApiFormData = { + /** + * A reusable request body + */ + formData?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class FormDataService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { + const { formData, parameter } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/formData/', + query: { + parameter, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } +} + +export type TDataCallWithDefaultParameters = { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * This is a simple string with default value + */ + parameterString?: string | null; +}; +export type TDataCallWithDefaultOptionalParameters = { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; +}; +export type TDataCallToTestOrderOfParams = { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; +}; + +export class DefaultsService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public callWithDefaultOptionalParameters( + data: TDataCallWithDefaultOptionalParameters = {} + ): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { + const { + parameterOptionalStringWithDefault = 'Hello World!', + parameterOptionalStringWithEmptyDefault = '', + parameterOptionalStringWithNoDefault, + parameterStringNullableWithDefault = null, + parameterStringNullableWithNoDefault, + parameterStringWithDefault = 'Hello World!', + parameterStringWithEmptyDefault = '', + parameterStringWithNoDefault, + } = data; + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault, + parameterOptionalStringWithEmptyDefault, + parameterOptionalStringWithNoDefault, + parameterStringWithDefault, + parameterStringWithEmptyDefault, + parameterStringWithNoDefault, + parameterStringNullableWithNoDefault, + parameterStringNullableWithDefault, + }, + }); + } +} + +export class DuplicateService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public duplicateName(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public duplicateName1(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public duplicateName2(): CancelablePromise { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public duplicateName3(): CancelablePromise { + return this.httpRequest.request({ + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} + +export class NoContentService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns void Success + * @throws ApiError + */ + public callWithNoContentResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public callWithResponseAndNoContentResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} + +export class ResponseService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public callWithResponseAndNoContentResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString + * @throws ApiError + */ + public callWithResponse(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public callWithDuplicateResponses(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public callWithResponses(): CancelablePromise< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} + +export class MultipleTags1Service { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns void Success + * @throws ApiError + */ + public dummyA(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public dummyB(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags2Service { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns void Success + * @throws ApiError + */ + public dummyA(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public dummyB(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags3Service { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns void Success + * @throws ApiError + */ + public dummyB(): CancelablePromise { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export type TDataCollectionFormat = { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array | null; +}; + +export class CollectionFormatService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public collectionFormat(data: TDataCollectionFormat): CancelablePromise { + const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = + data; + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + parameterArrayCSV: parameterArrayCsv, + parameterArraySSV: parameterArraySsv, + parameterArrayTSV: parameterArrayTsv, + parameterArrayPipes, + parameterArrayMulti, + }, + }); + } +} + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: Record | null; + /** + * This is a string parameter + */ + parameterString?: string | null; +}; + +export class TypesService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns unknown Response is a simple object + * @throws ApiError + */ + public types(data: TDataTypes): CancelablePromise> { + const { + id, + parameterArray, + parameterBoolean = true, + parameterDictionary, + parameterEnum, + parameterNumber = 123, + parameterObject = null, + parameterString = 'default', + } = data; + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/types', + path: { + id, + }, + query: { + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, + parameterEnum, + }, + }); + } +} + +export type TDataUploadFile = { + /** + * Supply a file reference for upload + */ + file: Blob | File; +}; + +export class UploadService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns boolean + * @throws ApiError + */ + public uploadFile(data: TDataUploadFile): CancelablePromise { + const { file } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/upload', + formData: { + file, + }, + }); + } +} + +export type TDataFileResponse = { + id: string; +}; + +export class FileResponseService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns binary Success + * @throws ApiError + */ + public fileResponse(data: TDataFileResponse): CancelablePromise { + const { id } = data; + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/file/{id}', + path: { + id, + }, + }); + } +} + +export type TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; +export type TDataComplexParams = { + id: number; + requestBody?: { + readonly key: string | null; + name: string | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string | null; + }; + }; +}; + +export class ComplexService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public complexTypes(data: TDataComplexTypes): CancelablePromise> { + const { parameterObject, parameterReference } = data; + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + parameterObject, + parameterReference, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } + + /** + * @returns ModelWithString Success + * @throws ApiError + */ + public complexParams(data: TDataComplexParams): CancelablePromise { + const { id, requestBody } = data; + return this.httpRequest.request({ + method: 'PUT', + url: '/api/v{api-version}/complex/{id}', + path: { + id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } +} + +export type TDataMultipartRequest = { + formData?: { + content?: Blob | File; + data?: ModelWithString | null; + }; +}; + +export class MultipartService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @throws ApiError + */ + public multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { + const { formData } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/multipart', + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * @returns any OK + * @throws ApiError + */ + public multipartResponse(): CancelablePromise<{ + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }> { + return this.httpRequest.request({ + method: 'GET', + url: '/api/v{api-version}/multipart', + }); + } +} + +export class HeaderService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns string Successful response + * @throws ApiError + */ + public callWithResultFromHeader(): CancelablePromise { + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export type TDataTestErrorCode = { + /** + * Status code to return + */ + status: number; +}; + +export class ErrorService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public testErrorCode(data: TDataTestErrorCode): CancelablePromise { + const { status } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/error', + query: { + status, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; +}; + +export class NonAsciiÆøåÆøÅöôêÊService { + constructor(public readonly httpRequest: BaseHttpRequest) {} + + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): CancelablePromise> { + const { nonAsciiParamæøåÆøÅöôêÊ } = data; + return this.httpRequest.request({ + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, + }, + }); + } +} diff --git a/test/__snapshots__/v3_client/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3_client/services/CollectionFormatService.ts.snap deleted file mode 100644 index 6f4c0e91c..000000000 --- a/test/__snapshots__/v3_client/services/CollectionFormatService.ts.snap +++ /dev/null @@ -1,48 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataCollectionFormat = { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCsv: Array | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array | null; -}; - -export class CollectionFormatService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public collectionFormat(data: TDataCollectionFormat): CancelablePromise { - const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = - data; - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/collectionFormat', - query: { - parameterArrayCSV: parameterArrayCsv, - parameterArraySSV: parameterArraySsv, - parameterArrayTSV: parameterArrayTsv, - parameterArrayPipes, - parameterArrayMulti, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/ComplexService.ts.snap b/test/__snapshots__/v3_client/services/ComplexService.ts.snap deleted file mode 100644 index 0284636b4..000000000 --- a/test/__snapshots__/v3_client/services/ComplexService.ts.snap +++ /dev/null @@ -1,77 +0,0 @@ -import type { ModelWithArray, ModelWithDictionary, ModelWithEnum, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataComplexTypes = { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; -}; -export type TDataComplexParams = { - id: number; - requestBody?: { - readonly key: string | null; - name: string | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array | null; - parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; - readonly user?: { - readonly id?: number; - readonly name?: string | null; - }; - }; -}; - -export class ComplexService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns ModelWithString Successful response - * @throws ApiError - */ - public complexTypes(data: TDataComplexTypes): CancelablePromise> { - const { parameterObject, parameterReference } = data; - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/complex', - query: { - parameterObject, - parameterReference, - }, - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } - - /** - * @returns ModelWithString Success - * @throws ApiError - */ - public complexParams(data: TDataComplexParams): CancelablePromise { - const { id, requestBody } = data; - return this.httpRequest.request({ - method: 'PUT', - url: '/api/v{api-version}/complex/{id}', - path: { - id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/DefaultService.ts.snap b/test/__snapshots__/v3_client/services/DefaultService.ts.snap deleted file mode 100644 index f3fd87493..000000000 --- a/test/__snapshots__/v3_client/services/DefaultService.ts.snap +++ /dev/null @@ -1,37 +0,0 @@ -import type { ModelWithArrayReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnly } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataPostServiceWithEmptyTag = { - requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; -}; - -export class DefaultService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public serviceWithEmptyTag(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } - - /** - * @returns ModelWithReadOnlyAndWriteOnly - * @throws ApiError - */ - public postServiceWithEmptyTag( - data: TDataPostServiceWithEmptyTag - ): CancelablePromise { - const { requestBody } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/no-tag', - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/DefaultsService.ts.snap b/test/__snapshots__/v3_client/services/DefaultsService.ts.snap deleted file mode 100644 index d9319ca65..000000000 --- a/test/__snapshots__/v3_client/services/DefaultsService.ts.snap +++ /dev/null @@ -1,170 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataCallWithDefaultParameters = { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: boolean | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString | null; - /** - * This is a simple number with default value - */ - parameterNumber?: number | null; - /** - * This is a simple string with default value - */ - parameterString?: string | null; -}; -export type TDataCallWithDefaultOptionalParameters = { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; -}; -export type TDataCallToTestOrderOfParams = { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: string | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: string | null; - /** - * This is a string with default - */ - parameterStringWithDefault?: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault?: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; -}; - -export class DefaultsService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public callWithDefaultOptionalParameters( - data: TDataCallWithDefaultOptionalParameters = {} - ): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { - const { - parameterOptionalStringWithDefault = 'Hello World!', - parameterOptionalStringWithEmptyDefault = '', - parameterOptionalStringWithNoDefault, - parameterStringNullableWithDefault = null, - parameterStringNullableWithNoDefault, - parameterStringWithDefault = 'Hello World!', - parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, - } = data; - return this.httpRequest.request({ - method: 'PUT', - url: '/api/v{api-version}/defaults', - query: { - parameterOptionalStringWithDefault, - parameterOptionalStringWithEmptyDefault, - parameterOptionalStringWithNoDefault, - parameterStringWithDefault, - parameterStringWithEmptyDefault, - parameterStringWithNoDefault, - parameterStringNullableWithNoDefault, - parameterStringNullableWithDefault, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/DeprecatedService.ts.snap b/test/__snapshots__/v3_client/services/DeprecatedService.ts.snap deleted file mode 100644 index 816a38c3a..000000000 --- a/test/__snapshots__/v3_client/services/DeprecatedService.ts.snap +++ /dev/null @@ -1,29 +0,0 @@ -import type { DeprecatedModel } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataDeprecatedCall = { - /** - * This parameter is deprecated - */ - parameter: DeprecatedModel | null; -}; - -export class DeprecatedService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @deprecated - * @throws ApiError - */ - public deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { - const { parameter } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/parameters/deprecated', - headers: { - parameter, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/DescriptionsService.ts.snap b/test/__snapshots__/v3_client/services/DescriptionsService.ts.snap deleted file mode 100644 index fcb6127a6..000000000 --- a/test/__snapshots__/v3_client/services/DescriptionsService.ts.snap +++ /dev/null @@ -1,62 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataCallWithDescriptions = { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; -}; - -export class DescriptionsService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { - const { - parameterWithBackticks, - parameterWithBreaks, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - parameterWithSlashes, - } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/descriptions/', - query: { - parameterWithBreaks, - parameterWithBackticks, - parameterWithSlashes, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/DuplicateService.ts.snap b/test/__snapshots__/v3_client/services/DuplicateService.ts.snap deleted file mode 100644 index bc973818a..000000000 --- a/test/__snapshots__/v3_client/services/DuplicateService.ts.snap +++ /dev/null @@ -1,46 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class DuplicateService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public duplicateName(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public duplicateName1(): CancelablePromise { - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public duplicateName2(): CancelablePromise { - return this.httpRequest.request({ - method: 'PUT', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public duplicateName3(): CancelablePromise { - return this.httpRequest.request({ - method: 'DELETE', - url: '/api/v{api-version}/duplicate', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/ErrorService.ts.snap b/test/__snapshots__/v3_client/services/ErrorService.ts.snap deleted file mode 100644 index f08e48eab..000000000 --- a/test/__snapshots__/v3_client/services/ErrorService.ts.snap +++ /dev/null @@ -1,34 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataTestErrorCode = { - /** - * Status code to return - */ - status: number; -}; - -export class ErrorService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns any Custom message: Successful response - * @throws ApiError - */ - public testErrorCode(data: TDataTestErrorCode): CancelablePromise { - const { status } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/error', - query: { - status, - }, - errors: { - 500: `Custom message: Internal Server Error`, - 501: `Custom message: Not Implemented`, - 502: `Custom message: Bad Gateway`, - 503: `Custom message: Service Unavailable`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/FileResponseService.ts.snap b/test/__snapshots__/v3_client/services/FileResponseService.ts.snap deleted file mode 100644 index 896c7509a..000000000 --- a/test/__snapshots__/v3_client/services/FileResponseService.ts.snap +++ /dev/null @@ -1,25 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataFileResponse = { - id: string; -}; - -export class FileResponseService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns binary Success - * @throws ApiError - */ - public fileResponse(data: TDataFileResponse): CancelablePromise { - const { id } = data; - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/file/{id}', - path: { - id, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/FormDataService.ts.snap b/test/__snapshots__/v3_client/services/FormDataService.ts.snap deleted file mode 100644 index 8db8ef70d..000000000 --- a/test/__snapshots__/v3_client/services/FormDataService.ts.snap +++ /dev/null @@ -1,34 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataPostApiFormData = { - /** - * A reusable request body - */ - formData?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -export class FormDataService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { - const { formData, parameter } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/formData/', - query: { - parameter, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/HeaderService.ts.snap b/test/__snapshots__/v3_client/services/HeaderService.ts.snap deleted file mode 100644 index e8777c312..000000000 --- a/test/__snapshots__/v3_client/services/HeaderService.ts.snap +++ /dev/null @@ -1,22 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class HeaderService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns string Successful response - * @throws ApiError - */ - public callWithResultFromHeader(): CancelablePromise { - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/header', - responseHeader: 'operation-location', - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/MultipartService.ts.snap b/test/__snapshots__/v3_client/services/MultipartService.ts.snap deleted file mode 100644 index afbf9e165..000000000 --- a/test/__snapshots__/v3_client/services/MultipartService.ts.snap +++ /dev/null @@ -1,44 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataMultipartRequest = { - formData?: { - content?: Blob | File; - data?: ModelWithString | null; - }; -}; - -export class MultipartService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { - const { formData } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/multipart', - formData: formData, - mediaType: 'multipart/form-data', - }); - } - - /** - * @returns any OK - * @throws ApiError - */ - public multipartResponse(): CancelablePromise<{ - file?: Blob | File; - metadata?: { - foo?: string; - bar?: string; - }; - }> { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multipart', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3_client/services/MultipleTags1Service.ts.snap deleted file mode 100644 index b9f5cf1b3..000000000 --- a/test/__snapshots__/v3_client/services/MultipleTags1Service.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class MultipleTags1Service { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns void Success - * @throws ApiError - */ - public dummyA(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public dummyB(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3_client/services/MultipleTags2Service.ts.snap deleted file mode 100644 index dc50ec906..000000000 --- a/test/__snapshots__/v3_client/services/MultipleTags2Service.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class MultipleTags2Service { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns void Success - * @throws ApiError - */ - public dummyA(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public dummyB(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3_client/services/MultipleTags3Service.ts.snap deleted file mode 100644 index fee47245a..000000000 --- a/test/__snapshots__/v3_client/services/MultipleTags3Service.ts.snap +++ /dev/null @@ -1,17 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class MultipleTags3Service { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns void Success - * @throws ApiError - */ - public dummyB(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/NoContentService.ts.snap b/test/__snapshots__/v3_client/services/NoContentService.ts.snap deleted file mode 100644 index 0d76f25b2..000000000 --- a/test/__snapshots__/v3_client/services/NoContentService.ts.snap +++ /dev/null @@ -1,29 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class NoContentService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns void Success - * @throws ApiError - */ - public callWithNoContentResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/no-content', - }); - } - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public callWithResponseAndNoContentResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } -} diff --git "a/test/__snapshots__/v3_client/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v3_client/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" deleted file mode 100644 index 9f0429cdc..000000000 --- "a/test/__snapshots__/v3_client/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" +++ /dev/null @@ -1,31 +0,0 @@ -import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { - /** - * Dummy input param - */ - nonAsciiParamæøåÆøÅöôêÊ: number; -}; - -export class NonAsciiÆøåÆøÅöôêÊService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response - * @throws ApiError - */ - public nonAsciiæøåÆøÅöôêÊ字符串( - data: TDataNonAsciiæøåÆøÅöôêÊ字符串 - ): CancelablePromise> { - const { nonAsciiParamæøåÆøÅöôêÊ } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', - query: { - nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/ParametersService.ts.snap b/test/__snapshots__/v3_client/services/ParametersService.ts.snap deleted file mode 100644 index 0a200d930..000000000 --- a/test/__snapshots__/v3_client/services/ParametersService.ts.snap +++ /dev/null @@ -1,231 +0,0 @@ -import type { ModelWithNestedArrayEnumsDataFoo, ModelWithOneOfEnum, ModelWithString, Pageable } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataDeleteFoo = { - /** - * bar in method - */ - bar: string; - /** - * foo in method - */ - foo: string; -}; -export type TDataCallWithParameters = { - fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; - fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: string | null; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath1?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath2?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath3?: string; - /** - * This is the parameter that goes into the request query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataGetCallWithOptionalParam = { - /** - * This is an optional parameter - */ - parameter?: string; - /** - * This is a required parameter - */ - requestBody: ModelWithOneOfEnum; -}; -export type TDataPostCallWithOptionalParam = { - /** - * This is a required parameter - */ - parameter: Pageable; - /** - * This is an optional parameter - */ - requestBody?: ModelWithString; -}; - -export class ParametersService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public deleteFoo(data: TDataDeleteFoo): CancelablePromise { - const { bar, foo } = data; - return this.httpRequest.request({ - method: 'DELETE', - url: '/api/v{api-version}/foo/{foo}/bar/{bar}', - path: { - foo, - bar, - }, - }); - } - - /** - * @throws ApiError - */ - public callWithParameters(data: TDataCallWithParameters): CancelablePromise { - const { - fooAllOfEnum, - fooRefEnum, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath, - parameterQuery, - requestBody, - } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: { - parameterPath, - }, - cookies: { - parameterCookie, - }, - headers: { - parameterHeader, - }, - query: { - foo_ref_enum: fooRefEnum, - foo_all_of_enum: fooAllOfEnum, - parameterQuery, - }, - formData: { - parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { - const { - _default, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - parameterQuery, - requestBody, - } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', - path: { - 'parameter.path.1': parameterPath1, - 'parameter-path-2': parameterPath2, - 'PARAMETER-PATH-3': parameterPath3, - }, - cookies: { - 'PARAMETER-COOKIE': parameterCookie, - }, - headers: { - 'parameter.header': parameterHeader, - }, - query: { - default: _default, - 'parameter-query': parameterQuery, - }, - formData: { - parameter_form: parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { - const { parameter, requestBody } = data; - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { - const { parameter, requestBody } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/RequestBodyService.ts.snap b/test/__snapshots__/v3_client/services/RequestBodyService.ts.snap deleted file mode 100644 index 0dace7cc2..000000000 --- a/test/__snapshots__/v3_client/services/RequestBodyService.ts.snap +++ /dev/null @@ -1,34 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataPostApiRequestBody = { - /** - * A reusable request body - */ - foo?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -export class RequestBodyService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { - const { foo, parameter } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/requestBody/', - query: { - parameter, - }, - body: foo, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/ResponseService.ts.snap b/test/__snapshots__/v3_client/services/ResponseService.ts.snap deleted file mode 100644 index 98d4ef416..000000000 --- a/test/__snapshots__/v3_client/services/ResponseService.ts.snap +++ /dev/null @@ -1,74 +0,0 @@ -import type { ModelThatExtends, ModelThatExtendsExtends, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class ResponseService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public callWithResponseAndNoContentResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } - - /** - * @returns ModelWithString - * @throws ApiError - */ - public callWithResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/response', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public callWithDuplicateResponses(): CancelablePromise { - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } - - /** - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public callWithResponses(): CancelablePromise< - | { - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; - } - | ModelWithString - | ModelThatExtends - | ModelThatExtendsExtends - > { - return this.httpRequest.request({ - method: 'PUT', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/SimpleService.ts.snap b/test/__snapshots__/v3_client/services/SimpleService.ts.snap deleted file mode 100644 index 85bee6b61..000000000 --- a/test/__snapshots__/v3_client/services/SimpleService.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export class SimpleService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @throws ApiError - */ - public getCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public putCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'PUT', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public postCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public deleteCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'DELETE', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public optionsCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'OPTIONS', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public headCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'HEAD', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public patchCallWithoutParametersAndResponse(): CancelablePromise { - return this.httpRequest.request({ - method: 'PATCH', - url: '/api/v{api-version}/simple', - }); - } -} diff --git a/test/__snapshots__/v3_client/services/TypesService.ts.snap b/test/__snapshots__/v3_client/services/TypesService.ts.snap deleted file mode 100644 index cbbee1f64..000000000 --- a/test/__snapshots__/v3_client/services/TypesService.ts.snap +++ /dev/null @@ -1,77 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataTypes = { - /** - * This is a number parameter - */ - id?: number; - /** - * This is an array parameter - */ - parameterArray: Array | null; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record | null; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error' | null; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: Record | null; - /** - * This is a string parameter - */ - parameterString?: string | null; -}; - -export class TypesService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns unknown Response is a simple object - * @throws ApiError - */ - public types(data: TDataTypes): CancelablePromise> { - const { - id, - parameterArray, - parameterBoolean = true, - parameterDictionary, - parameterEnum, - parameterNumber = 123, - parameterObject = null, - parameterString = 'default', - } = data; - return this.httpRequest.request({ - method: 'GET', - url: '/api/v{api-version}/types', - path: { - id, - }, - query: { - parameterNumber, - parameterString, - parameterBoolean, - parameterObject, - parameterArray, - parameterDictionary, - parameterEnum, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/UploadService.ts.snap b/test/__snapshots__/v3_client/services/UploadService.ts.snap deleted file mode 100644 index 6fe43caa6..000000000 --- a/test/__snapshots__/v3_client/services/UploadService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import type { BaseHttpRequest } from '../core/BaseHttpRequest'; - -export type TDataUploadFile = { - /** - * Supply a file reference for upload - */ - file: Blob | File; -}; - -export class UploadService { - constructor(public readonly httpRequest: BaseHttpRequest) {} - - /** - * @returns boolean - * @throws ApiError - */ - public uploadFile(data: TDataUploadFile): CancelablePromise { - const { file } = data; - return this.httpRequest.request({ - method: 'POST', - url: '/api/v{api-version}/upload', - formData: { - file, - }, - }); - } -} diff --git a/test/__snapshots__/v3_client/services/index.ts.snap b/test/__snapshots__/v3_client/services/index.ts.snap deleted file mode 100644 index 3243a2fb1..000000000 --- a/test/__snapshots__/v3_client/services/index.ts.snap +++ /dev/null @@ -1,23 +0,0 @@ -export { CollectionFormatService } from './CollectionFormatService'; -export { ComplexService } from './ComplexService'; -export { DefaultService } from './DefaultService'; -export { DefaultsService } from './DefaultsService'; -export { DeprecatedService } from './DeprecatedService'; -export { DescriptionsService } from './DescriptionsService'; -export { DuplicateService } from './DuplicateService'; -export { ErrorService } from './ErrorService'; -export { FileResponseService } from './FileResponseService'; -export { FormDataService } from './FormDataService'; -export { HeaderService } from './HeaderService'; -export { MultipartService } from './MultipartService'; -export { MultipleTags1Service } from './MultipleTags1Service'; -export { MultipleTags2Service } from './MultipleTags2Service'; -export { MultipleTags3Service } from './MultipleTags3Service'; -export { NoContentService } from './NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './ParametersService'; -export { RequestBodyService } from './RequestBodyService'; -export { ResponseService } from './ResponseService'; -export { SimpleService } from './SimpleService'; -export { TypesService } from './TypesService'; -export { UploadService } from './UploadService'; diff --git a/test/__snapshots__/v3_enums_typescript/services.ts.snap b/test/__snapshots__/v3_enums_typescript/services.ts.snap new file mode 100644 index 000000000..5ed220f66 --- /dev/null +++ b/test/__snapshots__/v3_enums_typescript/services.ts.snap @@ -0,0 +1,1198 @@ +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; + +import type { + ModelWithArrayReadOnlyAndWriteOnly, + ModelWithReadOnlyAndWriteOnly, + ModelWithNestedArrayEnumsDataFoo, + ModelWithOneOfEnum, + ModelWithString, + Pageable, + DeprecatedModel, + ModelThatExtends, + ModelThatExtendsExtends, + ModelWithArray, + ModelWithDictionary, + ModelWithEnum, + NonAsciiStringæøåÆØÅöôêÊ字符串, +} from './models'; + +export type TDataPostServiceWithEmptyTag = { + requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; +}; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } + + /** + * @returns ModelWithReadOnlyAndWriteOnly + * @throws ApiError + */ + public static postServiceWithEmptyTag( + data: TDataPostServiceWithEmptyTag + ): CancelablePromise { + const { requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/no-tag', + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export class SimpleService { + /** + * @throws ApiError + */ + public static getCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static putCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static deleteCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static optionsCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static headCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static patchCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} + +export type TDataDeleteFoo = { + /** + * bar in method + */ + bar: string; + /** + * foo in method + */ + foo: string; +}; +export type TDataCallWithParameters = { + fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; + fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataGetCallWithOptionalParam = { + /** + * This is an optional parameter + */ + parameter?: string; + /** + * This is a required parameter + */ + requestBody: ModelWithOneOfEnum; +}; +export type TDataPostCallWithOptionalParam = { + /** + * This is a required parameter + */ + parameter: Pageable; + /** + * This is an optional parameter + */ + requestBody?: ModelWithString; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { + const { bar, foo } = data; + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/foo/{foo}/bar/{bar}', + path: { + foo, + bar, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { + fooAllOfEnum, + fooRefEnum, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + cookies: { + parameterCookie, + }, + headers: { + parameterHeader, + }, + query: { + foo_ref_enum: fooRefEnum, + foo_all_of_enum: fooAllOfEnum, + parameterQuery, + }, + formData: { + parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: { + 'parameter.path.1': parameterPath1, + 'parameter-path-2': parameterPath2, + 'PARAMETER-PATH-3': parameterPath3, + }, + cookies: { + 'PARAMETER-COOKIE': parameterCookie, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export type TDataCallWithDescriptions = { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; +}; + +export class DescriptionsService { + /** + * @throws ApiError + */ + public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { + const { + parameterWithBackticks, + parameterWithBreaks, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + parameterWithSlashes, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + parameterWithBreaks, + parameterWithBackticks, + parameterWithSlashes, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + }, + }); + } +} + +export type TDataDeprecatedCall = { + /** + * This parameter is deprecated + */ + parameter: DeprecatedModel | null; +}; + +export class DeprecatedService { + /** + * @deprecated + * @throws ApiError + */ + public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { + const { parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/deprecated', + headers: { + parameter, + }, + }); + } +} + +export type TDataPostApiRequestBody = { + /** + * A reusable request body + */ + foo?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class RequestBodyService { + /** + * @throws ApiError + */ + public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { + const { foo, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/requestBody/', + query: { + parameter, + }, + body: foo, + mediaType: 'application/json', + }); + } +} + +export type TDataPostApiFormData = { + /** + * A reusable request body + */ + formData?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class FormDataService { + /** + * @throws ApiError + */ + public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { + const { formData, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/formData/', + query: { + parameter, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } +} + +export type TDataCallWithDefaultParameters = { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * This is a simple string with default value + */ + parameterString?: string | null; +}; +export type TDataCallWithDefaultOptionalParameters = { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; +}; +export type TDataCallToTestOrderOfParams = { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; +}; + +export class DefaultsService { + /** + * @throws ApiError + */ + public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithDefaultOptionalParameters( + data: TDataCallWithDefaultOptionalParameters = {} + ): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { + const { + parameterOptionalStringWithDefault = 'Hello World!', + parameterOptionalStringWithEmptyDefault = '', + parameterOptionalStringWithNoDefault, + parameterStringNullableWithDefault = null, + parameterStringNullableWithNoDefault, + parameterStringWithDefault = 'Hello World!', + parameterStringWithEmptyDefault = '', + parameterStringWithNoDefault, + } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault, + parameterOptionalStringWithEmptyDefault, + parameterOptionalStringWithNoDefault, + parameterStringWithDefault, + parameterStringWithEmptyDefault, + parameterStringWithNoDefault, + parameterStringNullableWithNoDefault, + parameterStringNullableWithDefault, + }, + }); + } +} + +export class DuplicateService { + /** + * @throws ApiError + */ + public static duplicateName(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName1(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName2(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName3(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} + +export class NoContentService { + /** + * @returns void Success + * @throws ApiError + */ + public static callWithNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} + +export class ResponseService { + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString + * @throws ApiError + */ + public static callWithResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public static callWithDuplicateResponses(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public static callWithResponses(): CancelablePromise< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} + +export class MultipleTags1Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags2Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags3Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export type TDataCollectionFormat = { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array | null; +}; + +export class CollectionFormatService { + /** + * @throws ApiError + */ + public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { + const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = + data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + parameterArrayCSV: parameterArrayCsv, + parameterArraySSV: parameterArraySsv, + parameterArrayTSV: parameterArrayTsv, + parameterArrayPipes, + parameterArrayMulti, + }, + }); + } +} + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: Record | null; + /** + * This is a string parameter + */ + parameterString?: string | null; +}; + +export class TypesService { + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns unknown Response is a simple object + * @throws ApiError + */ + public static types(data: TDataTypes): CancelablePromise> { + const { + id, + parameterArray, + parameterBoolean = true, + parameterDictionary, + parameterEnum, + parameterNumber = 123, + parameterObject = null, + parameterString = 'default', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/types', + path: { + id, + }, + query: { + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, + parameterEnum, + }, + }); + } +} + +export type TDataUploadFile = { + /** + * Supply a file reference for upload + */ + file: Blob | File; +}; + +export class UploadService { + /** + * @returns boolean + * @throws ApiError + */ + public static uploadFile(data: TDataUploadFile): CancelablePromise { + const { file } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/upload', + formData: { + file, + }, + }); + } +} + +export type TDataFileResponse = { + id: string; +}; + +export class FileResponseService { + /** + * @returns binary Success + * @throws ApiError + */ + public static fileResponse(data: TDataFileResponse): CancelablePromise { + const { id } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/file/{id}', + path: { + id, + }, + }); + } +} + +export type TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; +export type TDataComplexParams = { + id: number; + requestBody?: { + readonly key: string | null; + name: string | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string | null; + }; + }; +}; + +export class ComplexService { + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public static complexTypes(data: TDataComplexTypes): CancelablePromise> { + const { parameterObject, parameterReference } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + parameterObject, + parameterReference, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } + + /** + * @returns ModelWithString Success + * @throws ApiError + */ + public static complexParams(data: TDataComplexParams): CancelablePromise { + const { id, requestBody } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/complex/{id}', + path: { + id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } +} + +export type TDataMultipartRequest = { + formData?: { + content?: Blob | File; + data?: ModelWithString | null; + }; +}; + +export class MultipartService { + /** + * @throws ApiError + */ + public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { + const { formData } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/multipart', + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * @returns any OK + * @throws ApiError + */ + public static multipartResponse(): CancelablePromise<{ + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multipart', + }); + } +} + +export class HeaderService { + /** + * @returns string Successful response + * @throws ApiError + */ + public static callWithResultFromHeader(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export type TDataTestErrorCode = { + /** + * Status code to return + */ + status: number; +}; + +export class ErrorService { + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { + const { status } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/error', + query: { + status, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; +}; + +export class NonAsciiÆøåÆøÅöôêÊService { + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public static nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): CancelablePromise> { + const { nonAsciiParamæøåÆøÅöôêÊ } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, + }, + }); + } +} diff --git a/test/__snapshots__/v3_enums_typescript/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/CollectionFormatService.ts.snap deleted file mode 100644 index 82db211fd..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/CollectionFormatService.ts.snap +++ /dev/null @@ -1,47 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCollectionFormat = { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCsv: Array | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array | null; -}; - -export class CollectionFormatService { - /** - * @throws ApiError - */ - public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { - const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = - data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/collectionFormat', - query: { - parameterArrayCSV: parameterArrayCsv, - parameterArraySSV: parameterArraySsv, - parameterArrayTSV: parameterArrayTsv, - parameterArrayPipes, - parameterArrayMulti, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/ComplexService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/ComplexService.ts.snap deleted file mode 100644 index fc3af8ed9..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/ComplexService.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -import type { ModelWithArray, ModelWithDictionary, ModelWithEnum, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataComplexTypes = { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; -}; -export type TDataComplexParams = { - id: number; - requestBody?: { - readonly key: string | null; - name: string | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array | null; - parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; - readonly user?: { - readonly id?: number; - readonly name?: string | null; - }; - }; -}; - -export class ComplexService { - /** - * @returns ModelWithString Successful response - * @throws ApiError - */ - public static complexTypes(data: TDataComplexTypes): CancelablePromise> { - const { parameterObject, parameterReference } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/complex', - query: { - parameterObject, - parameterReference, - }, - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } - - /** - * @returns ModelWithString Success - * @throws ApiError - */ - public static complexParams(data: TDataComplexParams): CancelablePromise { - const { id, requestBody } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/complex/{id}', - path: { - id, - }, - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/DefaultService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/DefaultService.ts.snap deleted file mode 100644 index 7a42ade9a..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/DefaultService.ts.snap +++ /dev/null @@ -1,36 +0,0 @@ -import type { ModelWithArrayReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnly } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostServiceWithEmptyTag = { - requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; -}; - -export class DefaultService { - /** - * @throws ApiError - */ - public static serviceWithEmptyTag(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } - - /** - * @returns ModelWithReadOnlyAndWriteOnly - * @throws ApiError - */ - public static postServiceWithEmptyTag( - data: TDataPostServiceWithEmptyTag - ): CancelablePromise { - const { requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/no-tag', - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/DeprecatedService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/DeprecatedService.ts.snap deleted file mode 100644 index ea66c58d8..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/DeprecatedService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { DeprecatedModel } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeprecatedCall = { - /** - * This parameter is deprecated - */ - parameter: DeprecatedModel | null; -}; - -export class DeprecatedService { - /** - * @deprecated - * @throws ApiError - */ - public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { - const { parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/deprecated', - headers: { - parameter, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/DescriptionsService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/DescriptionsService.ts.snap deleted file mode 100644 index 4542a21a4..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/DescriptionsService.ts.snap +++ /dev/null @@ -1,61 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDescriptions = { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; -}; - -export class DescriptionsService { - /** - * @throws ApiError - */ - public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { - const { - parameterWithBackticks, - parameterWithBreaks, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - parameterWithSlashes, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/descriptions/', - query: { - parameterWithBreaks, - parameterWithBackticks, - parameterWithSlashes, - parameterWithExpressionPlaceholders, - parameterWithQuotes, - parameterWithReservedCharacters, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/DuplicateService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/DuplicateService.ts.snap deleted file mode 100644 index 7381aac77..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/DuplicateService.ts.snap +++ /dev/null @@ -1,45 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class DuplicateService { - /** - * @throws ApiError - */ - public static duplicateName(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName1(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName2(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName3(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/duplicate', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/ErrorService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/ErrorService.ts.snap deleted file mode 100644 index 751c848e3..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/ErrorService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTestErrorCode = { - /** - * Status code to return - */ - status: number; -}; - -export class ErrorService { - /** - * @returns any Custom message: Successful response - * @throws ApiError - */ - public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { - const { status } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/error', - query: { - status, - }, - errors: { - 500: `Custom message: Internal Server Error`, - 501: `Custom message: Not Implemented`, - 502: `Custom message: Bad Gateway`, - 503: `Custom message: Service Unavailable`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/FileResponseService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/FileResponseService.ts.snap deleted file mode 100644 index 15f852507..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/FileResponseService.ts.snap +++ /dev/null @@ -1,24 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataFileResponse = { - id: string; -}; - -export class FileResponseService { - /** - * @returns binary Success - * @throws ApiError - */ - public static fileResponse(data: TDataFileResponse): CancelablePromise { - const { id } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/file/{id}', - path: { - id, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/FormDataService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/FormDataService.ts.snap deleted file mode 100644 index 7c7624b4d..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/FormDataService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiFormData = { - /** - * A reusable request body - */ - formData?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -export class FormDataService { - /** - * @throws ApiError - */ - public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { - const { formData, parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/formData/', - query: { - parameter, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/HeaderService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/HeaderService.ts.snap deleted file mode 100644 index e451c3035..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/HeaderService.ts.snap +++ /dev/null @@ -1,21 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class HeaderService { - /** - * @returns string Successful response - * @throws ApiError - */ - public static callWithResultFromHeader(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/header', - responseHeader: 'operation-location', - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/MultipartService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/MultipartService.ts.snap deleted file mode 100644 index be7e46083..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/MultipartService.ts.snap +++ /dev/null @@ -1,43 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataMultipartRequest = { - formData?: { - content?: Blob | File; - data?: ModelWithString | null; - }; -}; - -export class MultipartService { - /** - * @throws ApiError - */ - public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { - const { formData } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/multipart', - formData: formData, - mediaType: 'multipart/form-data', - }); - } - - /** - * @returns any OK - * @throws ApiError - */ - public static multipartResponse(): CancelablePromise<{ - file?: Blob | File; - metadata?: { - foo?: string; - bar?: string; - }; - }> { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multipart', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3_enums_typescript/services/MultipleTags1Service.ts.snap deleted file mode 100644 index 21cac6e19..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/MultipleTags1Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags1Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3_enums_typescript/services/MultipleTags2Service.ts.snap deleted file mode 100644 index 1c86961ad..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/MultipleTags2Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags2Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3_enums_typescript/services/MultipleTags3Service.ts.snap deleted file mode 100644 index 15fc09d44..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/MultipleTags3Service.ts.snap +++ /dev/null @@ -1,16 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags3Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/NoContentService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/NoContentService.ts.snap deleted file mode 100644 index 4af0ece57..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/NoContentService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class NoContentService { - /** - * @returns void Success - * @throws ApiError - */ - public static callWithNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-content', - }); - } - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } -} diff --git "a/test/__snapshots__/v3_enums_typescript/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v3_enums_typescript/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" deleted file mode 100644 index c48469f26..000000000 --- "a/test/__snapshots__/v3_enums_typescript/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" +++ /dev/null @@ -1,30 +0,0 @@ -import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { - /** - * Dummy input param - */ - nonAsciiParamæøåÆøÅöôêÊ: number; -}; - -export class NonAsciiÆøåÆøÅöôêÊService { - /** - * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response - * @throws ApiError - */ - public static nonAsciiæøåÆøÅöôêÊ字符串( - data: TDataNonAsciiæøåÆøÅöôêÊ字符串 - ): CancelablePromise> { - const { nonAsciiParamæøåÆøÅöôêÊ } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', - query: { - nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/ParametersService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/ParametersService.ts.snap deleted file mode 100644 index 26e9b22a5..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/ParametersService.ts.snap +++ /dev/null @@ -1,230 +0,0 @@ -import type { ModelWithNestedArrayEnumsDataFoo, ModelWithOneOfEnum, ModelWithString, Pageable } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeleteFoo = { - /** - * bar in method - */ - bar: string; - /** - * foo in method - */ - foo: string; -}; -export type TDataCallWithParameters = { - fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; - fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: string | null; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath1?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath2?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath3?: string; - /** - * This is the parameter that goes into the request query params - */ - parameterQuery: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; -}; -export type TDataGetCallWithOptionalParam = { - /** - * This is an optional parameter - */ - parameter?: string; - /** - * This is a required parameter - */ - requestBody: ModelWithOneOfEnum; -}; -export type TDataPostCallWithOptionalParam = { - /** - * This is a required parameter - */ - parameter: Pageable; - /** - * This is an optional parameter - */ - requestBody?: ModelWithString; -}; - -export class ParametersService { - /** - * @throws ApiError - */ - public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { - const { bar, foo } = data; - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/foo/{foo}/bar/{bar}', - path: { - foo, - bar, - }, - }); - } - - /** - * @throws ApiError - */ - public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { - const { - fooAllOfEnum, - fooRefEnum, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath, - parameterQuery, - requestBody, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: { - parameterPath, - }, - cookies: { - parameterCookie, - }, - headers: { - parameterHeader, - }, - query: { - foo_ref_enum: fooRefEnum, - foo_all_of_enum: fooAllOfEnum, - parameterQuery, - }, - formData: { - parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { - const { - _default, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - parameterQuery, - requestBody, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', - path: { - 'parameter.path.1': parameterPath1, - 'parameter-path-2': parameterPath2, - 'PARAMETER-PATH-3': parameterPath3, - }, - cookies: { - 'PARAMETER-COOKIE': parameterCookie, - }, - headers: { - 'parameter.header': parameterHeader, - }, - query: { - default: _default, - 'parameter-query': parameterQuery, - }, - formData: { - parameter_form: parameterForm, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { - const { parameter, requestBody } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { - const { parameter, requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/', - query: { - parameter, - }, - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/RequestBodyService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/RequestBodyService.ts.snap deleted file mode 100644 index 248524bb9..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/RequestBodyService.ts.snap +++ /dev/null @@ -1,33 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiRequestBody = { - /** - * A reusable request body - */ - foo?: ModelWithString; - /** - * This is a reusable parameter - */ - parameter?: string; -}; - -export class RequestBodyService { - /** - * @throws ApiError - */ - public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { - const { foo, parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/requestBody/', - query: { - parameter, - }, - body: foo, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/ResponseService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/ResponseService.ts.snap deleted file mode 100644 index d25e4d887..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/ResponseService.ts.snap +++ /dev/null @@ -1,73 +0,0 @@ -import type { ModelThatExtends, ModelThatExtendsExtends, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class ResponseService { - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } - - /** - * @returns ModelWithString - * @throws ApiError - */ - public static callWithResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/response', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public static callWithDuplicateResponses(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } - - /** - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public static callWithResponses(): CancelablePromise< - | { - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; - } - | ModelWithString - | ModelThatExtends - | ModelThatExtendsExtends - > { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/SimpleService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/SimpleService.ts.snap deleted file mode 100644 index 733ff7439..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/SimpleService.ts.snap +++ /dev/null @@ -1,75 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class SimpleService { - /** - * @throws ApiError - */ - public static getCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static putCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static deleteCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static optionsCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'OPTIONS', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static headCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'HEAD', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static patchCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PATCH', - url: '/api/v{api-version}/simple', - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/TypesService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/TypesService.ts.snap deleted file mode 100644 index 992dac546..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/TypesService.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTypes = { - /** - * This is a number parameter - */ - id?: number; - /** - * This is an array parameter - */ - parameterArray: Array | null; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record | null; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error' | null; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: Record | null; - /** - * This is a string parameter - */ - parameterString?: string | null; -}; - -export class TypesService { - /** - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns unknown Response is a simple object - * @throws ApiError - */ - public static types(data: TDataTypes): CancelablePromise> { - const { - id, - parameterArray, - parameterBoolean = true, - parameterDictionary, - parameterEnum, - parameterNumber = 123, - parameterObject = null, - parameterString = 'default', - } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/types', - path: { - id, - }, - query: { - parameterNumber, - parameterString, - parameterBoolean, - parameterObject, - parameterArray, - parameterDictionary, - parameterEnum, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/UploadService.ts.snap b/test/__snapshots__/v3_enums_typescript/services/UploadService.ts.snap deleted file mode 100644 index 22847f40c..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/UploadService.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataUploadFile = { - /** - * Supply a file reference for upload - */ - file: Blob | File; -}; - -export class UploadService { - /** - * @returns boolean - * @throws ApiError - */ - public static uploadFile(data: TDataUploadFile): CancelablePromise { - const { file } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/upload', - formData: { - file, - }, - }); - } -} diff --git a/test/__snapshots__/v3_enums_typescript/services/index.ts.snap b/test/__snapshots__/v3_enums_typescript/services/index.ts.snap deleted file mode 100644 index 3243a2fb1..000000000 --- a/test/__snapshots__/v3_enums_typescript/services/index.ts.snap +++ /dev/null @@ -1,23 +0,0 @@ -export { CollectionFormatService } from './CollectionFormatService'; -export { ComplexService } from './ComplexService'; -export { DefaultService } from './DefaultService'; -export { DefaultsService } from './DefaultsService'; -export { DeprecatedService } from './DeprecatedService'; -export { DescriptionsService } from './DescriptionsService'; -export { DuplicateService } from './DuplicateService'; -export { ErrorService } from './ErrorService'; -export { FileResponseService } from './FileResponseService'; -export { FormDataService } from './FormDataService'; -export { HeaderService } from './HeaderService'; -export { MultipartService } from './MultipartService'; -export { MultipleTags1Service } from './MultipleTags1Service'; -export { MultipleTags2Service } from './MultipleTags2Service'; -export { MultipleTags3Service } from './MultipleTags3Service'; -export { NoContentService } from './NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './ParametersService'; -export { RequestBodyService } from './RequestBodyService'; -export { ResponseService } from './ResponseService'; -export { SimpleService } from './SimpleService'; -export { TypesService } from './TypesService'; -export { UploadService } from './UploadService'; diff --git a/test/__snapshots__/v3_experimental/services.ts.snap b/test/__snapshots__/v3_experimental/services.ts.snap new file mode 100644 index 000000000..34c1e1eff --- /dev/null +++ b/test/__snapshots__/v3_experimental/services.ts.snap @@ -0,0 +1,1155 @@ +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; + +import type { + ModelWithArrayReadOnlyAndWriteOnly, + ModelWithReadOnlyAndWriteOnly, + ModelWithNestedArrayEnumsDataFoo, + ModelWithOneOfEnum, + ModelWithString, + Pageable, + DeprecatedModel, + ModelThatExtends, + ModelThatExtendsExtends, + ModelWithArray, + ModelWithDictionary, + ModelWithEnum, + NonAsciiStringæøåÆØÅöôêÊ字符串, +} from './models'; + +export type TDataPostServiceWithEmptyTag = { + requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + + query?: {}; +}; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } + + /** + * @returns ModelWithReadOnlyAndWriteOnly + * @throws ApiError + */ + public static postServiceWithEmptyTag( + data: TDataPostServiceWithEmptyTag + ): CancelablePromise { + const { query, requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/no-tag', + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export class SimpleService { + /** + * @throws ApiError + */ + public static getCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static putCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static deleteCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static optionsCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static headCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static patchCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} + +export type TDataDeleteFoo = { + /** + * bar in method + */ + bar: string; + /** + * foo in method + */ + foo: string; + + query?: {}; +}; +export type TDataCallWithParameters = { + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; + + query: { + fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; + fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string | null; + }; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; + + query: { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string | null; + }; +}; +export type TDataGetCallWithOptionalParam = { + /** + * This is a required parameter + */ + requestBody: ModelWithOneOfEnum; + + query?: { + /** + * This is an optional parameter + */ + parameter?: string; + }; +}; +export type TDataPostCallWithOptionalParam = { + /** + * This is an optional parameter + */ + requestBody?: ModelWithString; + + query: { + /** + * This is a required parameter + */ + parameter: Pageable; + }; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { + const { query, bar, foo } = data; + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/foo/{foo}/bar/{bar}', + path: {}, + }); + } + + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { query, parameterCookie, parameterForm, parameterHeader, parameterPath, requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: {}, + cookies: {}, + headers: {}, + query: { + ...query, + }, + formData: {}, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + query, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: {}, + cookies: {}, + headers: {}, + query: { + ...query, + }, + formData: {}, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { + const { query, requestBody } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/parameters/', + query: { + ...query, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { + const { query, requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/', + query: { + ...query, + }, + body: requestBody, + mediaType: 'application/json', + }); + } +} + +export type TDataCallWithDescriptions = { + query?: { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; + }; +}; + +export class DescriptionsService { + /** + * @throws ApiError + */ + public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { + const { query } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + ...query, + }, + }); + } +} + +export type TDataDeprecatedCall = { + /** + * This parameter is deprecated + */ + parameter: DeprecatedModel | null; + + query?: {}; +}; + +export class DeprecatedService { + /** + * @deprecated + * @throws ApiError + */ + public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { + const { query, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/deprecated', + headers: {}, + }); + } +} + +export type TDataPostApiRequestBody = { + /** + * A reusable request body + */ + foo?: ModelWithString; + + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export class RequestBodyService { + /** + * @throws ApiError + */ + public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { + const { query, foo } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/requestBody/', + query: { + ...query, + }, + body: foo, + mediaType: 'application/json', + }); + } +} + +export type TDataPostApiFormData = { + /** + * A reusable request body + */ + formData?: ModelWithString; + + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; +}; + +export class FormDataService { + /** + * @throws ApiError + */ + public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { + const { query, formData } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/formData/', + query: { + ...query, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } +} + +export type TDataCallWithDefaultParameters = { + query?: { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * This is a simple string with default value + */ + parameterString?: string | null; + }; +}; +export type TDataCallWithDefaultOptionalParameters = { + query?: { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + }; +}; +export type TDataCallToTestOrderOfParams = { + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + }; +}; + +export class DefaultsService { + /** + * @throws ApiError + */ + public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { + const { query } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterBoolean: true, + parameterEnum: 'Success', + parameterModel: { + prop: 'Hello World!', + }, + parameterNumber: 123, + parameterString: 'Hello World!', + ...query, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithDefaultOptionalParameters( + data: TDataCallWithDefaultOptionalParameters = {} + ): CancelablePromise { + const { query } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterBoolean: true, + parameterEnum: 'Success', + parameterModel: { + prop: 'Hello World!', + }, + parameterNumber: 123, + parameterString: 'Hello World!', + ...query, + }, + }); + } + + /** + * @throws ApiError + */ + public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { + const { query } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault: 'Hello World!', + parameterOptionalStringWithEmptyDefault: '', + parameterStringNullableWithDefault: null, + parameterStringWithDefault: 'Hello World!', + parameterStringWithEmptyDefault: '', + ...query, + }, + }); + } +} + +export class DuplicateService { + /** + * @throws ApiError + */ + public static duplicateName(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName1(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName2(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName3(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} + +export class NoContentService { + /** + * @returns void Success + * @throws ApiError + */ + public static callWithNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} + +export class ResponseService { + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString + * @throws ApiError + */ + public static callWithResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public static callWithDuplicateResponses(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public static callWithResponses(): CancelablePromise< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} + +export class MultipleTags1Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags2Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export class MultipleTags3Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} + +export type TDataCollectionFormat = { + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array | null; + }; +}; + +export class CollectionFormatService { + /** + * @throws ApiError + */ + public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { + const { query } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + ...query, + }, + }); + } +} + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + + query: { + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: Record | null; + /** + * This is a string parameter + */ + parameterString?: string | null; + }; +}; + +export class TypesService { + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns unknown Response is a simple object + * @throws ApiError + */ + public static types(data: TDataTypes): CancelablePromise> { + const { query, id } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/types', + path: {}, + query: { + parameterBoolean: true, + parameterNumber: 123, + parameterObject: null, + parameterString: 'default', + ...query, + }, + }); + } +} + +export type TDataUploadFile = { + /** + * Supply a file reference for upload + */ + file: Blob | File; + + query?: {}; +}; + +export class UploadService { + /** + * @returns boolean + * @throws ApiError + */ + public static uploadFile(data: TDataUploadFile): CancelablePromise { + const { query, file } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/upload', + formData: {}, + }); + } +} + +export type TDataFileResponse = { + id: string; + + query?: {}; +}; + +export class FileResponseService { + /** + * @returns binary Success + * @throws ApiError + */ + public static fileResponse(data: TDataFileResponse): CancelablePromise { + const { query, id } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/file/{id}', + path: {}, + }); + } +} + +export type TDataComplexTypes = { + query: { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; + }; +}; +export type TDataComplexParams = { + id: number; + requestBody?: { + readonly key: string | null; + name: string | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string | null; + }; + }; + + query?: {}; +}; + +export class ComplexService { + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public static complexTypes(data: TDataComplexTypes): CancelablePromise> { + const { query } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + ...query, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } + + /** + * @returns ModelWithString Success + * @throws ApiError + */ + public static complexParams(data: TDataComplexParams): CancelablePromise { + const { query, id, requestBody } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/complex/{id}', + path: {}, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } +} + +export type TDataMultipartRequest = { + formData?: { + content?: Blob | File; + data?: ModelWithString | null; + }; + + query?: {}; +}; + +export class MultipartService { + /** + * @throws ApiError + */ + public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { + const { query, formData } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/multipart', + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * @returns any OK + * @throws ApiError + */ + public static multipartResponse(): CancelablePromise<{ + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multipart', + }); + } +} + +export class HeaderService { + /** + * @returns string Successful response + * @throws ApiError + */ + public static callWithResultFromHeader(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} + +export type TDataTestErrorCode = { + query: { + /** + * Status code to return + */ + status: number; + }; +}; + +export class ErrorService { + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { + const { query } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/error', + query: { + ...query, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; + }; +}; + +export class NonAsciiÆøåÆøÅöôêÊService { + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public static nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): CancelablePromise> { + const { query } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + ...query, + }, + }); + } +} diff --git a/test/__snapshots__/v3_experimental/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3_experimental/services/CollectionFormatService.ts.snap deleted file mode 100644 index 7acbb053e..000000000 --- a/test/__snapshots__/v3_experimental/services/CollectionFormatService.ts.snap +++ /dev/null @@ -1,44 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCollectionFormat = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCsv: Array | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array | null; - }; -}; - -export class CollectionFormatService { - /** - * @throws ApiError - */ - public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { - const { query } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/collectionFormat', - query: { - ...query, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/ComplexService.ts.snap b/test/__snapshots__/v3_experimental/services/ComplexService.ts.snap deleted file mode 100644 index 1a7a11d44..000000000 --- a/test/__snapshots__/v3_experimental/services/ComplexService.ts.snap +++ /dev/null @@ -1,77 +0,0 @@ -import type { ModelWithArray, ModelWithDictionary, ModelWithEnum, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataComplexTypes = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; -}; -export type TDataComplexParams = { - id: number; - requestBody?: { - readonly key: string | null; - name: string | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array | null; - parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; - readonly user?: { - readonly id?: number; - readonly name?: string | null; - }; - }; - - query?: {}; -}; - -export class ComplexService { - /** - * @returns ModelWithString Successful response - * @throws ApiError - */ - public static complexTypes(data: TDataComplexTypes): CancelablePromise> { - const { query } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/complex', - query: { - ...query, - }, - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } - - /** - * @returns ModelWithString Success - * @throws ApiError - */ - public static complexParams(data: TDataComplexParams): CancelablePromise { - const { query, id, requestBody } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/complex/{id}', - path: {}, - body: requestBody, - mediaType: 'application/json-patch+json', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/DefaultService.ts.snap b/test/__snapshots__/v3_experimental/services/DefaultService.ts.snap deleted file mode 100644 index 0986ff543..000000000 --- a/test/__snapshots__/v3_experimental/services/DefaultService.ts.snap +++ /dev/null @@ -1,38 +0,0 @@ -import type { ModelWithArrayReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnly } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostServiceWithEmptyTag = { - requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; - - query?: {}; -}; - -export class DefaultService { - /** - * @throws ApiError - */ - public static serviceWithEmptyTag(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } - - /** - * @returns ModelWithReadOnlyAndWriteOnly - * @throws ApiError - */ - public static postServiceWithEmptyTag( - data: TDataPostServiceWithEmptyTag - ): CancelablePromise { - const { query, requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/no-tag', - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/DefaultsService.ts.snap b/test/__snapshots__/v3_experimental/services/DefaultsService.ts.snap deleted file mode 100644 index 591e36376..000000000 --- a/test/__snapshots__/v3_experimental/services/DefaultsService.ts.snap +++ /dev/null @@ -1,154 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDefaultParameters = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: boolean | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString | null; - /** - * This is a simple number with default value - */ - parameterNumber?: number | null; - /** - * This is a simple string with default value - */ - parameterString?: string | null; - }; -}; -export type TDataCallWithDefaultOptionalParameters = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; -}; -export type TDataCallToTestOrderOfParams = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: string | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: string | null; - /** - * This is a string with default - */ - parameterStringWithDefault?: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault?: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; - }; -}; - -export class DefaultsService { - /** - * @throws ApiError - */ - public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { - const { query } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/defaults', - query: { - parameterBoolean: true, - parameterEnum: 'Success', - parameterModel: { - prop: 'Hello World!', - }, - parameterNumber: 123, - parameterString: 'Hello World!', - ...query, - }, - }); - } - - /** - * @throws ApiError - */ - public static callWithDefaultOptionalParameters( - data: TDataCallWithDefaultOptionalParameters = {} - ): CancelablePromise { - const { query } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/defaults', - query: { - parameterBoolean: true, - parameterEnum: 'Success', - parameterModel: { - prop: 'Hello World!', - }, - parameterNumber: 123, - parameterString: 'Hello World!', - ...query, - }, - }); - } - - /** - * @throws ApiError - */ - public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { - const { query } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/defaults', - query: { - parameterOptionalStringWithDefault: 'Hello World!', - parameterOptionalStringWithEmptyDefault: '', - parameterStringNullableWithDefault: null, - parameterStringWithDefault: 'Hello World!', - parameterStringWithEmptyDefault: '', - ...query, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/DeprecatedService.ts.snap b/test/__snapshots__/v3_experimental/services/DeprecatedService.ts.snap deleted file mode 100644 index fd0712507..000000000 --- a/test/__snapshots__/v3_experimental/services/DeprecatedService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { DeprecatedModel } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeprecatedCall = { - /** - * This parameter is deprecated - */ - parameter: DeprecatedModel | null; - - query?: {}; -}; - -export class DeprecatedService { - /** - * @deprecated - * @throws ApiError - */ - public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { - const { query, parameter } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/deprecated', - headers: {}, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/DescriptionsService.ts.snap b/test/__snapshots__/v3_experimental/services/DescriptionsService.ts.snap deleted file mode 100644 index b86fedf1f..000000000 --- a/test/__snapshots__/v3_experimental/services/DescriptionsService.ts.snap +++ /dev/null @@ -1,51 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDescriptions = { - query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: unknown; - /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; - }; -}; - -export class DescriptionsService { - /** - * @throws ApiError - */ - public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { - const { query } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/descriptions/', - query: { - ...query, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/DuplicateService.ts.snap b/test/__snapshots__/v3_experimental/services/DuplicateService.ts.snap deleted file mode 100644 index 7381aac77..000000000 --- a/test/__snapshots__/v3_experimental/services/DuplicateService.ts.snap +++ /dev/null @@ -1,45 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class DuplicateService { - /** - * @throws ApiError - */ - public static duplicateName(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName1(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName2(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/duplicate', - }); - } - - /** - * @throws ApiError - */ - public static duplicateName3(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/duplicate', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/ErrorService.ts.snap b/test/__snapshots__/v3_experimental/services/ErrorService.ts.snap deleted file mode 100644 index 3f944b6a1..000000000 --- a/test/__snapshots__/v3_experimental/services/ErrorService.ts.snap +++ /dev/null @@ -1,35 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTestErrorCode = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export class ErrorService { - /** - * @returns any Custom message: Successful response - * @throws ApiError - */ - public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { - const { query } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/error', - query: { - ...query, - }, - errors: { - 500: `Custom message: Internal Server Error`, - 501: `Custom message: Not Implemented`, - 502: `Custom message: Bad Gateway`, - 503: `Custom message: Service Unavailable`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/FileResponseService.ts.snap b/test/__snapshots__/v3_experimental/services/FileResponseService.ts.snap deleted file mode 100644 index bbec566d3..000000000 --- a/test/__snapshots__/v3_experimental/services/FileResponseService.ts.snap +++ /dev/null @@ -1,24 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataFileResponse = { - id: string; - - query?: {}; -}; - -export class FileResponseService { - /** - * @returns binary Success - * @throws ApiError - */ - public static fileResponse(data: TDataFileResponse): CancelablePromise { - const { query, id } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/file/{id}', - path: {}, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/FormDataService.ts.snap b/test/__snapshots__/v3_experimental/services/FormDataService.ts.snap deleted file mode 100644 index 2e0cdde8d..000000000 --- a/test/__snapshots__/v3_experimental/services/FormDataService.ts.snap +++ /dev/null @@ -1,36 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiFormData = { - /** - * A reusable request body - */ - formData?: ModelWithString; - - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export class FormDataService { - /** - * @throws ApiError - */ - public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { - const { query, formData } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/formData/', - query: { - ...query, - }, - formData: formData, - mediaType: 'multipart/form-data', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/HeaderService.ts.snap b/test/__snapshots__/v3_experimental/services/HeaderService.ts.snap deleted file mode 100644 index e451c3035..000000000 --- a/test/__snapshots__/v3_experimental/services/HeaderService.ts.snap +++ /dev/null @@ -1,21 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class HeaderService { - /** - * @returns string Successful response - * @throws ApiError - */ - public static callWithResultFromHeader(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/header', - responseHeader: 'operation-location', - errors: { - 400: `400 server error`, - 500: `500 server error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/MultipartService.ts.snap b/test/__snapshots__/v3_experimental/services/MultipartService.ts.snap deleted file mode 100644 index 014c73e6d..000000000 --- a/test/__snapshots__/v3_experimental/services/MultipartService.ts.snap +++ /dev/null @@ -1,45 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataMultipartRequest = { - formData?: { - content?: Blob | File; - data?: ModelWithString | null; - }; - - query?: {}; -}; - -export class MultipartService { - /** - * @throws ApiError - */ - public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { - const { query, formData } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/multipart', - formData: formData, - mediaType: 'multipart/form-data', - }); - } - - /** - * @returns any OK - * @throws ApiError - */ - public static multipartResponse(): CancelablePromise<{ - file?: Blob | File; - metadata?: { - foo?: string; - bar?: string; - }; - }> { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multipart', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3_experimental/services/MultipleTags1Service.ts.snap deleted file mode 100644 index 21cac6e19..000000000 --- a/test/__snapshots__/v3_experimental/services/MultipleTags1Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags1Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3_experimental/services/MultipleTags2Service.ts.snap deleted file mode 100644 index 1c86961ad..000000000 --- a/test/__snapshots__/v3_experimental/services/MultipleTags2Service.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags2Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyA(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/a', - }); - } - - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3_experimental/services/MultipleTags3Service.ts.snap deleted file mode 100644 index 15fc09d44..000000000 --- a/test/__snapshots__/v3_experimental/services/MultipleTags3Service.ts.snap +++ /dev/null @@ -1,16 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class MultipleTags3Service { - /** - * @returns void Success - * @throws ApiError - */ - public static dummyB(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/b', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/NoContentService.ts.snap b/test/__snapshots__/v3_experimental/services/NoContentService.ts.snap deleted file mode 100644 index 4af0ece57..000000000 --- a/test/__snapshots__/v3_experimental/services/NoContentService.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class NoContentService { - /** - * @returns void Success - * @throws ApiError - */ - public static callWithNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-content', - }); - } - - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } -} diff --git "a/test/__snapshots__/v3_experimental/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v3_experimental/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" deleted file mode 100644 index c3ab023b0..000000000 --- "a/test/__snapshots__/v3_experimental/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" +++ /dev/null @@ -1,32 +0,0 @@ -import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { - query: { - /** - * Dummy input param - */ - nonAsciiParamæøåÆøÅöôêÊ: number; - }; -}; - -export class NonAsciiÆøåÆøÅöôêÊService { - /** - * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response - * @throws ApiError - */ - public static nonAsciiæøåÆøÅöôêÊ字符串( - data: TDataNonAsciiæøåÆøÅöôêÊ字符串 - ): CancelablePromise> { - const { query } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', - query: { - ...query, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/ParametersService.ts.snap b/test/__snapshots__/v3_experimental/services/ParametersService.ts.snap deleted file mode 100644 index bda2eab89..000000000 --- a/test/__snapshots__/v3_experimental/services/ParametersService.ts.snap +++ /dev/null @@ -1,210 +0,0 @@ -import type { ModelWithNestedArrayEnumsDataFoo, ModelWithOneOfEnum, ModelWithString, Pageable } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataDeleteFoo = { - /** - * bar in method - */ - bar: string; - /** - * foo in method - */ - foo: string; - - query?: {}; -}; -export type TDataCallWithParameters = { - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath: string | null; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; - - query: { - fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; - fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string | null; - }; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter that goes into the cookie - */ - parameterCookie: string | null; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string | null; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string | null; - /** - * This is the parameter that goes into the path - */ - parameterPath1?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath2?: string; - /** - * This is the parameter that goes into the path - */ - parameterPath3?: string; - /** - * This is the parameter that goes into the body - */ - requestBody: ModelWithString | null; - - query: { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that goes into the request query params - */ - parameterQuery: string | null; - }; -}; -export type TDataGetCallWithOptionalParam = { - /** - * This is a required parameter - */ - requestBody: ModelWithOneOfEnum; - - query?: { - /** - * This is an optional parameter - */ - parameter?: string; - }; -}; -export type TDataPostCallWithOptionalParam = { - /** - * This is an optional parameter - */ - requestBody?: ModelWithString; - - query: { - /** - * This is a required parameter - */ - parameter: Pageable; - }; -}; - -export class ParametersService { - /** - * @throws ApiError - */ - public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { - const { query, bar, foo } = data; - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/foo/{foo}/bar/{bar}', - path: {}, - }); - } - - /** - * @throws ApiError - */ - public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { - const { query, parameterCookie, parameterForm, parameterHeader, parameterPath, requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: {}, - cookies: {}, - headers: {}, - query: { - ...query, - }, - formData: {}, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { - const { - query, - parameterCookie, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - requestBody, - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', - path: {}, - cookies: {}, - headers: {}, - query: { - ...query, - }, - formData: {}, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { - const { query, requestBody } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/parameters/', - query: { - ...query, - }, - body: requestBody, - mediaType: 'application/json', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { - const { query, requestBody } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/', - query: { - ...query, - }, - body: requestBody, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/RequestBodyService.ts.snap b/test/__snapshots__/v3_experimental/services/RequestBodyService.ts.snap deleted file mode 100644 index 15583a5fd..000000000 --- a/test/__snapshots__/v3_experimental/services/RequestBodyService.ts.snap +++ /dev/null @@ -1,36 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataPostApiRequestBody = { - /** - * A reusable request body - */ - foo?: ModelWithString; - - query?: { - /** - * This is a reusable parameter - */ - parameter?: string; - }; -}; - -export class RequestBodyService { - /** - * @throws ApiError - */ - public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { - const { query, foo } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/requestBody/', - query: { - ...query, - }, - body: foo, - mediaType: 'application/json', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/ResponseService.ts.snap b/test/__snapshots__/v3_experimental/services/ResponseService.ts.snap deleted file mode 100644 index d25e4d887..000000000 --- a/test/__snapshots__/v3_experimental/services/ResponseService.ts.snap +++ /dev/null @@ -1,73 +0,0 @@ -import type { ModelThatExtends, ModelThatExtendsExtends, ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class ResponseService { - /** - * @returns number Response is a simple number - * @returns void Success - * @throws ApiError - */ - public static callWithResponseAndNoContentResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/multiple-tags/response-and-no-content', - }); - } - - /** - * @returns ModelWithString - * @throws ApiError - */ - public static callWithResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/response', - }); - } - - /** - * @returns ModelWithString Message for default response - * @throws ApiError - */ - public static callWithDuplicateResponses(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } - - /** - * @returns any Message for 200 response - * @returns ModelWithString Message for default response - * @returns ModelThatExtends Message for 201 response - * @returns ModelThatExtendsExtends Message for 202 response - * @throws ApiError - */ - public static callWithResponses(): CancelablePromise< - | { - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; - } - | ModelWithString - | ModelThatExtends - | ModelThatExtendsExtends - > { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/response', - errors: { - 500: `Message for 500 error`, - 501: `Message for 501 error`, - 502: `Message for 502 error`, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/SimpleService.ts.snap b/test/__snapshots__/v3_experimental/services/SimpleService.ts.snap deleted file mode 100644 index 733ff7439..000000000 --- a/test/__snapshots__/v3_experimental/services/SimpleService.ts.snap +++ /dev/null @@ -1,75 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class SimpleService { - /** - * @throws ApiError - */ - public static getCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static putCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static postCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static deleteCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static optionsCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'OPTIONS', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static headCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'HEAD', - url: '/api/v{api-version}/simple', - }); - } - - /** - * @throws ApiError - */ - public static patchCallWithoutParametersAndResponse(): CancelablePromise { - return __request(OpenAPI, { - method: 'PATCH', - url: '/api/v{api-version}/simple', - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/TypesService.ts.snap b/test/__snapshots__/v3_experimental/services/TypesService.ts.snap deleted file mode 100644 index 3fb7c69df..000000000 --- a/test/__snapshots__/v3_experimental/services/TypesService.ts.snap +++ /dev/null @@ -1,66 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataTypes = { - /** - * This is a number parameter - */ - id?: number; - - query: { - /** - * This is an array parameter - */ - parameterArray: Array | null; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean | null; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record | null; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error' | null; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: Record | null; - /** - * This is a string parameter - */ - parameterString?: string | null; - }; -}; - -export class TypesService { - /** - * @returns number Response is a simple number - * @returns string Response is a simple string - * @returns boolean Response is a simple boolean - * @returns unknown Response is a simple object - * @throws ApiError - */ - public static types(data: TDataTypes): CancelablePromise> { - const { query, id } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/types', - path: {}, - query: { - parameterBoolean: true, - parameterNumber: 123, - parameterObject: null, - parameterString: 'default', - ...query, - }, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/UploadService.ts.snap b/test/__snapshots__/v3_experimental/services/UploadService.ts.snap deleted file mode 100644 index 66e14a79a..000000000 --- a/test/__snapshots__/v3_experimental/services/UploadService.ts.snap +++ /dev/null @@ -1,27 +0,0 @@ -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataUploadFile = { - /** - * Supply a file reference for upload - */ - file: Blob | File; - - query?: {}; -}; - -export class UploadService { - /** - * @returns boolean - * @throws ApiError - */ - public static uploadFile(data: TDataUploadFile): CancelablePromise { - const { query, file } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/upload', - formData: {}, - }); - } -} diff --git a/test/__snapshots__/v3_experimental/services/index.ts.snap b/test/__snapshots__/v3_experimental/services/index.ts.snap deleted file mode 100644 index 3243a2fb1..000000000 --- a/test/__snapshots__/v3_experimental/services/index.ts.snap +++ /dev/null @@ -1,23 +0,0 @@ -export { CollectionFormatService } from './CollectionFormatService'; -export { ComplexService } from './ComplexService'; -export { DefaultService } from './DefaultService'; -export { DefaultsService } from './DefaultsService'; -export { DeprecatedService } from './DeprecatedService'; -export { DescriptionsService } from './DescriptionsService'; -export { DuplicateService } from './DuplicateService'; -export { ErrorService } from './ErrorService'; -export { FileResponseService } from './FileResponseService'; -export { FormDataService } from './FormDataService'; -export { HeaderService } from './HeaderService'; -export { MultipartService } from './MultipartService'; -export { MultipleTags1Service } from './MultipleTags1Service'; -export { MultipleTags2Service } from './MultipleTags2Service'; -export { MultipleTags3Service } from './MultipleTags3Service'; -export { NoContentService } from './NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './ParametersService'; -export { RequestBodyService } from './RequestBodyService'; -export { ResponseService } from './ResponseService'; -export { SimpleService } from './SimpleService'; -export { TypesService } from './TypesService'; -export { UploadService } from './UploadService'; diff --git a/test/__snapshots__/v3_enums_typescript/services/DefaultsService.ts.snap b/test/__snapshots__/v3_options/services.ts.snap similarity index 95% rename from test/__snapshots__/v3_enums_typescript/services/DefaultsService.ts.snap rename to test/__snapshots__/v3_options/services.ts.snap index d8512f64c..2b8bb2e35 100644 --- a/test/__snapshots__/v3_enums_typescript/services/DefaultsService.ts.snap +++ b/test/__snapshots__/v3_options/services.ts.snap @@ -1,7 +1,8 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; + +import type { ModelWithString } from './models'; export type TDataCallWithDefaultParameters = { /** diff --git a/test/__snapshots__/v3_options/services/DefaultsService.ts.snap b/test/__snapshots__/v3_options/services/DefaultsService.ts.snap deleted file mode 100644 index d8512f64c..000000000 --- a/test/__snapshots__/v3_options/services/DefaultsService.ts.snap +++ /dev/null @@ -1,169 +0,0 @@ -import type { ModelWithString } from '../models'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithDefaultParameters = { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: boolean | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString | null; - /** - * This is a simple number with default value - */ - parameterNumber?: number | null; - /** - * This is a simple string with default value - */ - parameterString?: string | null; -}; -export type TDataCallWithDefaultOptionalParameters = { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; -}; -export type TDataCallToTestOrderOfParams = { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: string | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: string | null; - /** - * This is a string with default - */ - parameterStringWithDefault?: string; - /** - * This is a string with empty default - */ - parameterStringWithEmptyDefault?: string; - /** - * This is a string with no default - */ - parameterStringWithNoDefault: string; -}; - -export class DefaultsService { - /** - * @throws ApiError - */ - public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public static callWithDefaultOptionalParameters( - data: TDataCallWithDefaultOptionalParameters = {} - ): CancelablePromise { - const { - parameterBoolean = true, - parameterEnum = 'Success', - parameterModel = { - prop: 'Hello World!', - }, - parameterNumber = 123, - parameterString = 'Hello World!', - } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/defaults', - query: { - parameterString, - parameterNumber, - parameterBoolean, - parameterEnum, - parameterModel, - }, - }); - } - - /** - * @throws ApiError - */ - public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { - const { - parameterOptionalStringWithDefault = 'Hello World!', - parameterOptionalStringWithEmptyDefault = '', - parameterOptionalStringWithNoDefault, - parameterStringNullableWithDefault = null, - parameterStringNullableWithNoDefault, - parameterStringWithDefault = 'Hello World!', - parameterStringWithEmptyDefault = '', - parameterStringWithNoDefault, - } = data; - return __request(OpenAPI, { - method: 'PUT', - url: '/api/v{api-version}/defaults', - query: { - parameterOptionalStringWithDefault, - parameterOptionalStringWithEmptyDefault, - parameterOptionalStringWithNoDefault, - parameterStringWithDefault, - parameterStringWithEmptyDefault, - parameterStringWithNoDefault, - parameterStringNullableWithNoDefault, - parameterStringNullableWithDefault, - }, - }); - } -} diff --git a/test/__snapshots__/v3_options/services/index.ts.snap b/test/__snapshots__/v3_options/services/index.ts.snap deleted file mode 100644 index 94bf72bbd..000000000 --- a/test/__snapshots__/v3_options/services/index.ts.snap +++ /dev/null @@ -1 +0,0 @@ -export { DefaultsService } from './DefaultsService'; diff --git a/test/e2e/assets/main-angular-module.ts b/test/e2e/assets/main-angular-module.ts index b76e5f5fb..674282fdd 100644 --- a/test/e2e/assets/main-angular-module.ts +++ b/test/e2e/assets/main-angular-module.ts @@ -5,21 +5,23 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { ApiModule } from './client/ApiModule'; import { OpenAPI } from './client/core/OpenAPI'; -import { CollectionFormatService } from './client/services/CollectionFormatService'; -import { ComplexService } from './client/services/ComplexService'; -import { DefaultService } from './client/services/DefaultService'; -import { DefaultsService } from './client/services/DefaultsService'; -import { DuplicateService } from './client/services/DuplicateService'; -import { ErrorService } from './client/services/ErrorService'; -import { HeaderService } from './client/services/HeaderService'; -import { MultipleTags1Service } from './client/services/MultipleTags1Service'; -import { MultipleTags2Service } from './client/services/MultipleTags2Service'; -import { MultipleTags3Service } from './client/services/MultipleTags3Service'; -import { NoContentService } from './client/services/NoContentService'; -import { ParametersService } from './client/services/ParametersService'; -import { ResponseService } from './client/services/ResponseService'; -import { SimpleService } from './client/services/SimpleService'; -import { TypesService } from './client/services/TypesService'; +import { + CollectionFormatService, + ComplexService, + DefaultService, + DefaultsService, + DuplicateService, + ErrorService, + HeaderService, + MultipleTags1Service, + MultipleTags2Service, + MultipleTags3Service, + NoContentService, + ParametersService, + ResponseService, + SimpleService, + TypesService, +} from './client/services'; @Component({ selector: 'app-root', diff --git a/test/e2e/assets/main-angular.ts b/test/e2e/assets/main-angular.ts index 940a082e0..4697fe44d 100644 --- a/test/e2e/assets/main-angular.ts +++ b/test/e2e/assets/main-angular.ts @@ -4,21 +4,23 @@ import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { OpenAPI } from './client/core/OpenAPI'; -import { CollectionFormatService } from './client/services/CollectionFormatService'; -import { ComplexService } from './client/services/ComplexService'; -import { DefaultService } from './client/services/DefaultService'; -import { DefaultsService } from './client/services/DefaultsService'; -import { DuplicateService } from './client/services/DuplicateService'; -import { ErrorService } from './client/services/ErrorService'; -import { HeaderService } from './client/services/HeaderService'; -import { MultipleTags1Service } from './client/services/MultipleTags1Service'; -import { MultipleTags2Service } from './client/services/MultipleTags2Service'; -import { MultipleTags3Service } from './client/services/MultipleTags3Service'; -import { NoContentService } from './client/services/NoContentService'; -import { ParametersService } from './client/services/ParametersService'; -import { ResponseService } from './client/services/ResponseService'; -import { SimpleService } from './client/services/SimpleService'; -import { TypesService } from './client/services/TypesService'; +import { + CollectionFormatService, + ComplexService, + DefaultService, + DefaultsService, + DuplicateService, + ErrorService, + HeaderService, + MultipleTags1Service, + MultipleTags2Service, + MultipleTags3Service, + NoContentService, + ParametersService, + ResponseService, + SimpleService, + TypesService, +} from './client/services'; @Component({ selector: 'app-root',