From f40f72cea894504e105cfc4f7d9d03aacee45604 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 4 Sep 2024 07:16:21 +0100 Subject: [PATCH] [typescript] fix: `explode: true` should yield appended `query` params (#19519) * [typescript] fix: `explode: true` should yield appended `query` params * fix: object keys should be `set` --- ...typescript-consolidated-explode-query.yaml | 9 + .../resources/typescript/api/api.mustache | 20 + .../resources/typescript/http/http.mustache | 4 + .../builds/with-unique-items/http/http.ts | 4 + .../typescript/builds/browser/http/http.ts | 4 + .../builds/composed-schemas/http/http.ts | 4 + .../typescript/builds/default/http/http.ts | 4 + .../typescript/builds/deno/http/http.ts | 4 + .../builds/deno_object_params/http/http.ts | 4 + .../builds/explode-query/.gitignore | 1 + .../explode-query/.openapi-generator-ignore | 23 + .../explode-query/.openapi-generator/FILES | 82 + .../explode-query/.openapi-generator/VERSION | 1 + .../builds/explode-query/AnotherFakeApi.md | 66 + .../builds/explode-query/DefaultApi.md | 57 + .../builds/explode-query/FakeApi.md | 1159 ++++++++++++ .../explode-query/FakeClassnameTags123Api.md | 66 + .../typescript/builds/explode-query/PetApi.md | 573 ++++++ .../typescript/builds/explode-query/README.md | 80 + .../builds/explode-query/StoreApi.md | 234 +++ .../builds/explode-query/UserApi.md | 494 +++++ .../explode-query/apis/AnotherFakeApi.ts | 95 + .../builds/explode-query/apis/DefaultApi.ts | 71 + .../builds/explode-query/apis/FakeApi.ts | 1541 ++++++++++++++++ .../apis/FakeClassnameTags123Api.ts | 101 ++ .../builds/explode-query/apis/PetApi.ts | 787 ++++++++ .../builds/explode-query/apis/StoreApi.ts | 280 +++ .../builds/explode-query/apis/UserApi.ts | 535 ++++++ .../builds/explode-query/apis/baseapi.ts | 37 + .../builds/explode-query/apis/exception.ts | 15 + .../builds/explode-query/auth/auth.ts | 217 +++ .../builds/explode-query/configuration.ts | 82 + .../builds/explode-query/git_push.sh | 51 + .../builds/explode-query/http/http.ts | 251 +++ .../explode-query/http/isomorphic-fetch.ts | 32 + .../typescript/builds/explode-query/index.ts | 12 + .../builds/explode-query/middleware.ts | 66 + .../models/AdditionalPropertiesClass.ts | 43 + .../models/AllOfWithSingleRef.ts | 46 + .../builds/explode-query/models/Animal.ts | 47 + .../explode-query/models/ApiResponse.ts | 50 + .../models/ArrayOfArrayOfNumberOnly.ts | 36 + .../explode-query/models/ArrayOfNumberOnly.ts | 36 + .../builds/explode-query/models/ArrayTest.ts | 51 + .../explode-query/models/Capitalization.ts | 74 + .../builds/explode-query/models/Cat.ts | 38 + .../builds/explode-query/models/Category.ts | 43 + .../builds/explode-query/models/ClassModel.ts | 39 + .../builds/explode-query/models/Client.ts | 36 + .../explode-query/models/DeprecatedObject.ts | 36 + .../builds/explode-query/models/Dog.ts | 38 + .../builds/explode-query/models/EnumArrays.ts | 53 + .../builds/explode-query/models/EnumClass.ts | 19 + .../builds/explode-query/models/EnumTest.ts | 109 ++ .../models/FakeBigDecimalMap200Response.ts | 43 + .../models/FileSchemaTestClass.ts | 43 + .../builds/explode-query/models/Foo.ts | 36 + .../models/FooGetDefaultResponse.ts | 37 + .../builds/explode-query/models/FormatTest.ts | 148 ++ .../explode-query/models/HasOnlyReadOnly.ts | 43 + .../explode-query/models/HealthCheckResult.ts | 39 + .../builds/explode-query/models/List.ts | 36 + .../builds/explode-query/models/MapTest.ts | 63 + ...dPropertiesAndAdditionalPropertiesClass.ts | 51 + .../explode-query/models/Model200Response.ts | 46 + .../builds/explode-query/models/ModelFile.ts | 42 + .../builds/explode-query/models/Name.ts | 60 + .../explode-query/models/NullableClass.ts | 113 ++ .../builds/explode-query/models/NumberOnly.ts | 36 + .../explode-query/models/ObjectSerializer.ts | 416 +++++ .../models/ObjectWithDeprecatedFields.ts | 58 + .../builds/explode-query/models/Order.ts | 81 + .../explode-query/models/OuterComposite.ts | 50 + .../builds/explode-query/models/OuterEnum.ts | 19 + .../models/OuterEnumDefaultValue.ts | 19 + .../explode-query/models/OuterEnumInteger.ts | 19 + .../models/OuterEnumIntegerDefaultValue.ts | 19 + .../models/OuterObjectWithEnumProperty.ts | 39 + .../builds/explode-query/models/Pet.ts | 83 + .../explode-query/models/ReadOnlyFirst.ts | 43 + .../builds/explode-query/models/Return.ts | 39 + .../explode-query/models/SingleRefType.ts | 18 + .../explode-query/models/SpecialModelName.ts | 36 + .../builds/explode-query/models/Tag.ts | 43 + .../builds/explode-query/models/User.ts | 88 + .../builds/explode-query/models/all.ts | 47 + .../builds/explode-query/package.json | 45 + .../builds/explode-query/rxjsStub.ts | 27 + .../builds/explode-query/servers.ts | 57 + .../builds/explode-query/tsconfig.json | 28 + .../explode-query/types/ObjectParamAPI.ts | 1478 +++++++++++++++ .../explode-query/types/ObservableAPI.ts | 1613 +++++++++++++++++ .../builds/explode-query/types/PromiseAPI.ts | 1073 +++++++++++ .../typescript/builds/explode-query/util.ts | 37 + .../typescript/builds/inversify/http/http.ts | 4 + .../typescript/builds/jquery/http/http.ts | 4 + .../builds/object_params/http/http.ts | 4 + 97 files changed, 14183 insertions(+) create mode 100644 bin/configs/typescript-consolidated-explode-query.yaml create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/.gitignore create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/FakeApi.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/PetApi.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/README.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/StoreApi.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/UserApi.md create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/AnotherFakeApi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/DefaultApi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeApi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeClassnameTags123Api.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/PetApi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/StoreApi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/UserApi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/baseapi.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/apis/exception.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/auth/auth.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/configuration.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/git_push.sh create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/index.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/middleware.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/AdditionalPropertiesClass.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/AllOfWithSingleRef.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Animal.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ApiResponse.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfArrayOfNumberOnly.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfNumberOnly.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayTest.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Capitalization.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Cat.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Category.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ClassModel.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Client.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/DeprecatedObject.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Dog.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumArrays.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumClass.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumTest.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/FakeBigDecimalMap200Response.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/FileSchemaTestClass.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Foo.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/FooGetDefaultResponse.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/FormatTest.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/HasOnlyReadOnly.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/HealthCheckResult.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/List.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/MixedPropertiesAndAdditionalPropertiesClass.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Model200Response.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ModelFile.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Name.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/NullableClass.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/NumberOnly.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectWithDeprecatedFields.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Order.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterComposite.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnum.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumDefaultValue.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumInteger.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumIntegerDefaultValue.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterObjectWithEnumProperty.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Pet.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/ReadOnlyFirst.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Return.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/SingleRefType.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/SpecialModelName.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/Tag.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/User.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/models/all.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/package.json create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/rxjsStub.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/servers.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObjectParamAPI.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObservableAPI.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/types/PromiseAPI.ts create mode 100644 samples/openapi3/client/petstore/typescript/builds/explode-query/util.ts diff --git a/bin/configs/typescript-consolidated-explode-query.yaml b/bin/configs/typescript-consolidated-explode-query.yaml new file mode 100644 index 000000000000..46ef7cf90fae --- /dev/null +++ b/bin/configs/typescript-consolidated-explode-query.yaml @@ -0,0 +1,9 @@ +generatorName: typescript +outputDir: samples/openapi3/client/petstore/typescript/builds/explode-query +inputSpec: modules/openapi-generator/src/test/resources/3_0/snakecase-discriminator.yaml +templateDir: modules/openapi-generator/src/main/resources/typescript +additionalProperties: + platform: node + npmName: ts-petstore-client + projectName: ts-petstore-client + moduleName: petstore \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache index 7e763409ab3f..0ad7fa1ca686 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -66,7 +66,27 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { // Query Params if ({{paramName}} !== undefined) { + {{#isPrimitiveType}} requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isExplode}} + const serializedParams = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}"); + {{#isArray}} + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("{{baseName}}", serializedParam); + } + {{/isArray}} + {{^isArray}} + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + {{/isArray}} + {{/isExplode}} + {{^isExplode}} + requestContext.setQueryParam("{{baseName}}", ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "{{dataFormat}}")); + {{/isExplode}} + {{/isPrimitiveType}} } {{/queryParams}} {{#headerParams}} diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 2d28a40190d0..972f26d9387f 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -147,6 +147,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index 4f24155ea4fe..f38a52ec1300 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -105,6 +105,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index 4f24155ea4fe..f38a52ec1300 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -105,6 +105,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index 4f24155ea4fe..f38a52ec1300 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -105,6 +105,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 77fb4a789dbb..38fad4135e05 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -114,6 +114,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index 29fc7c39f619..8c5410362774 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -104,6 +104,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts index 29fc7c39f619..8c5410362774 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts @@ -104,6 +104,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/.gitignore b/samples/openapi3/client/petstore/typescript/builds/explode-query/.gitignore new file mode 100644 index 000000000000..1521c8b7652b --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/.gitignore @@ -0,0 +1 @@ +dist diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator-ignore b/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/FILES b/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/FILES new file mode 100644 index 000000000000..d10bffa8f064 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/FILES @@ -0,0 +1,82 @@ +.gitignore +AnotherFakeApi.md +DefaultApi.md +FakeApi.md +FakeClassnameTags123Api.md +PetApi.md +README.md +StoreApi.md +UserApi.md +apis/AnotherFakeApi.ts +apis/DefaultApi.ts +apis/FakeApi.ts +apis/FakeClassnameTags123Api.ts +apis/PetApi.ts +apis/StoreApi.ts +apis/UserApi.ts +apis/baseapi.ts +apis/exception.ts +auth/auth.ts +configuration.ts +git_push.sh +http/http.ts +http/isomorphic-fetch.ts +index.ts +middleware.ts +models/AdditionalPropertiesClass.ts +models/AllOfWithSingleRef.ts +models/Animal.ts +models/ApiResponse.ts +models/ArrayOfArrayOfNumberOnly.ts +models/ArrayOfNumberOnly.ts +models/ArrayTest.ts +models/Capitalization.ts +models/Cat.ts +models/Category.ts +models/ClassModel.ts +models/Client.ts +models/DeprecatedObject.ts +models/Dog.ts +models/EnumArrays.ts +models/EnumClass.ts +models/EnumTest.ts +models/FakeBigDecimalMap200Response.ts +models/FileSchemaTestClass.ts +models/Foo.ts +models/FooGetDefaultResponse.ts +models/FormatTest.ts +models/HasOnlyReadOnly.ts +models/HealthCheckResult.ts +models/List.ts +models/MapTest.ts +models/MixedPropertiesAndAdditionalPropertiesClass.ts +models/Model200Response.ts +models/ModelFile.ts +models/Name.ts +models/NullableClass.ts +models/NumberOnly.ts +models/ObjectSerializer.ts +models/ObjectWithDeprecatedFields.ts +models/Order.ts +models/OuterComposite.ts +models/OuterEnum.ts +models/OuterEnumDefaultValue.ts +models/OuterEnumInteger.ts +models/OuterEnumIntegerDefaultValue.ts +models/OuterObjectWithEnumProperty.ts +models/Pet.ts +models/ReadOnlyFirst.ts +models/Return.ts +models/SingleRefType.ts +models/SpecialModelName.ts +models/Tag.ts +models/User.ts +models/all.ts +package.json +rxjsStub.ts +servers.ts +tsconfig.json +types/ObjectParamAPI.ts +types/ObservableAPI.ts +types/PromiseAPI.ts +util.ts diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/VERSION b/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/VERSION new file mode 100644 index 000000000000..17f2442ff3bc --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/AnotherFakeApi.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/AnotherFakeApi.md new file mode 100644 index 000000000000..e697759fc7b3 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/AnotherFakeApi.md @@ -0,0 +1,66 @@ +# petstore.AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**_123testSpecialTags**](AnotherFakeApi.md#_123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + +# **_123testSpecialTags** +> Client _123testSpecialTags(client) + +To test special tags and operation ID starting with number + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.AnotherFakeApi(configuration); + +let body:petstore.AnotherFakeApi123testSpecialTagsRequest = { + // Client | client model + client: { + client: "client_example", + }, +}; + +apiInstance._123testSpecialTags(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | **Client**| client model | + + +### Return type + +**Client** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/DefaultApi.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/DefaultApi.md new file mode 100644 index 000000000000..ab3c71c2e14d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/DefaultApi.md @@ -0,0 +1,57 @@ +# petstore.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | + + +# **fooGet** +> fooGet() + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.DefaultApi(configuration); + +let body:any = {}; + +apiInstance.fooGet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | response | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/FakeApi.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/FakeApi.md new file mode 100644 index 000000000000..fc4605f4a384 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/FakeApi.md @@ -0,0 +1,1159 @@ +# petstore.FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | +[**testBodyWithBinary**](FakeApi.md#testBodyWithBinary) | **PUT** /fake/body-with-binary | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | + + +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:any = {}; + +apiInstance.fakeBigDecimalMap(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**FakeBigDecimalMap200Response** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:any = {}; + +apiInstance.fakeHealthGet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**HealthCheckResult** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakeHttpSignatureTest** +> void fakeHttpSignatureTest(pet) + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiFakeHttpSignatureTestRequest = { + // Pet | Pet object that needs to be added to the store + pet: { + id: 1, + category: { + id: 1, + name: "default-name", + }, + name: "doggie", + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, + // string | query parameter (optional) + query1: "query_1_example", + // string | header parameter (optional) + header1: "header_1_example", +}; + +apiInstance.fakeHttpSignatureTest(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + **query1** | [**string**] | query parameter | (optional) defaults to undefined + **header1** | [**string**] | header parameter | (optional) defaults to undefined + + +### Return type + +**void** + +### Authorization + +[http_signature_test](README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakeOuterBooleanSerialize** +> boolean fakeOuterBooleanSerialize() + +Test serialization of outer boolean types + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiFakeOuterBooleanSerializeRequest = { + // boolean | Input boolean as post body (optional) + body: true, +}; + +apiInstance.fakeOuterBooleanSerialize(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **boolean**| Input boolean as post body | + + +### Return type + +**boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output boolean | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize() + +Test serialization of object with outer number type + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiFakeOuterCompositeSerializeRequest = { + // OuterComposite | Input composite as post body (optional) + outerComposite: { + myNumber: 3.14, + myString: "myString_example", + myBoolean: true, + }, +}; + +apiInstance.fakeOuterCompositeSerialize(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | **OuterComposite**| Input composite as post body | + + +### Return type + +**OuterComposite** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output composite | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakeOuterNumberSerialize** +> number fakeOuterNumberSerialize() + +Test serialization of outer number types + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiFakeOuterNumberSerializeRequest = { + // number | Input number as post body (optional) + body: 3.14, +}; + +apiInstance.fakeOuterNumberSerialize(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **number**| Input number as post body | + + +### Return type + +**number** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output number | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakeOuterStringSerialize** +> string fakeOuterStringSerialize() + +Test serialization of outer string types + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiFakeOuterStringSerializeRequest = { + // string | Input string as post body (optional) + body: "body_example", +}; + +apiInstance.fakeOuterStringSerialize(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string**| Input string as post body | + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output string | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **fakePropertyEnumIntegerSerialize** +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + +Test serialization of enum (int) properties with examples + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiFakePropertyEnumIntegerSerializeRequest = { + // OuterObjectWithEnumProperty | Input enum (int) as post body + outerObjectWithEnumProperty: { + value: 2, + }, +}; + +apiInstance.fakePropertyEnumIntegerSerialize(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerObjectWithEnumProperty** | **OuterObjectWithEnumProperty**| Input enum (int) as post body | + + +### Return type + +**OuterObjectWithEnumProperty** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output enum (int) | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testBodyWithBinary** +> void testBodyWithBinary(body) + +For this test, the body has to be a binary file. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestBodyWithBinaryRequest = { + // HttpFile | image to upload + body: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, +}; + +apiInstance.testBodyWithBinary(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **HttpFile**| image to upload | + + +### Return type + +**void** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testBodyWithFileSchema** +> void testBodyWithFileSchema(fileSchemaTestClass) + +For this test, the body for this request must reference a schema named `File`. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestBodyWithFileSchemaRequest = { + // FileSchemaTestClass + fileSchemaTestClass: { + file: { + sourceURI: "sourceURI_example", + }, + files: [ + { + sourceURI: "sourceURI_example", + }, + ], + }, +}; + +apiInstance.testBodyWithFileSchema(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | **FileSchemaTestClass**| | + + +### Return type + +**void** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testBodyWithQueryParams** +> void testBodyWithQueryParams(user) + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestBodyWithQueryParamsRequest = { + // string + query: "query_example", + // User + user: { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, +}; + +apiInstance.testBodyWithQueryParams(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **User**| | + **query** | [**string**] | | defaults to undefined + + +### Return type + +**void** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestClientModelRequest = { + // Client | client model + client: { + client: "client_example", + }, +}; + +apiInstance.testClientModel(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | **Client**| client model | + + +### Return type + +**Client** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testEndpointParameters** +> testEndpointParameters() + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestEndpointParametersRequest = { + // number | None + number: 32.1, + // number | None + _double: 67.8, + // string | None + patternWithoutDelimiter: "AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>", + // string | None + _byte: 'YQ==', + // number | None (optional) + integer: 10, + // number | None (optional) + int32: 20, + // number | None (optional) + int64: 1, + // number | None (optional) + _float: 3.14, + // string | None (optional) + string: "/a/i", + // HttpFile | None (optional) + binary: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, + // string | None (optional) + date: new Date('1970-01-01').toISOString().split('T')[0];, + // Date | None (optional) + dateTime: new Date('1970-01-01T00:00:00.00Z'), + // string | None (optional) + password: "password_example", + // string | None (optional) + callback: "callback_example", +}; + +apiInstance.testEndpointParameters(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | [**number**] | None | defaults to undefined + **_double** | [**number**] | None | defaults to undefined + **patternWithoutDelimiter** | [**string**] | None | defaults to undefined + **_byte** | [**string**] | None | defaults to undefined + **integer** | [**number**] | None | (optional) defaults to undefined + **int32** | [**number**] | None | (optional) defaults to undefined + **int64** | [**number**] | None | (optional) defaults to undefined + **_float** | [**number**] | None | (optional) defaults to undefined + **string** | [**string**] | None | (optional) defaults to undefined + **binary** | [**HttpFile**] | None | (optional) defaults to undefined + **date** | [**string**] | None | (optional) defaults to undefined + **dateTime** | [**Date**] | None | (optional) defaults to undefined + **password** | [**string**] | None | (optional) defaults to undefined + **callback** | [**string**] | None | (optional) defaults to undefined + + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testEnumParameters** +> testEnumParameters() + +To test enum parameters + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestEnumParametersRequest = { + // Array<'>' | '$'> | Header parameter enum test (string array) (optional) + enumHeaderStringArray: [ + "$", + ], + // '_abc' | '-efg' | '(xyz)' | Header parameter enum test (string) (optional) + enumHeaderString: "-efg", + // Array<'>' | '$'> | Query parameter enum test (string array) (optional) + enumQueryStringArray: [ + "$", + ], + // '_abc' | '-efg' | '(xyz)' | Query parameter enum test (string) (optional) + enumQueryString: "-efg", + // 1 | -2 | Query parameter enum test (double) (optional) + enumQueryInteger: 1, + // 1.1 | -1.2 | Query parameter enum test (double) (optional) + enumQueryDouble: 1.1, + // Array (optional) + enumQueryModelArray: [ + "-efg", + ], + // Array | Form parameter enum test (string array) (optional) + enumFormStringArray: [ + "$", + ], + // string | Form parameter enum test (string) (optional) + enumFormString: "-efg", +}; + +apiInstance.testEnumParameters(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | **Array<'>' | '$'>** | Header parameter enum test (string array) | (optional) defaults to undefined + **enumHeaderString** | [**'_abc' | '-efg' | '(xyz)'**]**Array<'_abc' | '-efg' | '(xyz)'>** | Header parameter enum test (string) | (optional) defaults to '-efg' + **enumQueryStringArray** | **Array<'>' | '$'>** | Query parameter enum test (string array) | (optional) defaults to undefined + **enumQueryString** | [**'_abc' | '-efg' | '(xyz)'**]**Array<'_abc' | '-efg' | '(xyz)'>** | Query parameter enum test (string) | (optional) defaults to '-efg' + **enumQueryInteger** | [**1 | -2**]**Array<1 | -2>** | Query parameter enum test (double) | (optional) defaults to undefined + **enumQueryDouble** | [**1.1 | -1.2**]**Array<1.1 | -1.2>** | Query parameter enum test (double) | (optional) defaults to undefined + **enumQueryModelArray** | **Array<EnumClass>** | | (optional) defaults to undefined + **enumFormStringArray** | **Array<'>' | '$'>** | Form parameter enum test (string array) | (optional) defaults to '$' + **enumFormString** | [**string**]**Array<'_abc' | '-efg' | '(xyz)'>** | Form parameter enum test (string) | (optional) defaults to '-efg' + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid request | - | +**404** | Not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testGroupParameters** +> testGroupParameters() + +Fake endpoint to test group parameters (optional) + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestGroupParametersRequest = { + // number | Required String in group parameters + requiredStringGroup: 1, + // boolean | Required Boolean in group parameters + requiredBooleanGroup: true, + // number | Required Integer in group parameters + requiredInt64Group: 1, + // number | String in group parameters (optional) + stringGroup: 1, + // boolean | Boolean in group parameters (optional) + booleanGroup: true, + // number | Integer in group parameters (optional) + int64Group: 1, +}; + +apiInstance.testGroupParameters(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | [**number**] | Required String in group parameters | defaults to undefined + **requiredBooleanGroup** | [**boolean**] | Required Boolean in group parameters | defaults to undefined + **requiredInt64Group** | [**number**] | Required Integer in group parameters | defaults to undefined + **stringGroup** | [**number**] | String in group parameters | (optional) defaults to undefined + **booleanGroup** | [**boolean**] | Boolean in group parameters | (optional) defaults to undefined + **int64Group** | [**number**] | Integer in group parameters | (optional) defaults to undefined + + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Something wrong | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testInlineAdditionalProperties** +> void testInlineAdditionalProperties(requestBody) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestInlineAdditionalPropertiesRequest = { + // { [key: string]: string; } | request body + requestBody: { + "key": "key_example", + }, +}; + +apiInstance.testInlineAdditionalProperties(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | **{ [key: string]: string; }**| request body | + + +### Return type + +**void** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testJsonFormData** +> void testJsonFormData() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestJsonFormDataRequest = { + // string | field1 + param: "param_example", + // string | field2 + param2: "param2_example", +}; + +apiInstance.testJsonFormData(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | [**string**] | field1 | defaults to undefined + **param2** | [**string**] | field2 | defaults to undefined + + +### Return type + +**void** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **testQueryParameterCollectionFormat** +> void testQueryParameterCollectionFormat() + +To test the collection format in query parameters + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeApi(configuration); + +let body:petstore.FakeApiTestQueryParameterCollectionFormatRequest = { + // Array + pipe: [ + "pipe_example", + ], + // Array + ioutil: [ + "ioutil_example", + ], + // Array + http: [ + "http_example", + ], + // Array + url: [ + "url_example", + ], + // Array + context: [ + "context_example", + ], + // string + allowEmpty: "allowEmpty_example", + // { [key: string]: string; } (optional) + language: { + "key": "key_example", + }, +}; + +apiInstance.testQueryParameterCollectionFormat(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | **Array<string>** | | defaults to undefined + **ioutil** | **Array<string>** | | defaults to undefined + **http** | **Array<string>** | | defaults to undefined + **url** | **Array<string>** | | defaults to undefined + **context** | **Array<string>** | | defaults to undefined + **allowEmpty** | [**string**] | | defaults to undefined + **language** | **{ [key: string]: string; }** | | (optional) defaults to undefined + + +### Return type + +**void** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..1f678bea2f7e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/FakeClassnameTags123Api.md @@ -0,0 +1,66 @@ +# petstore.FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> Client testClassname(client) + +To test class name in snake case + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.FakeClassnameTags123Api(configuration); + +let body:petstore.FakeClassnameTags123ApiTestClassnameRequest = { + // Client | client model + client: { + client: "client_example", + }, +}; + +apiInstance.testClassname(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | **Client**| client model | + + +### Return type + +**Client** + +### Authorization + +[api_key_query](README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/PetApi.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/PetApi.md new file mode 100644 index 000000000000..40111eaf7d18 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/PetApi.md @@ -0,0 +1,573 @@ +# petstore.PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +> void addPet(pet) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiAddPetRequest = { + // Pet | Pet object that needs to be added to the store + pet: { + id: 1, + category: { + id: 1, + name: "default-name", + }, + name: "doggie", + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +apiInstance.addPet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**void** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **deletePet** +> void deletePet() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiDeletePetRequest = { + // number | Pet id to delete + petId: 1, + // string (optional) + apiKey: "api_key_example", +}; + +apiInstance.deletePet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | Pet id to delete | defaults to undefined + **apiKey** | [**string**] | | (optional) defaults to undefined + + +### Return type + +**void** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**400** | Invalid pet value | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **findPetsByStatus** +> Array findPetsByStatus() + +Multiple status values can be provided with comma separated strings + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiFindPetsByStatusRequest = { + // Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter + status: [ + "available", + ], +}; + +apiInstance.findPetsByStatus(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined + + +### Return type + +**Array** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid status value | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **findPetsByTags** +> Set findPetsByTags() + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiFindPetsByTagsRequest = { + // Set | Tags to filter by + tags: [ + "tags_example", + ], +}; + +apiInstance.findPetsByTags(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | **Set<string>** | Tags to filter by | defaults to undefined + + +### Return type + +**Set** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid tag value | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getPetById** +> Pet getPetById() + +Returns a single pet + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiGetPetByIdRequest = { + // number | ID of pet to return + petId: 1, +}; + +apiInstance.getPetById(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet to return | defaults to undefined + + +### Return type + +**Pet** + +### Authorization + +[api_key](README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Pet not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **updatePet** +> void updatePet(pet) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUpdatePetRequest = { + // Pet | Pet object that needs to be added to the store + pet: { + id: 1, + category: { + id: 1, + name: "default-name", + }, + name: "doggie", + photoUrls: [ + "photoUrls_example", + ], + tags: [ + { + id: 1, + name: "name_example", + }, + ], + status: "available", + }, +}; + +apiInstance.updatePet(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | **Pet**| Pet object that needs to be added to the store | + + +### Return type + +**void** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Pet not found | - | +**405** | Validation exception | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **updatePetWithForm** +> void updatePetWithForm() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUpdatePetWithFormRequest = { + // number | ID of pet that needs to be updated + petId: 1, + // string | Updated name of the pet (optional) + name: "name_example", + // string | Updated status of the pet (optional) + status: "status_example", +}; + +apiInstance.updatePetWithForm(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined + **name** | [**string**] | Updated name of the pet | (optional) defaults to undefined + **status** | [**string**] | Updated status of the pet | (optional) defaults to undefined + + +### Return type + +**void** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **uploadFile** +> ApiResponse uploadFile() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUploadFileRequest = { + // number | ID of pet to update + petId: 1, + // string | Additional data to pass to server (optional) + additionalMetadata: "additionalMetadata_example", + // HttpFile | file to upload (optional) + file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, +}; + +apiInstance.uploadFile(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet to update | defaults to undefined + **additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined + **file** | [**HttpFile**] | file to upload | (optional) defaults to undefined + + +### Return type + +**ApiResponse** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.PetApi(configuration); + +let body:petstore.PetApiUploadFileWithRequiredFileRequest = { + // number | ID of pet to update + petId: 1, + // HttpFile | file to upload + requiredFile: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' }, + // string | Additional data to pass to server (optional) + additionalMetadata: "additionalMetadata_example", +}; + +apiInstance.uploadFileWithRequiredFile(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | [**number**] | ID of pet to update | defaults to undefined + **requiredFile** | [**HttpFile**] | file to upload | defaults to undefined + **additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined + + +### Return type + +**ApiResponse** + +### Authorization + +[petstore_auth](README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/README.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/README.md new file mode 100644 index 000000000000..325283a66322 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/README.md @@ -0,0 +1,80 @@ +## ts-petstore-client@1.0.0 + +This generator creates TypeScript/JavaScript client that utilizes fetch-api. + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +Navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install ts-petstore-client@1.0.0 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save +``` + +### Usage + +Below code snippet shows exemplary usage of the configuration and the API based +on the typical `PetStore` example used for OpenAPI. + +``` +import * as your_api from 'your_api_package' + +// Covers all auth methods included in your OpenAPI yaml definition +const authConfig: your_api.AuthMethodsConfiguration = { + "api_key": "YOUR_API_KEY" +} + +// Implements a simple middleware to modify requests before (`pre`) they are sent +// and after (`post`) they have been received +class Test implements your_api.Middleware { + pre(context: your_api.RequestContext): Promise { + // Modify context here and return + return Promise.resolve(context); + } + + post(context: your_api.ResponseContext): Promise { + return Promise.resolve(context); + } + +} + +// Create configuration parameter object +const configurationParameters = { + httpApi: new your_api.JQueryHttpLibrary(), // Can also be ignored - default is usually fine + baseServer: your_api.servers[0], // First server is default + authMethods: authConfig, // No auth is default + promiseMiddleware: [new Test()], +} + +// Convert to actual configuration +const config = your_api.createConfiguration(configurationParameters); + +// Use configuration with your_api +const api = new your_api.PetApi(config); +your_api.Pet p = new your_api.Pet(); +p.name = "My new pet"; +p.photoUrls = []; +p.tags = []; +p.status = "available"; +Promise createdPet = api.addPet(p); + +``` diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/StoreApi.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/StoreApi.md new file mode 100644 index 000000000000..bd867bbdf9e2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/StoreApi.md @@ -0,0 +1,234 @@ +# petstore.StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder() + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:petstore.StoreApiDeleteOrderRequest = { + // string | ID of the order that needs to be deleted + orderId: "order_id_example", +}; + +apiInstance.deleteOrder(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getInventory** +> { [key: string]: number; } getInventory() + +Returns a map of status codes to quantities + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:any = {}; + +apiInstance.getInventory(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +**{ [key: string]: number; }** + +### Authorization + +[api_key](README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getOrderById** +> Order getOrderById() + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:petstore.StoreApiGetOrderByIdRequest = { + // number | ID of pet that needs to be fetched + orderId: 1, +}; + +apiInstance.getOrderById(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined + + +### Return type + +**Order** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **placeOrder** +> Order placeOrder(order) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.StoreApi(configuration); + +let body:petstore.StoreApiPlaceOrderRequest = { + // Order | order placed for purchasing the pet + order: { + id: 1, + petId: 1, + quantity: 1, + shipDate: new Date('1970-01-01T00:00:00.00Z'), + status: "placed", + complete: false, + }, +}; + +apiInstance.placeOrder(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | **Order**| order placed for purchasing the pet | + + +### Return type + +**Order** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid Order | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/UserApi.md b/samples/openapi3/client/petstore/typescript/builds/explode-query/UserApi.md new file mode 100644 index 000000000000..b5c6ab232ea4 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/UserApi.md @@ -0,0 +1,494 @@ +# petstore.UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +# **createUser** +> createUser(user) + +This can only be done by the logged in user. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiCreateUserRequest = { + // User | Created user object + user: { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, +}; + +apiInstance.createUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **User**| Created user object | + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiCreateUsersWithArrayInputRequest = { + // Array | List of user object + user: [ + { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, + ], +}; + +apiInstance.createUsersWithArrayInput(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **Array**| List of user object | + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiCreateUsersWithListInputRequest = { + // Array | List of user object + user: [ + { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, + ], +}; + +apiInstance.createUsersWithListInput(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **Array**| List of user object | + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **deleteUser** +> deleteUser() + +This can only be done by the logged in user. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiDeleteUserRequest = { + // string | The name that needs to be deleted + username: "username_example", +}; + +apiInstance.deleteUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | [**string**] | The name that needs to be deleted | defaults to undefined + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **getUserByName** +> User getUserByName() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiGetUserByNameRequest = { + // string | The name that needs to be fetched. Use user1 for testing. + username: "username_example", +}; + +apiInstance.getUserByName(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined + + +### Return type + +**User** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **loginUser** +> string loginUser() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiLoginUserRequest = { + // string | The user name for login + username: "username_example", + // string | The password for login in clear text + password: "password_example", +}; + +apiInstance.loginUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | [**string**] | The user name for login | defaults to undefined + **password** | [**string**] | The password for login in clear text | defaults to undefined + + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +**400** | Invalid username/password supplied | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **logoutUser** +> logoutUser() + + + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:any = {}; + +apiInstance.logoutUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters +This endpoint does not need any parameter. + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + +# **updateUser** +> updateUser(user) + +This can only be done by the logged in user. + +### Example + + +```typescript +import { petstore } from 'ts-petstore-client'; +import * as fs from 'fs'; + +const configuration = petstore.createConfiguration(); +const apiInstance = new petstore.UserApi(configuration); + +let body:petstore.UserApiUpdateUserRequest = { + // string | name that need to be deleted + username: "username_example", + // User | Updated user object + user: { + id: 1, + username: "username_example", + firstName: "firstName_example", + lastName: "lastName_example", + email: "email_example", + password: "password_example", + phone: "phone_example", + userStatus: 1, + }, +}; + +apiInstance.updateUser(body).then((data:any) => { + console.log('API called successfully. Returned data: ' + data); +}).catch((error:any) => console.error(error)); +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | **User**| Updated user object | + **username** | [**string**] | name that need to be deleted | defaults to undefined + + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid user supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md) + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/AnotherFakeApi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/AnotherFakeApi.ts new file mode 100644 index 000000000000..b5dd6b2e1682 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/AnotherFakeApi.ts @@ -0,0 +1,95 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { Client } from '../models/Client'; + +/** + * no description + */ +export class AnotherFakeApiRequestFactory extends BaseAPIRequestFactory { + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param client client model + */ + public async _123testSpecialTags(client: Client, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'client' is not null or undefined + if (client === null || client === undefined) { + throw new RequiredError("AnotherFakeApi", "_123testSpecialTags", "client"); + } + + + // Path Params + const localVarPath = '/another-fake/dummy'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(client, "Client", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class AnotherFakeApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to _123testSpecialTags + * @throws ApiException if the response code was not in [200, 299] + */ + public async _123testSpecialTagsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Client = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Client", "" + ) as Client; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Client = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Client", "" + ) as Client; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/DefaultApi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/DefaultApi.ts new file mode 100644 index 000000000000..e496b26dd732 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/DefaultApi.ts @@ -0,0 +1,71 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { FooGetDefaultResponse } from '../models/FooGetDefaultResponse'; + +/** + * no description + */ +export class DefaultApiRequestFactory extends BaseAPIRequestFactory { + + /** + */ + public async fooGet(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/foo'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class DefaultApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fooGet + * @throws ApiException if the response code was not in [200, 299] + */ + public async fooGetWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + const body: FooGetDefaultResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FooGetDefaultResponse", "" + ) as FooGetDefaultResponse; + throw new ApiException(response.httpStatusCode, "response", body, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeApi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeApi.ts new file mode 100644 index 000000000000..3658e77fcbec --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeApi.ts @@ -0,0 +1,1541 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { Client } from '../models/Client'; +import { EnumClass } from '../models/EnumClass'; +import { FakeBigDecimalMap200Response } from '../models/FakeBigDecimalMap200Response'; +import { FileSchemaTestClass } from '../models/FileSchemaTestClass'; +import { HealthCheckResult } from '../models/HealthCheckResult'; +import { OuterComposite } from '../models/OuterComposite'; +import { OuterObjectWithEnumProperty } from '../models/OuterObjectWithEnumProperty'; +import { Pet } from '../models/Pet'; +import { User } from '../models/User'; + +/** + * no description + */ +export class FakeApiRequestFactory extends BaseAPIRequestFactory { + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + public async fakeBigDecimalMap(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/fake/BigDecimalMap'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Health check endpoint + */ + public async fakeHealthGet(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/fake/health'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * test http signature authentication + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter + * @param header1 header parameter + */ + public async fakeHttpSignatureTest(pet: Pet, query1?: string, header1?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError("FakeApi", "fakeHttpSignatureTest", "pet"); + } + + + + + // Path Params + const localVarPath = '/fake/http-signature-test'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (query1 !== undefined) { + requestContext.setQueryParam("query_1", ObjectSerializer.serialize(query1, "string", "")); + } + + // Header Params + requestContext.setHeaderParam("header_1", ObjectSerializer.serialize(header1, "string", "")); + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + + "application/xml" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["http_signature_test"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test serialization of outer boolean types + * @param body Input boolean as post body + */ + public async fakeOuterBooleanSerialize(body?: boolean, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/fake/outer/boolean'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "boolean", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body + */ + public async fakeOuterCompositeSerialize(outerComposite?: OuterComposite, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/fake/outer/composite'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(outerComposite, "OuterComposite", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test serialization of outer number types + * @param body Input number as post body + */ + public async fakeOuterNumberSerialize(body?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/fake/outer/number'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "number", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test serialization of outer string types + * @param body Input string as post body + */ + public async fakeOuterStringSerialize(body?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + // Path Params + const localVarPath = '/fake/outer/string'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "string", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + */ + public async fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty: OuterObjectWithEnumProperty, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'outerObjectWithEnumProperty' is not null or undefined + if (outerObjectWithEnumProperty === null || outerObjectWithEnumProperty === undefined) { + throw new RequiredError("FakeApi", "fakePropertyEnumIntegerSerialize", "outerObjectWithEnumProperty"); + } + + + // Path Params + const localVarPath = '/fake/property/enum-int'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(outerObjectWithEnumProperty, "OuterObjectWithEnumProperty", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * For this test, the body has to be a binary file. + * @param body image to upload + */ + public async testBodyWithBinary(body: HttpFile, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("FakeApi", "testBodyWithBinary", "body"); + } + + + // Path Params + const localVarPath = '/fake/body-with-binary'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "image/png" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "HttpFile", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + */ + public async testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'fileSchemaTestClass' is not null or undefined + if (fileSchemaTestClass === null || fileSchemaTestClass === undefined) { + throw new RequiredError("FakeApi", "testBodyWithFileSchema", "fileSchemaTestClass"); + } + + + // Path Params + const localVarPath = '/fake/body-with-file-schema'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(fileSchemaTestClass, "FileSchemaTestClass", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * @param query + * @param user + */ + public async testBodyWithQueryParams(query: string, user: User, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'query' is not null or undefined + if (query === null || query === undefined) { + throw new RequiredError("FakeApi", "testBodyWithQueryParams", "query"); + } + + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("FakeApi", "testBodyWithQueryParams", "user"); + } + + + // Path Params + const localVarPath = '/fake/body-with-query-params'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (query !== undefined) { + requestContext.setQueryParam("query", ObjectSerializer.serialize(query, "string", "")); + } + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "User", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model + */ + public async testClientModel(client: Client, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'client' is not null or undefined + if (client === null || client === undefined) { + throw new RequiredError("FakeApi", "testClientModel", "client"); + } + + + // Path Params + const localVarPath = '/fake'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(client, "Client", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param _double None + * @param patternWithoutDelimiter None + * @param _byte None + * @param integer None + * @param int32 None + * @param int64 None + * @param _float None + * @param string None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @param callback None + */ + public async testEndpointParameters(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: HttpFile, date?: string, dateTime?: Date, password?: string, callback?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'number' is not null or undefined + if (number === null || number === undefined) { + throw new RequiredError("FakeApi", "testEndpointParameters", "number"); + } + + + // verify required parameter '_double' is not null or undefined + if (_double === null || _double === undefined) { + throw new RequiredError("FakeApi", "testEndpointParameters", "_double"); + } + + + // verify required parameter 'patternWithoutDelimiter' is not null or undefined + if (patternWithoutDelimiter === null || patternWithoutDelimiter === undefined) { + throw new RequiredError("FakeApi", "testEndpointParameters", "patternWithoutDelimiter"); + } + + + // verify required parameter '_byte' is not null or undefined + if (_byte === null || _byte === undefined) { + throw new RequiredError("FakeApi", "testEndpointParameters", "_byte"); + } + + + + + + + + + + + + + // Path Params + const localVarPath = '/fake'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'application/x-www-form-urlencoded', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (integer !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('integer', integer as any); + } + if (int32 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('int32', int32 as any); + } + if (int64 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('int64', int64 as any); + } + if (number !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('number', number as any); + } + if (_float !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('float', _float as any); + } + if (_double !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('double', _double as any); + } + if (string !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('string', string as any); + } + if (patternWithoutDelimiter !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('pattern_without_delimiter', patternWithoutDelimiter as any); + } + if (_byte !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('byte', _byte as any); + } + if (binary !== undefined) { + // TODO: replace .append with .set + if (localVarFormParams instanceof FormData) { + localVarFormParams.append('binary', binary.data, binary.name); + } + } + if (date !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('date', date as any); + } + if (dateTime !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('dateTime', dateTime as any); + } + if (password !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('password', password as any); + } + if (callback !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('callback', callback as any); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/x-www-form-urlencoded" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["http_basic_test"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @param enumQueryModelArray + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + */ + public async testEnumParameters(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumQueryModelArray?: Array, enumFormStringArray?: Array, enumFormString?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + + + + + + + + + + // Path Params + const localVarPath = '/fake'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (enumQueryStringArray !== undefined) { + const serializedParams = ObjectSerializer.serialize(enumQueryStringArray, "Array<'>' | '$'>", ""); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("enum_query_string_array", serializedParam); + } + } + + // Query Params + if (enumQueryString !== undefined) { + requestContext.setQueryParam("enum_query_string", ObjectSerializer.serialize(enumQueryString, "'_abc' | '-efg' | '(xyz)'", "")); + } + + // Query Params + if (enumQueryInteger !== undefined) { + requestContext.setQueryParam("enum_query_integer", ObjectSerializer.serialize(enumQueryInteger, "1 | -2", "int32")); + } + + // Query Params + if (enumQueryDouble !== undefined) { + requestContext.setQueryParam("enum_query_double", ObjectSerializer.serialize(enumQueryDouble, "1.1 | -1.2", "double")); + } + + // Query Params + if (enumQueryModelArray !== undefined) { + const serializedParams = ObjectSerializer.serialize(enumQueryModelArray, "Array", ""); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("enum_query_model_array", serializedParam); + } + } + + // Header Params + requestContext.setHeaderParam("enum_header_string_array", ObjectSerializer.serialize(enumHeaderStringArray, "Array<'>' | '$'>", "")); + + // Header Params + requestContext.setHeaderParam("enum_header_string", ObjectSerializer.serialize(enumHeaderString, "'_abc' | '-efg' | '(xyz)'", "")); + + // Form Params + const useForm = canConsumeForm([ + 'application/x-www-form-urlencoded', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (enumFormStringArray) { + // TODO: replace .append with .set + localVarFormParams.append('enum_form_string_array', enumFormStringArray.join(COLLECTION_FORMATS["csv"])); + } + if (enumFormString !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('enum_form_string', enumFormString as any); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/x-www-form-urlencoded" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters + * @param booleanGroup Boolean in group parameters + * @param int64Group Integer in group parameters + */ + public async testGroupParameters(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'requiredStringGroup' is not null or undefined + if (requiredStringGroup === null || requiredStringGroup === undefined) { + throw new RequiredError("FakeApi", "testGroupParameters", "requiredStringGroup"); + } + + + // verify required parameter 'requiredBooleanGroup' is not null or undefined + if (requiredBooleanGroup === null || requiredBooleanGroup === undefined) { + throw new RequiredError("FakeApi", "testGroupParameters", "requiredBooleanGroup"); + } + + + // verify required parameter 'requiredInt64Group' is not null or undefined + if (requiredInt64Group === null || requiredInt64Group === undefined) { + throw new RequiredError("FakeApi", "testGroupParameters", "requiredInt64Group"); + } + + + + + + // Path Params + const localVarPath = '/fake'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (requiredStringGroup !== undefined) { + requestContext.setQueryParam("required_string_group", ObjectSerializer.serialize(requiredStringGroup, "number", "")); + } + + // Query Params + if (requiredInt64Group !== undefined) { + requestContext.setQueryParam("required_int64_group", ObjectSerializer.serialize(requiredInt64Group, "number", "int64")); + } + + // Query Params + if (stringGroup !== undefined) { + requestContext.setQueryParam("string_group", ObjectSerializer.serialize(stringGroup, "number", "")); + } + + // Query Params + if (int64Group !== undefined) { + requestContext.setQueryParam("int64_group", ObjectSerializer.serialize(int64Group, "number", "int64")); + } + + // Header Params + requestContext.setHeaderParam("required_boolean_group", ObjectSerializer.serialize(requiredBooleanGroup, "boolean", "")); + + // Header Params + requestContext.setHeaderParam("boolean_group", ObjectSerializer.serialize(booleanGroup, "boolean", "")); + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["bearer_test"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * test inline additionalProperties + * @param requestBody request body + */ + public async testInlineAdditionalProperties(requestBody: { [key: string]: string; }, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'requestBody' is not null or undefined + if (requestBody === null || requestBody === undefined) { + throw new RequiredError("FakeApi", "testInlineAdditionalProperties", "requestBody"); + } + + + // Path Params + const localVarPath = '/fake/inline-additionalProperties'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(requestBody, "{ [key: string]: string; }", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * test json serialization of form data + * @param param field1 + * @param param2 field2 + */ + public async testJsonFormData(param: string, param2: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'param' is not null or undefined + if (param === null || param === undefined) { + throw new RequiredError("FakeApi", "testJsonFormData", "param"); + } + + + // verify required parameter 'param2' is not null or undefined + if (param2 === null || param2 === undefined) { + throw new RequiredError("FakeApi", "testJsonFormData", "param2"); + } + + + // Path Params + const localVarPath = '/fake/jsonFormData'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'application/x-www-form-urlencoded', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (param !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('param', param as any); + } + if (param2 !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('param2', param2 as any); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/x-www-form-urlencoded" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language + */ + public async testQueryParameterCollectionFormat(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, allowEmpty: string, language?: { [key: string]: string; }, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pipe' is not null or undefined + if (pipe === null || pipe === undefined) { + throw new RequiredError("FakeApi", "testQueryParameterCollectionFormat", "pipe"); + } + + + // verify required parameter 'ioutil' is not null or undefined + if (ioutil === null || ioutil === undefined) { + throw new RequiredError("FakeApi", "testQueryParameterCollectionFormat", "ioutil"); + } + + + // verify required parameter 'http' is not null or undefined + if (http === null || http === undefined) { + throw new RequiredError("FakeApi", "testQueryParameterCollectionFormat", "http"); + } + + + // verify required parameter 'url' is not null or undefined + if (url === null || url === undefined) { + throw new RequiredError("FakeApi", "testQueryParameterCollectionFormat", "url"); + } + + + // verify required parameter 'context' is not null or undefined + if (context === null || context === undefined) { + throw new RequiredError("FakeApi", "testQueryParameterCollectionFormat", "context"); + } + + + // verify required parameter 'allowEmpty' is not null or undefined + if (allowEmpty === null || allowEmpty === undefined) { + throw new RequiredError("FakeApi", "testQueryParameterCollectionFormat", "allowEmpty"); + } + + + + // Path Params + const localVarPath = '/fake/test-query-parameters'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (pipe !== undefined) { + requestContext.setQueryParam("pipe", ObjectSerializer.serialize(pipe, "Array", "")); + } + + // Query Params + if (ioutil !== undefined) { + requestContext.setQueryParam("ioutil", ObjectSerializer.serialize(ioutil, "Array", "")); + } + + // Query Params + if (http !== undefined) { + requestContext.setQueryParam("http", ObjectSerializer.serialize(http, "Array", "")); + } + + // Query Params + if (url !== undefined) { + requestContext.setQueryParam("url", ObjectSerializer.serialize(url, "Array", "")); + } + + // Query Params + if (context !== undefined) { + const serializedParams = ObjectSerializer.serialize(context, "Array", ""); + for (const serializedParam of serializedParams) { + requestContext.appendQueryParam("context", serializedParam); + } + } + + // Query Params + if (language !== undefined) { + const serializedParams = ObjectSerializer.serialize(language, "{ [key: string]: string; }", "string"); + for (const key of Object.keys(serializedParams)) { + requestContext.setQueryParam(key, serializedParams[key]); + } + } + + // Query Params + if (allowEmpty !== undefined) { + requestContext.setQueryParam("allowEmpty", ObjectSerializer.serialize(allowEmpty, "string", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class FakeApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeBigDecimalMap + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeBigDecimalMapWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: FakeBigDecimalMap200Response = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FakeBigDecimalMap200Response", "" + ) as FakeBigDecimalMap200Response; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: FakeBigDecimalMap200Response = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "FakeBigDecimalMap200Response", "" + ) as FakeBigDecimalMap200Response; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeHealthGet + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeHealthGetWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: HealthCheckResult = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "HealthCheckResult", "" + ) as HealthCheckResult; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: HealthCheckResult = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "HealthCheckResult", "" + ) as HealthCheckResult; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeHttpSignatureTest + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeHttpSignatureTestWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeOuterBooleanSerialize + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeOuterBooleanSerializeWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: boolean = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "boolean", "" + ) as boolean; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: boolean = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "boolean", "" + ) as boolean; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeOuterCompositeSerialize + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeOuterCompositeSerializeWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: OuterComposite = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OuterComposite", "" + ) as OuterComposite; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OuterComposite = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OuterComposite", "" + ) as OuterComposite; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeOuterNumberSerialize + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeOuterNumberSerializeWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: number = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "number", "" + ) as number; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: number = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "number", "" + ) as number; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakeOuterStringSerialize + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakeOuterStringSerializeWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: string = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "string", "" + ) as string; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: string = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "string", "" + ) as string; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to fakePropertyEnumIntegerSerialize + * @throws ApiException if the response code was not in [200, 299] + */ + public async fakePropertyEnumIntegerSerializeWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: OuterObjectWithEnumProperty = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OuterObjectWithEnumProperty", "" + ) as OuterObjectWithEnumProperty; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OuterObjectWithEnumProperty = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "OuterObjectWithEnumProperty", "" + ) as OuterObjectWithEnumProperty; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testBodyWithBinary + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBodyWithBinaryWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testBodyWithFileSchema + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBodyWithFileSchemaWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testBodyWithQueryParams + * @throws ApiException if the response code was not in [200, 299] + */ + public async testBodyWithQueryParamsWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testClientModel + * @throws ApiException if the response code was not in [200, 299] + */ + public async testClientModelWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Client = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Client", "" + ) as Client; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Client = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Client", "" + ) as Client; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testEndpointParameters + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEndpointParametersWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testEnumParameters + * @throws ApiException if the response code was not in [200, 299] + */ + public async testEnumParametersWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid request", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testGroupParameters + * @throws ApiException if the response code was not in [200, 299] + */ + public async testGroupParametersWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Something wrong", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testInlineAdditionalProperties + * @throws ApiException if the response code was not in [200, 299] + */ + public async testInlineAdditionalPropertiesWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testJsonFormData + * @throws ApiException if the response code was not in [200, 299] + */ + public async testJsonFormDataWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testQueryParameterCollectionFormat + * @throws ApiException if the response code was not in [200, 299] + */ + public async testQueryParameterCollectionFormatWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeClassnameTags123Api.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeClassnameTags123Api.ts new file mode 100644 index 000000000000..fb090d1cf66e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/FakeClassnameTags123Api.ts @@ -0,0 +1,101 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { Client } from '../models/Client'; + +/** + * no description + */ +export class FakeClassnameTags123ApiRequestFactory extends BaseAPIRequestFactory { + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model + */ + public async testClassname(client: Client, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'client' is not null or undefined + if (client === null || client === undefined) { + throw new RequiredError("FakeClassnameTags123Api", "testClassname", "client"); + } + + + // Path Params + const localVarPath = '/fake_classname_test'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PATCH); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(client, "Client", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key_query"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class FakeClassnameTags123ApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to testClassname + * @throws ApiException if the response code was not in [200, 299] + */ + public async testClassnameWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Client = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Client", "" + ) as Client; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Client = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Client", "" + ) as Client; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/PetApi.ts new file mode 100644 index 000000000000..09f3ca2f6adf --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/PetApi.ts @@ -0,0 +1,787 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { ApiResponse } from '../models/ApiResponse'; +import { Pet } from '../models/Pet'; + +/** + * no description + */ +export class PetApiRequestFactory extends BaseAPIRequestFactory { + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public async addPet(pet: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError("PetApi", "addPet", "pet"); + } + + + // Path Params + const localVarPath = '/pet'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + + "application/xml" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public async deletePet(petId: number, apiKey?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "deletePet", "petId"); + } + + + + // Path Params + const localVarPath = '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Header Params + requestContext.setHeaderParam("api_key", ObjectSerializer.serialize(apiKey, "string", "")); + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError("PetApi", "findPetsByStatus", "status"); + } + + + // Path Params + const localVarPath = '/pet/findByStatus'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (status !== undefined) { + requestContext.setQueryParam("status", ObjectSerializer.serialize(status, "Array<'available' | 'pending' | 'sold'>", "")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public async findPetsByTags(tags: Set, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError("PetApi", "findPetsByTags", "tags"); + } + + + // Path Params + const localVarPath = '/pet/findByTags'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (tags !== undefined) { + requestContext.setQueryParam("tags", ObjectSerializer.serialize(tags, "Set", "")); + } + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public async getPetById(petId: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "getPetById", "petId"); + } + + + // Path Params + const localVarPath = '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public async updatePet(pet: Pet, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError("PetApi", "updatePet", "pet"); + } + + + // Path Params + const localVarPath = '/pet'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + + "application/xml" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(pet, "Pet", ""), + contentType + ); + requestContext.setBody(serializedBody); + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public async updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "updatePetWithForm", "petId"); + } + + + + + // Path Params + const localVarPath = '/pet/{petId}' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'application/x-www-form-urlencoded', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (name !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('name', name as any); + } + if (status !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('status', status as any); + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/x-www-form-urlencoded" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public async uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "uploadFile", "petId"); + } + + + + + // Path Params + const localVarPath = '/pet/{petId}/uploadImage' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'multipart/form-data', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (additionalMetadata !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('additionalMetadata', additionalMetadata as any); + } + if (file !== undefined) { + // TODO: replace .append with .set + if (localVarFormParams instanceof FormData) { + localVarFormParams.append('file', file.data, file.name); + } + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * uploads an image (required) + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server + */ + public async uploadFileWithRequiredFile(petId: number, requiredFile: HttpFile, additionalMetadata?: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError("PetApi", "uploadFileWithRequiredFile", "petId"); + } + + + // verify required parameter 'requiredFile' is not null or undefined + if (requiredFile === null || requiredFile === undefined) { + throw new RequiredError("PetApi", "uploadFileWithRequiredFile", "requiredFile"); + } + + + + // Path Params + const localVarPath = '/fake/{petId}/uploadImageWithRequiredFile' + .replace('{' + 'petId' + '}', encodeURIComponent(String(petId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Form Params + const useForm = canConsumeForm([ + 'multipart/form-data', + ]); + + let localVarFormParams + if (useForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new URLSearchParams(); + } + + if (additionalMetadata !== undefined) { + // TODO: replace .append with .set + localVarFormParams.append('additionalMetadata', additionalMetadata as any); + } + if (requiredFile !== undefined) { + // TODO: replace .append with .set + if (localVarFormParams instanceof FormData) { + localVarFormParams.append('requiredFile', requiredFile.data, requiredFile.name); + } + } + + requestContext.setBody(localVarFormParams); + + if(!useForm) { + const contentType = ObjectSerializer.getPreferredMediaType([ + "multipart/form-data" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + } + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["petstore_auth"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class PetApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to addPet + * @throws ApiException if the response code was not in [200, 299] + */ + public async addPetWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + if (isCodeInRange("405", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deletePet + * @throws ApiException if the response code was not in [200, 299] + */ + public async deletePetWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid pet value", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to findPetsByStatus + * @throws ApiException if the response code was not in [200, 299] + */ + public async findPetsByStatusWithHttpInfo(response: ResponseContext): Promise >> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", "" + ) as Array; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid status value", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Array = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Array", "" + ) as Array; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to findPetsByTags + * @throws ApiException if the response code was not in [200, 299] + */ + public async findPetsByTagsWithHttpInfo(response: ResponseContext): Promise >> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Set = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Set", "" + ) as Set; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid tag value", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Set = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Set", "" + ) as Set; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getPetById + * @throws ApiException if the response code was not in [200, 299] + */ + public async getPetByIdWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Pet not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Pet = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Pet", "" + ) as Pet; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updatePet + * @throws ApiException if the response code was not in [200, 299] + */ + public async updatePetWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Pet not found", undefined, response.headers); + } + if (isCodeInRange("405", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Validation exception", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updatePetWithForm + * @throws ApiException if the response code was not in [200, 299] + */ + public async updatePetWithFormWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + if (isCodeInRange("405", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid input", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", "" + ) as void; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to uploadFile + * @throws ApiException if the response code was not in [200, 299] + */ + public async uploadFileWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ApiResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ApiResponse", "" + ) as ApiResponse; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ApiResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ApiResponse", "" + ) as ApiResponse; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to uploadFileWithRequiredFile + * @throws ApiException if the response code was not in [200, 299] + */ + public async uploadFileWithRequiredFileWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: ApiResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ApiResponse", "" + ) as ApiResponse; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ApiResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ApiResponse", "" + ) as ApiResponse; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/StoreApi.ts new file mode 100644 index 000000000000..129ccfed17b1 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/StoreApi.ts @@ -0,0 +1,280 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { Order } from '../models/Order'; + +/** + * no description + */ +export class StoreApiRequestFactory extends BaseAPIRequestFactory { + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public async deleteOrder(orderId: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError("StoreApi", "deleteOrder", "orderId"); + } + + + // Path Params + const localVarPath = '/store/order/{order_id}' + .replace('{' + 'order_id' + '}', encodeURIComponent(String(orderId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public async getInventory(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/store/inventory'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + let authMethod: SecurityAuthentication | undefined; + // Apply auth methods + authMethod = _config.authMethods["api_key"] + if (authMethod?.applySecurityAuthentication) { + await authMethod?.applySecurityAuthentication(requestContext); + } + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public async getOrderById(orderId: number, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError("StoreApi", "getOrderById", "orderId"); + } + + + // Path Params + const localVarPath = '/store/order/{order_id}' + .replace('{' + 'order_id' + '}', encodeURIComponent(String(orderId))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public async placeOrder(order: Order, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError("StoreApi", "placeOrder", "order"); + } + + + // Path Params + const localVarPath = '/store/order'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(order, "Order", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class StoreApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteOrder + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteOrderWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Order not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getInventory + * @throws ApiException if the response code was not in [200, 299] + */ + public async getInventoryWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: { [key: string]: number; } = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "{ [key: string]: number; }", "int32" + ) as { [key: string]: number; }; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: { [key: string]: number; } = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "{ [key: string]: number; }", "int32" + ) as { [key: string]: number; }; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getOrderById + * @throws ApiException if the response code was not in [200, 299] + */ + public async getOrderByIdWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid ID supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Order not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to placeOrder + * @throws ApiException if the response code was not in [200, 299] + */ + public async placeOrderWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid Order", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: Order = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "Order", "" + ) as Order; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/UserApi.ts new file mode 100644 index 000000000000..da60fbe50ff2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/UserApi.ts @@ -0,0 +1,535 @@ +// TODO: better import syntax? +import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; +import {Configuration} from '../configuration'; +import {RequestContext, HttpMethod, ResponseContext, HttpFile, HttpInfo} from '../http/http'; +import * as FormData from "form-data"; +import { URLSearchParams } from 'url'; +import {ObjectSerializer} from '../models/ObjectSerializer'; +import {ApiException} from './exception'; +import {canConsumeForm, isCodeInRange} from '../util'; +import {SecurityAuthentication} from '../auth/auth'; + + +import { User } from '../models/User'; + +/** + * no description + */ +export class UserApiRequestFactory extends BaseAPIRequestFactory { + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public async createUser(user: User, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "createUser", "user"); + } + + + // Path Params + const localVarPath = '/user'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "User", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public async createUsersWithArrayInput(user: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "createUsersWithArrayInput", "user"); + } + + + // Path Params + const localVarPath = '/user/createWithArray'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "Array", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public async createUsersWithListInput(user: Array, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "createUsersWithListInput", "user"); + } + + + // Path Params + const localVarPath = '/user/createWithList'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "Array", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public async deleteUser(username: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "deleteUser", "username"); + } + + + // Path Params + const localVarPath = '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.DELETE); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public async getUserByName(username: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "getUserByName", "username"); + } + + + // Path Params + const localVarPath = '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public async loginUser(username: string, password: string, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "loginUser", "username"); + } + + + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError("UserApi", "loginUser", "password"); + } + + + // Path Params + const localVarPath = '/user/login'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + // Query Params + if (username !== undefined) { + requestContext.setQueryParam("username", ObjectSerializer.serialize(username, "string", "")); + } + + // Query Params + if (password !== undefined) { + requestContext.setQueryParam("password", ObjectSerializer.serialize(password, "string", "")); + } + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * + * Logs out current logged in user session + */ + public async logoutUser(_options?: Configuration): Promise { + let _config = _options || this.configuration; + + // Path Params + const localVarPath = '/user/logout'; + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public async updateUser(username: string, user: User, _options?: Configuration): Promise { + let _config = _options || this.configuration; + + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError("UserApi", "updateUser", "username"); + } + + + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError("UserApi", "updateUser", "user"); + } + + + // Path Params + const localVarPath = '/user/{username}' + .replace('{' + 'username' + '}', encodeURIComponent(String(username))); + + // Make Request Context + const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") + + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json" + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(user, "User", ""), + contentType + ); + requestContext.setBody(serializedBody); + + + const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default + if (defaultAuth?.applySecurityAuthentication) { + await defaultAuth?.applySecurityAuthentication(requestContext); + } + + return requestContext; + } + +} + +export class UserApiResponseProcessor { + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUserWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUsersWithArrayInput + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUsersWithArrayInputWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createUsersWithListInput + * @throws ApiException if the response code was not in [200, 299] + */ + public async createUsersWithListInputWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteUserWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getUserByName + * @throws ApiException if the response code was not in [200, 299] + */ + public async getUserByNameWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: User = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "User", "" + ) as User; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: User = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "User", "" + ) as User; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to loginUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async loginUserWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("200", response.httpStatusCode)) { + const body: string = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "string", "" + ) as string; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid username/password supplied", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: string = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "string", "" + ) as string; + return new HttpInfo(response.httpStatusCode, response.headers, response.body, body); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to logoutUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async logoutUserWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("0", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "successful operation", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateUser + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateUserWithHttpInfo(response: ResponseContext): Promise> { + const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); + if (isCodeInRange("400", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "Invalid user supplied", undefined, response.headers); + } + if (isCodeInRange("404", response.httpStatusCode)) { + throw new ApiException(response.httpStatusCode, "User not found", undefined, response.headers); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return new HttpInfo(response.httpStatusCode, response.headers, response.body, undefined); + } + + throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/baseapi.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/baseapi.ts new file mode 100644 index 000000000000..ce1e2dbc47e1 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/baseapi.ts @@ -0,0 +1,37 @@ +import { Configuration } from '../configuration' + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPIRequestFactory { + + constructor(protected configuration: Configuration) { + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public api: string, public method: string, public field: string) { + super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + "."); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/exception.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/exception.ts new file mode 100644 index 000000000000..9365d33a8f7e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/apis/exception.ts @@ -0,0 +1,15 @@ +/** + * Represents an error caused by an api call i.e. it has attributes for a HTTP status code + * and the returned body object. + * + * Example + * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299] + * => ApiException(404, someErrorMessageObject) + * + */ +export class ApiException extends Error { + public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) { + super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " + + JSON.stringify(headers)) + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/auth/auth.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/auth/auth.ts new file mode 100644 index 000000000000..7060d386569d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/auth/auth.ts @@ -0,0 +1,217 @@ +import { RequestContext } from "../http/http"; + +/** + * Interface authentication schemes. + */ +export interface SecurityAuthentication { + /* + * @return returns the name of the security authentication as specified in OAI + */ + getName(): string; + + /** + * Applies the authentication scheme to the request context + * + * @params context the request context which should use this authentication scheme + */ + applySecurityAuthentication(context: RequestContext): void | Promise; +} + +export interface TokenProvider { + getToken(): Promise | string; +} + +/** + * Applies oauth2 authentication to the request context. + */ +export class PetstoreAuthAuthentication implements SecurityAuthentication { + /** + * Configures OAuth2 with the necessary properties + * + * @param accessToken: The access token to be used for every request + */ + public constructor(private accessToken: string) {} + + public getName(): string { + return "petstore_auth"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("Authorization", "Bearer " + this.accessToken); + } +} + +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("api_key", this.apiKey); + } +} + +/** + * Applies apiKey authentication to the request context. + */ +export class ApiKeyQueryAuthentication implements SecurityAuthentication { + /** + * Configures this api key authentication with the necessary properties + * + * @param apiKey: The api key to be used for every request + */ + public constructor(private apiKey: string) {} + + public getName(): string { + return "api_key_query"; + } + + public applySecurityAuthentication(context: RequestContext) { + context.setQueryParam("api_key_query", this.apiKey); + } +} + +/** + * Applies http authentication to the request context. + */ +export class HttpBasicTestAuthentication implements SecurityAuthentication { + /** + * Configures the http authentication with the required details. + * + * @param username username for http basic authentication + * @param password password for http basic authentication + */ + public constructor( + private username: string, + private password: string + ) {} + + public getName(): string { + return "http_basic_test"; + } + + public applySecurityAuthentication(context: RequestContext) { + let comb = Buffer.from(this.username + ":" + this.password, 'binary').toString('base64'); + context.setHeaderParam("Authorization", "Basic " + comb); + } +} + +/** + * Applies http authentication to the request context. + */ +export class BearerTestAuthentication implements SecurityAuthentication { + /** + * Configures the http authentication with the required details. + * + * @param tokenProvider service that can provide the up-to-date token when needed + */ + public constructor(private tokenProvider: TokenProvider) {} + + public getName(): string { + return "bearer_test"; + } + + public async applySecurityAuthentication(context: RequestContext) { + context.setHeaderParam("Authorization", "Bearer " + await this.tokenProvider.getToken()); + } +} + +/** + * Applies http authentication to the request context. + */ +export class HttpSignatureTestAuthentication implements SecurityAuthentication { + + public getName(): string { + return "http_signature_test"; + } + + public applySecurityAuthentication(context: RequestContext) { + } +} + + +export type AuthMethods = { + "default"?: SecurityAuthentication, + "petstore_auth"?: SecurityAuthentication, + "api_key"?: SecurityAuthentication, + "api_key_query"?: SecurityAuthentication, + "http_basic_test"?: SecurityAuthentication, + "bearer_test"?: SecurityAuthentication, + "http_signature_test"?: SecurityAuthentication +} + +export type ApiKeyConfiguration = string; +export type HttpBasicConfiguration = { "username": string, "password": string }; +export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; +export type OAuth2Configuration = { accessToken: string }; + +export type AuthMethodsConfiguration = { + "default"?: SecurityAuthentication, + "petstore_auth"?: OAuth2Configuration, + "api_key"?: ApiKeyConfiguration, + "api_key_query"?: ApiKeyConfiguration, + "http_basic_test"?: HttpBasicConfiguration, + "bearer_test"?: HttpBearerConfiguration, + "http_signature_test"?: +} + +/** + * Creates the authentication methods from a swagger description. + * + */ +export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods { + let authMethods: AuthMethods = {} + + if (!config) { + return authMethods; + } + authMethods["default"] = config["default"] + + if (config["petstore_auth"]) { + authMethods["petstore_auth"] = new PetstoreAuthAuthentication( + config["petstore_auth"]["accessToken"] + ); + } + + if (config["api_key"]) { + authMethods["api_key"] = new ApiKeyAuthentication( + config["api_key"] + ); + } + + if (config["api_key_query"]) { + authMethods["api_key_query"] = new ApiKeyQueryAuthentication( + config["api_key_query"] + ); + } + + if (config["http_basic_test"]) { + authMethods["http_basic_test"] = new HttpBasicTestAuthentication( + config["http_basic_test"]["username"], + config["http_basic_test"]["password"] + ); + } + + if (config["bearer_test"]) { + authMethods["bearer_test"] = new BearerTestAuthentication( + config["bearer_test"]["tokenProvider"] + ); + } + + if (config["http_signature_test"]) { + authMethods["http_signature_test"] = new HttpSignatureTestAuthentication( + ); + } + + return authMethods; +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/configuration.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/configuration.ts new file mode 100644 index 000000000000..7acb56e66477 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/configuration.ts @@ -0,0 +1,82 @@ +import { HttpLibrary } from "./http/http"; +import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware"; +import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch"; +import { BaseServerConfiguration, server1 } from "./servers"; +import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth"; + +export interface Configuration { + readonly baseServer: BaseServerConfiguration; + readonly httpApi: HttpLibrary; + readonly middleware: Middleware[]; + readonly authMethods: AuthMethods; +} + + +/** + * Interface with which a configuration object can be configured. + */ +export interface ConfigurationParameters { + /** + * Default server to use - a list of available servers (according to the + * OpenAPI yaml definition) is included in the `servers` const in `./servers`. You can also + * create your own server with the `ServerConfiguration` class from the same + * file. + */ + baseServer?: BaseServerConfiguration; + /** + * HTTP library to use e.g. IsomorphicFetch. This can usually be skipped as + * all generators come with a default library. + * If available, additional libraries can be imported from `./http/*` + */ + httpApi?: HttpLibrary; + + /** + * The middlewares which will be applied to requests and responses. You can + * add any number of middleware components to modify requests before they + * are sent or before they are deserialized by implementing the `Middleware` + * interface defined in `./middleware` + */ + middleware?: Middleware[]; + /** + * Configures middleware functions that return promises instead of + * Observables (which are used by `middleware`). Otherwise allows for the + * same functionality as `middleware`, i.e., modifying requests before they + * are sent and before they are deserialized. + */ + promiseMiddleware?: PromiseMiddleware[]; + /** + * Configuration for the available authentication methods (e.g., api keys) + * according to the OpenAPI yaml definition. For the definition, please refer to + * `./auth/auth` + */ + authMethods?: AuthMethodsConfiguration +} + +/** + * Provide your `ConfigurationParameters` to this function to get a `Configuration` + * object that can be used to configure your APIs (in the constructor or + * for each request individually). + * + * If a property is not included in conf, a default is used: + * - baseServer: server1 + * - httpApi: IsomorphicFetchHttpLibrary + * - middleware: [] + * - promiseMiddleware: [] + * - authMethods: {} + * + * @param conf partial configuration + */ +export function createConfiguration(conf: ConfigurationParameters = {}): Configuration { + const configuration: Configuration = { + baseServer: conf.baseServer !== undefined ? conf.baseServer : server1, + httpApi: conf.httpApi || new DefaultHttpLibrary(), + middleware: conf.middleware || [], + authMethods: configureAuthMethods(conf.authMethods) + }; + if (conf.promiseMiddleware) { + conf.promiseMiddleware.forEach( + m => configuration.middleware.push(new PromiseMiddlewareWrapper(m)) + ); + } + return configuration; +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/git_push.sh b/samples/openapi3/client/petstore/typescript/builds/explode-query/git_push.sh new file mode 100644 index 000000000000..b253029754ed --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/git_push.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts new file mode 100644 index 000000000000..38fad4135e05 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts @@ -0,0 +1,251 @@ +// TODO: evaluate if we can easily get rid of this library +import * as FormData from "form-data"; +import { URL, URLSearchParams } from 'url'; +import * as http from 'http'; +import * as https from 'https'; +import { Observable, from } from '../rxjsStub'; + +export * from './isomorphic-fetch'; + +/** + * Represents an HTTP method. + */ +export enum HttpMethod { + GET = "GET", + HEAD = "HEAD", + POST = "POST", + PUT = "PUT", + DELETE = "DELETE", + CONNECT = "CONNECT", + OPTIONS = "OPTIONS", + TRACE = "TRACE", + PATCH = "PATCH" +} + +/** + * Represents an HTTP file which will be transferred from or to a server. + */ +export type HttpFile = { + data: Buffer, + name: string +}; + +export class HttpException extends Error { + public constructor(msg: string) { + super(msg); + } +} + +/** + * Represents the body of an outgoing HTTP request. + */ +export type RequestBody = undefined | string | FormData | URLSearchParams; + +function ensureAbsoluteUrl(url: string) { + if (url.startsWith("http://") || url.startsWith("https://")) { + return url; + } + throw new Error("You need to define an absolute base url for the server."); +} + +/** + * Represents an HTTP request context + */ +export class RequestContext { + private headers: { [key: string]: string } = {}; + private body: RequestBody = undefined; + private url: URL; + private agent: http.Agent | https.Agent | undefined = undefined; + + /** + * Creates the request context using a http method and request resource url + * + * @param url url of the requested resource + * @param httpMethod http method + */ + public constructor(url: string, private httpMethod: HttpMethod) { + this.url = new URL(ensureAbsoluteUrl(url)); + } + + /* + * Returns the url set in the constructor including the query string + * + */ + public getUrl(): string { + return this.url.toString().endsWith("/") ? + this.url.toString().slice(0, -1) + : this.url.toString(); + } + + /** + * Replaces the url set in the constructor with this url. + * + */ + public setUrl(url: string) { + this.url = new URL(ensureAbsoluteUrl(url)); + } + + /** + * Sets the body of the http request either as a string or FormData + * + * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE + * request is discouraged. + * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1 + * + * @param body the body of the request + */ + public setBody(body: RequestBody) { + this.body = body; + } + + public getHttpMethod(): HttpMethod { + return this.httpMethod; + } + + public getHeaders(): { [key: string]: string } { + return this.headers; + } + + public getBody(): RequestBody { + return this.body; + } + + public setQueryParam(name: string, value: string) { + this.url.searchParams.set(name, value); + } + + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + + /** + * Sets a cookie with the name and value. NO check for duplicate cookies is performed + * + */ + public addCookie(name: string, value: string): void { + if (!this.headers["Cookie"]) { + this.headers["Cookie"] = ""; + } + this.headers["Cookie"] += name + "=" + value + "; "; + } + + public setHeaderParam(key: string, value: string): void { + this.headers[key] = value; + } + + public setAgent(agent: http.Agent | https.Agent) { + this.agent = agent; + } + + public getAgent(): http.Agent | https.Agent | undefined { + return this.agent; + } +} + +export interface ResponseBody { + text(): Promise; + binary(): Promise; +} + +/** + * Helper class to generate a `ResponseBody` from binary data + */ +export class SelfDecodingBody implements ResponseBody { + constructor(private dataSource: Promise) {} + + binary(): Promise { + return this.dataSource; + } + + async text(): Promise { + const data: Buffer = await this.dataSource; + return data.toString(); + } +} + +export class ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody + ) {} + + /** + * Parse header value in the form `value; param1="value1"` + * + * E.g. for Content-Type or Content-Disposition + * Parameter names are converted to lower case + * The first parameter is returned with the key `""` + */ + public getParsedHeader(headerName: string): { [parameter: string]: string } { + const result: { [parameter: string]: string } = {}; + if (!this.headers[headerName]) { + return result; + } + + const parameters = this.headers[headerName].split(";"); + for (const parameter of parameters) { + let [key, value] = parameter.split("=", 2); + key = key.toLowerCase().trim(); + if (value === undefined) { + result[""] = key; + } else { + value = value.trim(); + if (value.startsWith('"') && value.endsWith('"')) { + value = value.substring(1, value.length - 1); + } + result[key] = value; + } + } + return result; + } + + public async getBodyAsFile(): Promise { + const data = await this.body.binary(); + const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; + return { data, name: fileName }; + } + + /** + * Use a heuristic to get a body of unknown data structure. + * Return as string if possible, otherwise as binary. + */ + public getBodyAsAny(): Promise { + try { + return this.body.text(); + } catch {} + + try { + return this.body.binary(); + } catch {} + + return Promise.resolve(undefined); + } +} + +export interface HttpLibrary { + send(request: RequestContext): Observable; +} + +export interface PromiseHttpLibrary { + send(request: RequestContext): Promise; +} + +export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { + return { + send(request: RequestContext): Observable { + return from(promiseHttpLibrary.send(request)); + } + } +} + +export class HttpInfo extends ResponseContext { + public constructor( + public httpStatusCode: number, + public headers: { [key: string]: string }, + public body: ResponseBody, + public data: T, + ) { + super(httpStatusCode, headers, body); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts new file mode 100644 index 000000000000..26d267cfc063 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts @@ -0,0 +1,32 @@ +import {HttpLibrary, RequestContext, ResponseContext} from './http'; +import { from, Observable } from '../rxjsStub'; +import fetch from "node-fetch"; + +export class IsomorphicFetchHttpLibrary implements HttpLibrary { + + public send(request: RequestContext): Observable { + let method = request.getHttpMethod().toString(); + let body = request.getBody(); + + const resultPromise = fetch(request.getUrl(), { + method: method, + body: body as any, + headers: request.getHeaders(), + agent: request.getAgent(), + }).then((resp: any) => { + const headers: { [name: string]: string } = {}; + resp.headers.forEach((value: string, name: string) => { + headers[name] = value; + }); + + const body = { + text: () => resp.text(), + binary: () => resp.buffer() + }; + return new ResponseContext(resp.status, headers, body); + }); + + return from>(resultPromise); + + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/index.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/index.ts new file mode 100644 index 000000000000..498de9b8a5ea --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/index.ts @@ -0,0 +1,12 @@ +export * from "./http/http"; +export * from "./auth/auth"; +export * from "./models/all"; +export { createConfiguration } from "./configuration" +export { Configuration } from "./configuration" +export * from "./apis/exception"; +export * from "./servers"; +export { RequiredError } from "./apis/baseapi"; + +export { PromiseMiddleware as Middleware } from './middleware'; +export { PromiseAnotherFakeApi as AnotherFakeApi, PromiseDefaultApi as DefaultApi, PromiseFakeApi as FakeApi, PromiseFakeClassnameTags123Api as FakeClassnameTags123Api, PromisePetApi as PetApi, PromiseStoreApi as StoreApi, PromiseUserApi as UserApi } from './types/PromiseAPI'; + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/middleware.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/middleware.ts new file mode 100644 index 000000000000..524f93f016b2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/middleware.ts @@ -0,0 +1,66 @@ +import {RequestContext, ResponseContext} from './http/http'; +import { Observable, from } from './rxjsStub'; + +/** + * Defines the contract for a middleware intercepting requests before + * they are sent (but after the RequestContext was created) + * and before the ResponseContext is unwrapped. + * + */ +export interface Middleware { + /** + * Modifies the request before the request is sent. + * + * @param context RequestContext of a request which is about to be sent to the server + * @returns an observable of the updated request context + * + */ + pre(context: RequestContext): Observable; + /** + * Modifies the returned response before it is deserialized. + * + * @param context ResponseContext of a sent request + * @returns an observable of the modified response context + */ + post(context: ResponseContext): Observable; +} + +export class PromiseMiddlewareWrapper implements Middleware { + + public constructor(private middleware: PromiseMiddleware) { + + } + + pre(context: RequestContext): Observable { + return from(this.middleware.pre(context)); + } + + post(context: ResponseContext): Observable { + return from(this.middleware.post(context)); + } + +} + +/** + * Defines the contract for a middleware intercepting requests before + * they are sent (but after the RequestContext was created) + * and before the ResponseContext is unwrapped. + * + */ +export interface PromiseMiddleware { + /** + * Modifies the request before the request is sent. + * + * @param context RequestContext of a request which is about to be sent to the server + * @returns an observable of the updated request context + * + */ + pre(context: RequestContext): Promise; + /** + * Modifies the returned response before it is deserialized. + * + * @param context ResponseContext of a sent request + * @returns an observable of the modified response context + */ + post(context: ResponseContext): Promise; +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/AdditionalPropertiesClass.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/AdditionalPropertiesClass.ts new file mode 100644 index 000000000000..b4bae2c85384 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/AdditionalPropertiesClass.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class AdditionalPropertiesClass { + 'mapProperty'?: { [key: string]: string; }; + 'mapOfMapProperty'?: { [key: string]: { [key: string]: string; }; }; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "mapProperty", + "baseName": "map_property", + "type": "{ [key: string]: string; }", + "format": "" + }, + { + "name": "mapOfMapProperty", + "baseName": "map_of_map_property", + "type": "{ [key: string]: { [key: string]: string; }; }", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AdditionalPropertiesClass.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/AllOfWithSingleRef.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/AllOfWithSingleRef.ts new file mode 100644 index 000000000000..b06e4ea6fed9 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/AllOfWithSingleRef.ts @@ -0,0 +1,46 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { SingleRefType } from '../models/SingleRefType'; +import { HttpFile } from '../http/http'; + +export class AllOfWithSingleRef { + 'username'?: string; + 'singleRefType'?: SingleRefType; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "username", + "baseName": "username", + "type": "string", + "format": "" + }, + { + "name": "singleRefType", + "baseName": "SingleRefType", + "type": "SingleRefType", + "format": "" + } ]; + + static getAttributeTypeMap() { + return AllOfWithSingleRef.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Animal.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Animal.ts new file mode 100644 index 000000000000..3de5b5215fa8 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Animal.ts @@ -0,0 +1,47 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Animal { + 'className': string; + 'color'?: string; + + static readonly discriminator: string | undefined = "className"; + + static readonly mapping: {[index: string]: string} | undefined = { + "CAT": "Cat", + "DOG": "Dog", + }; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "className", + "baseName": "class_name", + "type": "string", + "format": "" + }, + { + "name": "color", + "baseName": "color", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Animal.attributeTypeMap; + } + + public constructor() { + this.className = "Animal"; + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ApiResponse.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ApiResponse.ts new file mode 100644 index 000000000000..68663f287613 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ApiResponse.ts @@ -0,0 +1,50 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ApiResponse { + 'code'?: number; + 'type'?: string; + 'message'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "code", + "baseName": "code", + "type": "number", + "format": "int32" + }, + { + "name": "type", + "baseName": "type", + "type": "string", + "format": "" + }, + { + "name": "message", + "baseName": "message", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ApiResponse.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfArrayOfNumberOnly.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfArrayOfNumberOnly.ts new file mode 100644 index 000000000000..1e9a6043fc2d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfArrayOfNumberOnly.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ArrayOfArrayOfNumberOnly { + 'arrayArrayNumber'?: Array>; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "arrayArrayNumber", + "baseName": "ArrayArrayNumber", + "type": "Array>", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ArrayOfArrayOfNumberOnly.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfNumberOnly.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfNumberOnly.ts new file mode 100644 index 000000000000..8df04a7f8016 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayOfNumberOnly.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ArrayOfNumberOnly { + 'arrayNumber'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "arrayNumber", + "baseName": "ArrayNumber", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ArrayOfNumberOnly.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayTest.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayTest.ts new file mode 100644 index 000000000000..6b27fa292b1d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ArrayTest.ts @@ -0,0 +1,51 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ReadOnlyFirst } from '../models/ReadOnlyFirst'; +import { HttpFile } from '../http/http'; + +export class ArrayTest { + 'arrayOfString'?: Array; + 'arrayArrayOfInteger'?: Array>; + 'arrayArrayOfModel'?: Array>; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "arrayOfString", + "baseName": "array_of_string", + "type": "Array", + "format": "" + }, + { + "name": "arrayArrayOfInteger", + "baseName": "array_array_of_integer", + "type": "Array>", + "format": "int64" + }, + { + "name": "arrayArrayOfModel", + "baseName": "array_array_of_model", + "type": "Array>", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ArrayTest.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Capitalization.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Capitalization.ts new file mode 100644 index 000000000000..d468f2bbc67d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Capitalization.ts @@ -0,0 +1,74 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Capitalization { + 'smallCamel'?: string; + 'capitalCamel'?: string; + 'smallSnake'?: string; + 'capitalSnake'?: string; + 'sCAETHFlowPoints'?: string; + /** + * Name of the pet + */ + 'ATT_NAME'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "smallCamel", + "baseName": "smallCamel", + "type": "string", + "format": "" + }, + { + "name": "capitalCamel", + "baseName": "CapitalCamel", + "type": "string", + "format": "" + }, + { + "name": "smallSnake", + "baseName": "small_Snake", + "type": "string", + "format": "" + }, + { + "name": "capitalSnake", + "baseName": "Capital_Snake", + "type": "string", + "format": "" + }, + { + "name": "sCAETHFlowPoints", + "baseName": "SCA_ETH_Flow_Points", + "type": "string", + "format": "" + }, + { + "name": "ATT_NAME", + "baseName": "ATT_NAME", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Capitalization.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Cat.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Cat.ts new file mode 100644 index 000000000000..fad848ce82b6 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Cat.ts @@ -0,0 +1,38 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Animal } from '../models/Animal'; +import { HttpFile } from '../http/http'; + +export class Cat extends Animal { + 'declawed'?: boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "declawed", + "baseName": "declawed", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return super.getAttributeTypeMap().concat(Cat.attributeTypeMap); + } + + public constructor() { + super(); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Category.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Category.ts new file mode 100644 index 000000000000..c70345b198aa --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Category.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Category { + 'id'?: number; + 'name': string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Category.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ClassModel.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ClassModel.ts new file mode 100644 index 000000000000..05a609ba28e7 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ClassModel.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +/** +* Model for testing model with \"_class\" property +*/ +export class ClassModel { + '_class'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "_class", + "baseName": "_class", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ClassModel.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Client.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Client.ts new file mode 100644 index 000000000000..aff4177ab6c2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Client.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Client { + 'client'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "client", + "baseName": "client", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Client.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/DeprecatedObject.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/DeprecatedObject.ts new file mode 100644 index 000000000000..47ca7f4e5826 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/DeprecatedObject.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class DeprecatedObject { + 'name'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return DeprecatedObject.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Dog.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Dog.ts new file mode 100644 index 000000000000..9634cea5c3ea --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Dog.ts @@ -0,0 +1,38 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Animal } from '../models/Animal'; +import { HttpFile } from '../http/http'; + +export class Dog extends Animal { + 'breed'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "breed", + "baseName": "breed", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return super.getAttributeTypeMap().concat(Dog.attributeTypeMap); + } + + public constructor() { + super(); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumArrays.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumArrays.ts new file mode 100644 index 000000000000..dfb4cc2eee95 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumArrays.ts @@ -0,0 +1,53 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class EnumArrays { + 'justSymbol'?: EnumArraysJustSymbolEnum; + 'arrayEnum'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "justSymbol", + "baseName": "just_symbol", + "type": "EnumArraysJustSymbolEnum", + "format": "" + }, + { + "name": "arrayEnum", + "baseName": "array_enum", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EnumArrays.attributeTypeMap; + } + + public constructor() { + } +} + +export enum EnumArraysJustSymbolEnum { + GreaterThanOrEqualTo = '>=', + Dollar = '$' +} +export enum EnumArraysArrayEnumEnum { + Fish = 'fish', + Crab = 'crab' +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumClass.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumClass.ts new file mode 100644 index 000000000000..42ca4340d7d4 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumClass.ts @@ -0,0 +1,19 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export enum EnumClass { + Abc = '_abc', + Efg = '-efg', + Xyz = '(xyz)' +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumTest.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumTest.ts new file mode 100644 index 000000000000..805ec09e285b --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/EnumTest.ts @@ -0,0 +1,109 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { OuterEnum } from '../models/OuterEnum'; +import { OuterEnumDefaultValue } from '../models/OuterEnumDefaultValue'; +import { OuterEnumInteger } from '../models/OuterEnumInteger'; +import { OuterEnumIntegerDefaultValue } from '../models/OuterEnumIntegerDefaultValue'; +import { HttpFile } from '../http/http'; + +export class EnumTest { + 'enumString'?: EnumTestEnumStringEnum; + 'enumStringRequired': EnumTestEnumStringRequiredEnum; + 'enumInteger'?: EnumTestEnumIntegerEnum; + 'enumNumber'?: EnumTestEnumNumberEnum; + 'outerEnum'?: OuterEnum | null; + 'outerEnumInteger'?: OuterEnumInteger; + 'outerEnumDefaultValue'?: OuterEnumDefaultValue; + 'outerEnumIntegerDefaultValue'?: OuterEnumIntegerDefaultValue; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "enumString", + "baseName": "enum_string", + "type": "EnumTestEnumStringEnum", + "format": "" + }, + { + "name": "enumStringRequired", + "baseName": "enum_string_required", + "type": "EnumTestEnumStringRequiredEnum", + "format": "" + }, + { + "name": "enumInteger", + "baseName": "enum_integer", + "type": "EnumTestEnumIntegerEnum", + "format": "int32" + }, + { + "name": "enumNumber", + "baseName": "enum_number", + "type": "EnumTestEnumNumberEnum", + "format": "double" + }, + { + "name": "outerEnum", + "baseName": "outerEnum", + "type": "OuterEnum", + "format": "" + }, + { + "name": "outerEnumInteger", + "baseName": "outerEnumInteger", + "type": "OuterEnumInteger", + "format": "" + }, + { + "name": "outerEnumDefaultValue", + "baseName": "outerEnumDefaultValue", + "type": "OuterEnumDefaultValue", + "format": "" + }, + { + "name": "outerEnumIntegerDefaultValue", + "baseName": "outerEnumIntegerDefaultValue", + "type": "OuterEnumIntegerDefaultValue", + "format": "" + } ]; + + static getAttributeTypeMap() { + return EnumTest.attributeTypeMap; + } + + public constructor() { + } +} + +export enum EnumTestEnumStringEnum { + Upper = 'UPPER', + Lower = 'lower', + Empty = '' +} +export enum EnumTestEnumStringRequiredEnum { + Upper = 'UPPER', + Lower = 'lower', + Empty = '' +} +export enum EnumTestEnumIntegerEnum { + NUMBER_1 = 1, + NUMBER_MINUS_1 = -1 +} +export enum EnumTestEnumNumberEnum { + NUMBER_1_DOT_1 = 1.1, + NUMBER_MINUS_1_DOT_2 = -1.2 +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FakeBigDecimalMap200Response.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FakeBigDecimalMap200Response.ts new file mode 100644 index 000000000000..a9cf4595fb7b --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FakeBigDecimalMap200Response.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class FakeBigDecimalMap200Response { + 'someId'?: number; + 'someMap'?: { [key: string]: number; }; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "someId", + "baseName": "someId", + "type": "number", + "format": "" + }, + { + "name": "someMap", + "baseName": "someMap", + "type": "{ [key: string]: number; }", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FakeBigDecimalMap200Response.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FileSchemaTestClass.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FileSchemaTestClass.ts new file mode 100644 index 000000000000..f6fe132a51de --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FileSchemaTestClass.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class FileSchemaTestClass { + 'file'?: any; + 'files'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "file", + "baseName": "file", + "type": "any", + "format": "" + }, + { + "name": "files", + "baseName": "files", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FileSchemaTestClass.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Foo.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Foo.ts new file mode 100644 index 000000000000..22bc2bd58929 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Foo.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Foo { + 'bar'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "bar", + "baseName": "bar", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Foo.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FooGetDefaultResponse.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FooGetDefaultResponse.ts new file mode 100644 index 000000000000..996d74d388e1 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FooGetDefaultResponse.ts @@ -0,0 +1,37 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Foo } from '../models/Foo'; +import { HttpFile } from '../http/http'; + +export class FooGetDefaultResponse { + 'string'?: Foo; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "string", + "baseName": "string", + "type": "Foo", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FooGetDefaultResponse.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FormatTest.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FormatTest.ts new file mode 100644 index 000000000000..33bb6c633d65 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/FormatTest.ts @@ -0,0 +1,148 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Decimal } from '../models/Decimal'; +import { HttpFile } from '../http/http'; + +export class FormatTest { + 'integer'?: number; + 'int32'?: number; + 'int64'?: number; + 'number': number; + '_float'?: number; + '_double'?: number; + 'decimal'?: Decimal; + 'string'?: string; + '_byte': string; + 'binary'?: HttpFile; + 'date': string; + 'dateTime'?: Date; + 'uuid'?: string; + 'password': string; + /** + * A string that is a 10 digit number. Can have leading zeros. + */ + 'patternWithDigits'?: string; + /** + * A string starting with \'image_\' (case insensitive) and one to three digits following i.e. Image_01. + */ + 'patternWithDigitsAndDelimiter'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "integer", + "baseName": "integer", + "type": "number", + "format": "" + }, + { + "name": "int32", + "baseName": "int32", + "type": "number", + "format": "int32" + }, + { + "name": "int64", + "baseName": "int64", + "type": "number", + "format": "int64" + }, + { + "name": "number", + "baseName": "number", + "type": "number", + "format": "" + }, + { + "name": "_float", + "baseName": "float", + "type": "number", + "format": "float" + }, + { + "name": "_double", + "baseName": "double", + "type": "number", + "format": "double" + }, + { + "name": "decimal", + "baseName": "decimal", + "type": "Decimal", + "format": "number" + }, + { + "name": "string", + "baseName": "string", + "type": "string", + "format": "" + }, + { + "name": "_byte", + "baseName": "byte", + "type": "string", + "format": "byte" + }, + { + "name": "binary", + "baseName": "binary", + "type": "HttpFile", + "format": "binary" + }, + { + "name": "date", + "baseName": "date", + "type": "string", + "format": "date" + }, + { + "name": "dateTime", + "baseName": "dateTime", + "type": "Date", + "format": "date-time" + }, + { + "name": "uuid", + "baseName": "uuid", + "type": "string", + "format": "uuid" + }, + { + "name": "password", + "baseName": "password", + "type": "string", + "format": "password" + }, + { + "name": "patternWithDigits", + "baseName": "pattern_with_digits", + "type": "string", + "format": "" + }, + { + "name": "patternWithDigitsAndDelimiter", + "baseName": "pattern_with_digits_and_delimiter", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return FormatTest.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/HasOnlyReadOnly.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/HasOnlyReadOnly.ts new file mode 100644 index 000000000000..402c7cb21467 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/HasOnlyReadOnly.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class HasOnlyReadOnly { + 'bar'?: string; + 'foo'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "bar", + "baseName": "bar", + "type": "string", + "format": "" + }, + { + "name": "foo", + "baseName": "foo", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return HasOnlyReadOnly.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/HealthCheckResult.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/HealthCheckResult.ts new file mode 100644 index 000000000000..61330f3f1cd2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/HealthCheckResult.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +/** +* Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +*/ +export class HealthCheckResult { + 'nullableMessage'?: string | null; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "nullableMessage", + "baseName": "NullableMessage", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return HealthCheckResult.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/List.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/List.ts new file mode 100644 index 000000000000..50abb3d550d1 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/List.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class List { + '_123list'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "_123list", + "baseName": "123-list", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return List.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts new file mode 100644 index 000000000000..512fae304c86 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MapTest.ts @@ -0,0 +1,63 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class MapTest { + 'mapMapOfString'?: { [key: string]: { [key: string]: string; }; }; + 'mapOfEnumString'?: { [key: string]: string; }; + 'directMap'?: { [key: string]: boolean; }; + 'indirectMap'?: { [key: string]: boolean; }; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "mapMapOfString", + "baseName": "map_map_of_string", + "type": "{ [key: string]: { [key: string]: string; }; }", + "format": "" + }, + { + "name": "mapOfEnumString", + "baseName": "map_of_enum_string", + "type": "{ [key: string]: string; }", + "format": "" + }, + { + "name": "directMap", + "baseName": "direct_map", + "type": "{ [key: string]: boolean; }", + "format": "" + }, + { + "name": "indirectMap", + "baseName": "indirect_map", + "type": "{ [key: string]: boolean; }", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MapTest.attributeTypeMap; + } + + public constructor() { + } +} + +export enum MapTestMapOfEnumStringEnum { + Upper = 'UPPER', + Lower = 'lower' +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MixedPropertiesAndAdditionalPropertiesClass.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MixedPropertiesAndAdditionalPropertiesClass.ts new file mode 100644 index 000000000000..f79146d2fd12 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/MixedPropertiesAndAdditionalPropertiesClass.ts @@ -0,0 +1,51 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Animal } from '../models/Animal'; +import { HttpFile } from '../http/http'; + +export class MixedPropertiesAndAdditionalPropertiesClass { + 'uuid'?: string; + 'dateTime'?: Date; + 'map'?: { [key: string]: Animal; }; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "uuid", + "baseName": "uuid", + "type": "string", + "format": "uuid" + }, + { + "name": "dateTime", + "baseName": "dateTime", + "type": "Date", + "format": "date-time" + }, + { + "name": "map", + "baseName": "map", + "type": "{ [key: string]: Animal; }", + "format": "" + } ]; + + static getAttributeTypeMap() { + return MixedPropertiesAndAdditionalPropertiesClass.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Model200Response.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Model200Response.ts new file mode 100644 index 000000000000..8112b17b5686 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Model200Response.ts @@ -0,0 +1,46 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +/** +* Model for testing model name starting with number +*/ +export class Model200Response { + 'name'?: number; + '_class'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "number", + "format": "int32" + }, + { + "name": "_class", + "baseName": "class", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Model200Response.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ModelFile.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ModelFile.ts new file mode 100644 index 000000000000..a2af826e9d4f --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ModelFile.ts @@ -0,0 +1,42 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +/** +* Must be named `File` for test. +*/ +export class ModelFile { + /** + * Test capitalization + */ + 'sourceURI'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "sourceURI", + "baseName": "sourceURI", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ModelFile.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Name.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Name.ts new file mode 100644 index 000000000000..0254b92d9a54 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Name.ts @@ -0,0 +1,60 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +/** +* Model for testing model name same as property name +*/ +export class Name { + 'name': number; + 'snakeCase'?: number; + 'property'?: string; + '_123number'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "number", + "format": "int32" + }, + { + "name": "snakeCase", + "baseName": "snake_case", + "type": "number", + "format": "int32" + }, + { + "name": "property", + "baseName": "property", + "type": "string", + "format": "" + }, + { + "name": "_123number", + "baseName": "123Number", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Name.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/NullableClass.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/NullableClass.ts new file mode 100644 index 000000000000..9630c721bbf0 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/NullableClass.ts @@ -0,0 +1,113 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class NullableClass { + 'integerProp'?: number | null; + 'numberProp'?: number | null; + 'booleanProp'?: boolean | null; + 'stringProp'?: string | null; + 'dateProp'?: string | null; + 'datetimeProp'?: Date | null; + 'arrayNullableProp'?: Array | null; + 'arrayAndItemsNullableProp'?: Array | null; + 'arrayItemsNullable'?: Array; + 'objectNullableProp'?: { [key: string]: any; } | null; + 'objectAndItemsNullableProp'?: { [key: string]: any | null; } | null; + 'objectItemsNullable'?: { [key: string]: any | null; }; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "integerProp", + "baseName": "integer_prop", + "type": "number", + "format": "" + }, + { + "name": "numberProp", + "baseName": "number_prop", + "type": "number", + "format": "" + }, + { + "name": "booleanProp", + "baseName": "boolean_prop", + "type": "boolean", + "format": "" + }, + { + "name": "stringProp", + "baseName": "string_prop", + "type": "string", + "format": "" + }, + { + "name": "dateProp", + "baseName": "date_prop", + "type": "string", + "format": "date" + }, + { + "name": "datetimeProp", + "baseName": "datetime_prop", + "type": "Date", + "format": "date-time" + }, + { + "name": "arrayNullableProp", + "baseName": "array_nullable_prop", + "type": "Array", + "format": "" + }, + { + "name": "arrayAndItemsNullableProp", + "baseName": "array_and_items_nullable_prop", + "type": "Array", + "format": "" + }, + { + "name": "arrayItemsNullable", + "baseName": "array_items_nullable", + "type": "Array", + "format": "" + }, + { + "name": "objectNullableProp", + "baseName": "object_nullable_prop", + "type": "{ [key: string]: any; }", + "format": "" + }, + { + "name": "objectAndItemsNullableProp", + "baseName": "object_and_items_nullable_prop", + "type": "{ [key: string]: any | null; }", + "format": "" + }, + { + "name": "objectItemsNullable", + "baseName": "object_items_nullable", + "type": "{ [key: string]: any | null; }", + "format": "" + } ]; + + static getAttributeTypeMap() { + return NullableClass.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/NumberOnly.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/NumberOnly.ts new file mode 100644 index 000000000000..1b556ca63b60 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/NumberOnly.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class NumberOnly { + 'justNumber'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "justNumber", + "baseName": "JustNumber", + "type": "number", + "format": "" + } ]; + + static getAttributeTypeMap() { + return NumberOnly.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts new file mode 100644 index 000000000000..d4a5ed1010ad --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectSerializer.ts @@ -0,0 +1,416 @@ +export * from '../models/AdditionalPropertiesClass'; +export * from '../models/AllOfWithSingleRef'; +export * from '../models/Animal'; +export * from '../models/ApiResponse'; +export * from '../models/ArrayOfArrayOfNumberOnly'; +export * from '../models/ArrayOfNumberOnly'; +export * from '../models/ArrayTest'; +export * from '../models/Capitalization'; +export * from '../models/Cat'; +export * from '../models/Category'; +export * from '../models/ClassModel'; +export * from '../models/Client'; +export * from '../models/DeprecatedObject'; +export * from '../models/Dog'; +export * from '../models/EnumArrays'; +export * from '../models/EnumClass'; +export * from '../models/EnumTest'; +export * from '../models/FakeBigDecimalMap200Response'; +export * from '../models/FileSchemaTestClass'; +export * from '../models/Foo'; +export * from '../models/FooGetDefaultResponse'; +export * from '../models/FormatTest'; +export * from '../models/HasOnlyReadOnly'; +export * from '../models/HealthCheckResult'; +export * from '../models/List'; +export * from '../models/MapTest'; +export * from '../models/MixedPropertiesAndAdditionalPropertiesClass'; +export * from '../models/Model200Response'; +export * from '../models/ModelFile'; +export * from '../models/Name'; +export * from '../models/NullableClass'; +export * from '../models/NumberOnly'; +export * from '../models/ObjectWithDeprecatedFields'; +export * from '../models/Order'; +export * from '../models/OuterComposite'; +export * from '../models/OuterEnum'; +export * from '../models/OuterEnumDefaultValue'; +export * from '../models/OuterEnumInteger'; +export * from '../models/OuterEnumIntegerDefaultValue'; +export * from '../models/OuterObjectWithEnumProperty'; +export * from '../models/Pet'; +export * from '../models/ReadOnlyFirst'; +export * from '../models/Return'; +export * from '../models/SingleRefType'; +export * from '../models/SpecialModelName'; +export * from '../models/Tag'; +export * from '../models/User'; + +import { AdditionalPropertiesClass } from '../models/AdditionalPropertiesClass'; +import { AllOfWithSingleRef } from '../models/AllOfWithSingleRef'; +import { Animal } from '../models/Animal'; +import { ApiResponse } from '../models/ApiResponse'; +import { ArrayOfArrayOfNumberOnly } from '../models/ArrayOfArrayOfNumberOnly'; +import { ArrayOfNumberOnly } from '../models/ArrayOfNumberOnly'; +import { ArrayTest } from '../models/ArrayTest'; +import { Capitalization } from '../models/Capitalization'; +import { Cat } from '../models/Cat'; +import { Category } from '../models/Category'; +import { ClassModel } from '../models/ClassModel'; +import { Client } from '../models/Client'; +import { DeprecatedObject } from '../models/DeprecatedObject'; +import { Dog } from '../models/Dog'; +import { EnumArrays, EnumArraysJustSymbolEnum , EnumArraysArrayEnumEnum } from '../models/EnumArrays'; +import { EnumClass } from '../models/EnumClass'; +import { EnumTest, EnumTestEnumStringEnum , EnumTestEnumStringRequiredEnum , EnumTestEnumIntegerEnum , EnumTestEnumNumberEnum } from '../models/EnumTest'; +import { FakeBigDecimalMap200Response } from '../models/FakeBigDecimalMap200Response'; +import { FileSchemaTestClass } from '../models/FileSchemaTestClass'; +import { Foo } from '../models/Foo'; +import { FooGetDefaultResponse } from '../models/FooGetDefaultResponse'; +import { FormatTest } from '../models/FormatTest'; +import { HasOnlyReadOnly } from '../models/HasOnlyReadOnly'; +import { HealthCheckResult } from '../models/HealthCheckResult'; +import { List } from '../models/List'; +import { MapTest , MapTestMapOfEnumStringEnum } from '../models/MapTest'; +import { MixedPropertiesAndAdditionalPropertiesClass } from '../models/MixedPropertiesAndAdditionalPropertiesClass'; +import { Model200Response } from '../models/Model200Response'; +import { ModelFile } from '../models/ModelFile'; +import { Name } from '../models/Name'; +import { NullableClass } from '../models/NullableClass'; +import { NumberOnly } from '../models/NumberOnly'; +import { ObjectWithDeprecatedFields } from '../models/ObjectWithDeprecatedFields'; +import { Order , OrderStatusEnum } from '../models/Order'; +import { OuterComposite } from '../models/OuterComposite'; +import { OuterEnum } from '../models/OuterEnum'; +import { OuterEnumDefaultValue } from '../models/OuterEnumDefaultValue'; +import { OuterEnumInteger } from '../models/OuterEnumInteger'; +import { OuterEnumIntegerDefaultValue } from '../models/OuterEnumIntegerDefaultValue'; +import { OuterObjectWithEnumProperty } from '../models/OuterObjectWithEnumProperty'; +import { Pet , PetStatusEnum } from '../models/Pet'; +import { ReadOnlyFirst } from '../models/ReadOnlyFirst'; +import { Return } from '../models/Return'; +import { SingleRefType } from '../models/SingleRefType'; +import { SpecialModelName } from '../models/SpecialModelName'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: Set = new Set([ + "EnumArraysJustSymbolEnum", + "EnumArraysArrayEnumEnum", + "EnumClass", + "EnumTestEnumStringEnum", + "EnumTestEnumStringRequiredEnum", + "EnumTestEnumIntegerEnum", + "EnumTestEnumNumberEnum", + "MapTestMapOfEnumStringEnum", + "OrderStatusEnum", + "OuterEnum", + "OuterEnumDefaultValue", + "OuterEnumInteger", + "OuterEnumIntegerDefaultValue", + "PetStatusEnum", + "SingleRefType", +]); + +let typeMap: {[index: string]: any} = { + "AdditionalPropertiesClass": AdditionalPropertiesClass, + "AllOfWithSingleRef": AllOfWithSingleRef, + "Animal": Animal, + "ApiResponse": ApiResponse, + "ArrayOfArrayOfNumberOnly": ArrayOfArrayOfNumberOnly, + "ArrayOfNumberOnly": ArrayOfNumberOnly, + "ArrayTest": ArrayTest, + "Capitalization": Capitalization, + "Cat": Cat, + "Category": Category, + "ClassModel": ClassModel, + "Client": Client, + "DeprecatedObject": DeprecatedObject, + "Dog": Dog, + "EnumArrays": EnumArrays, + "EnumTest": EnumTest, + "FakeBigDecimalMap200Response": FakeBigDecimalMap200Response, + "FileSchemaTestClass": FileSchemaTestClass, + "Foo": Foo, + "FooGetDefaultResponse": FooGetDefaultResponse, + "FormatTest": FormatTest, + "HasOnlyReadOnly": HasOnlyReadOnly, + "HealthCheckResult": HealthCheckResult, + "List": List, + "MapTest": MapTest, + "MixedPropertiesAndAdditionalPropertiesClass": MixedPropertiesAndAdditionalPropertiesClass, + "Model200Response": Model200Response, + "ModelFile": ModelFile, + "Name": Name, + "NullableClass": NullableClass, + "NumberOnly": NumberOnly, + "ObjectWithDeprecatedFields": ObjectWithDeprecatedFields, + "Order": Order, + "OuterComposite": OuterComposite, + "OuterObjectWithEnumProperty": OuterObjectWithEnumProperty, + "Pet": Pet, + "ReadOnlyFirst": ReadOnlyFirst, + "Return": Return, + "SpecialModelName": SpecialModelName, + "Tag": Tag, + "User": User, +} + +type MimeTypeDescriptor = { + type: string; + subtype: string; + subtypeTokens: string[]; +}; + +/** + * Every mime-type consists of a type, subtype, and optional parameters. + * The subtype can be composite, including information about the content format. + * For example: `application/json-patch+json`, `application/merge-patch+json`. + * + * This helper transforms a string mime-type into an internal representation. + * This simplifies the implementation of predicates that in turn define common rules for parsing or stringifying + * the payload. + */ +const parseMimeType = (mimeType: string): MimeTypeDescriptor => { + const [type, subtype] = mimeType.split('/'); + return { + type, + subtype, + subtypeTokens: subtype.split('+'), + }; +}; + +type MimeTypePredicate = (mimeType: string) => boolean; + +// This factory creates a predicate function that checks a string mime-type against defined rules. +const mimeTypePredicateFactory = (predicate: (descriptor: MimeTypeDescriptor) => boolean): MimeTypePredicate => (mimeType) => predicate(parseMimeType(mimeType)); + +// Use this factory when you need to define a simple predicate based only on type and, if applicable, subtype. +const mimeTypeSimplePredicateFactory = (type: string, subtype?: string): MimeTypePredicate => mimeTypePredicateFactory((descriptor) => { + if (descriptor.type !== type) return false; + if (subtype != null && descriptor.subtype !== subtype) return false; + return true; +}); + +// Creating a set of named predicates that will help us determine how to handle different mime-types +const isTextLikeMimeType = mimeTypeSimplePredicateFactory('text'); +const isJsonMimeType = mimeTypeSimplePredicateFactory('application', 'json'); +const isJsonLikeMimeType = mimeTypePredicateFactory((descriptor) => descriptor.type === 'application' && descriptor.subtypeTokens.some((item) => item === 'json')); +const isOctetStreamMimeType = mimeTypeSimplePredicateFactory('application', 'octet-stream'); +const isFormUrlencodedMimeType = mimeTypeSimplePredicateFactory('application', 'x-www-form-urlencoded'); + +// Defining a list of mime-types in the order of prioritization for handling. +const supportedMimeTypePredicatesWithPriority: MimeTypePredicate[] = [ + isJsonMimeType, + isJsonLikeMimeType, + isTextLikeMimeType, + isOctetStreamMimeType, + isFormUrlencodedMimeType, +]; + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap.has(expectedType)) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + let mapping = typeMap[expectedType].mapping; + if (mapping != undefined && mapping[discriminatorType]) { + return mapping[discriminatorType]; // use the type given in the discriminator + } else if(typeMap[discriminatorType]) { + return discriminatorType; + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string, format: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let date of data) { + transformedData.push(ObjectSerializer.serialize(date, subType, format)); + } + return transformedData; + } else if (type === "Date") { + if (format == "date") { + let month = data.getMonth()+1 + month = month < 10 ? "0" + month.toString() : month.toString() + let day = data.getDate(); + day = day < 10 ? "0" + day.toString() : day.toString(); + + return data.getFullYear() + "-" + month + "-" + day; + } else { + return data.toISOString(); + } + } else { + if (enumsMap.has(type)) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let attributeType of attributeTypes) { + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); + } + return instance; + } + } + + public static deserialize(data: any, type: string, format: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let date of data) { + transformedData.push(ObjectSerializer.deserialize(date, subType, format)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap.has(type)) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let attributeType of attributeTypes) { + let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); + if (value !== undefined) { + instance[attributeType.name] = value; + } + } + return instance; + } + } + + + /** + * Normalize media type + * + * We currently do not handle any media types attributes, i.e. anything + * after a semicolon. All content is assumed to be UTF-8 compatible. + */ + public static normalizeMediaType(mediaType: string | undefined): string | undefined { + if (mediaType === undefined) { + return undefined; + } + return mediaType.split(";")[0].trim().toLowerCase(); + } + + /** + * From a list of possible media types, choose the one we can handle best. + * + * The order of the given media types does not have any impact on the choice + * made. + */ + public static getPreferredMediaType(mediaTypes: Array): string { + /** According to OAS 3 we should default to json */ + if (mediaTypes.length === 0) { + return "application/json"; + } + + const normalMediaTypes = mediaTypes.map(this.normalizeMediaType); + + for (const predicate of supportedMimeTypePredicatesWithPriority) { + for (const mediaType of normalMediaTypes) { + if (mediaType != null && predicate(mediaType)) { + return mediaType; + } + } + } + + throw new Error("None of the given media types are supported: " + mediaTypes.join(", ")); + } + + /** + * Convert data to a string according the given media type + */ + public static stringify(data: any, mediaType: string): string { + if (isTextLikeMimeType(mediaType)) { + return String(data); + } + + if (isJsonLikeMimeType(mediaType)) { + return JSON.stringify(data); + } + + throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.stringify."); + } + + /** + * Parse data from a string according to the given media type + */ + public static parse(rawData: string, mediaType: string | undefined) { + if (mediaType === undefined) { + throw new Error("Cannot parse content. No Content-Type defined."); + } + + if (isTextLikeMimeType(mediaType)) { + return rawData; + } + + if (isJsonLikeMimeType(mediaType)) { + return JSON.parse(rawData); + } + + throw new Error("The mediaType " + mediaType + " is not supported by ObjectSerializer.parse."); + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectWithDeprecatedFields.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectWithDeprecatedFields.ts new file mode 100644 index 000000000000..1a428428a1e2 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ObjectWithDeprecatedFields.ts @@ -0,0 +1,58 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DeprecatedObject } from '../models/DeprecatedObject'; +import { HttpFile } from '../http/http'; + +export class ObjectWithDeprecatedFields { + 'uuid'?: string; + 'id'?: number; + 'deprecatedRef'?: DeprecatedObject; + 'bars'?: Array; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "uuid", + "baseName": "uuid", + "type": "string", + "format": "" + }, + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "" + }, + { + "name": "deprecatedRef", + "baseName": "deprecatedRef", + "type": "DeprecatedObject", + "format": "" + }, + { + "name": "bars", + "baseName": "bars", + "type": "Array", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ObjectWithDeprecatedFields.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Order.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Order.ts new file mode 100644 index 000000000000..56ebae4d3851 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Order.ts @@ -0,0 +1,81 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Order { + 'id'?: number; + 'petId'?: number; + 'quantity'?: number; + 'shipDate'?: Date; + /** + * Order Status + */ + 'status'?: OrderStatusEnum; + 'complete'?: boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "petId", + "baseName": "petId", + "type": "number", + "format": "int64" + }, + { + "name": "quantity", + "baseName": "quantity", + "type": "number", + "format": "int32" + }, + { + "name": "shipDate", + "baseName": "shipDate", + "type": "Date", + "format": "date-time" + }, + { + "name": "status", + "baseName": "status", + "type": "OrderStatusEnum", + "format": "" + }, + { + "name": "complete", + "baseName": "complete", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Order.attributeTypeMap; + } + + public constructor() { + } +} + +export enum OrderStatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterComposite.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterComposite.ts new file mode 100644 index 000000000000..7245e4e995ef --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterComposite.ts @@ -0,0 +1,50 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class OuterComposite { + 'myNumber'?: number; + 'myString'?: string; + 'myBoolean'?: boolean; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "myNumber", + "baseName": "my_number", + "type": "number", + "format": "" + }, + { + "name": "myString", + "baseName": "my_string", + "type": "string", + "format": "" + }, + { + "name": "myBoolean", + "baseName": "my_boolean", + "type": "boolean", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OuterComposite.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnum.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnum.ts new file mode 100644 index 000000000000..0bfae26e8d3f --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnum.ts @@ -0,0 +1,19 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export enum OuterEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumDefaultValue.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumDefaultValue.ts new file mode 100644 index 000000000000..b379db29b9f6 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumDefaultValue.ts @@ -0,0 +1,19 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export enum OuterEnumDefaultValue { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumInteger.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumInteger.ts new file mode 100644 index 000000000000..ec865ea8193e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumInteger.ts @@ -0,0 +1,19 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export enum OuterEnumInteger { + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2 +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumIntegerDefaultValue.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumIntegerDefaultValue.ts new file mode 100644 index 000000000000..98dd2ab00b32 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterEnumIntegerDefaultValue.ts @@ -0,0 +1,19 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export enum OuterEnumIntegerDefaultValue { + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2 +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterObjectWithEnumProperty.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterObjectWithEnumProperty.ts new file mode 100644 index 000000000000..4767bd8e646a --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/OuterObjectWithEnumProperty.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { OuterEnumInteger } from '../models/OuterEnumInteger'; +import { HttpFile } from '../http/http'; + +export class OuterObjectWithEnumProperty { + 'value': OuterEnumInteger; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "value", + "baseName": "value", + "type": "OuterEnumInteger", + "format": "" + } ]; + + static getAttributeTypeMap() { + return OuterObjectWithEnumProperty.attributeTypeMap; + } + + public constructor() { + } +} + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Pet.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Pet.ts new file mode 100644 index 000000000000..58eec958aa7e --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Pet.ts @@ -0,0 +1,83 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Category } from '../models/Category'; +import { Tag } from '../models/Tag'; +import { HttpFile } from '../http/http'; + +export class Pet { + 'id'?: number; + 'category'?: Category; + 'name': string; + 'photoUrls': Set; + 'tags'?: Array; + /** + * pet status in the store + */ + 'status'?: PetStatusEnum; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "category", + "baseName": "category", + "type": "Category", + "format": "" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + }, + { + "name": "photoUrls", + "baseName": "photoUrls", + "type": "Set", + "format": "" + }, + { + "name": "tags", + "baseName": "tags", + "type": "Array", + "format": "" + }, + { + "name": "status", + "baseName": "status", + "type": "PetStatusEnum", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Pet.attributeTypeMap; + } + + public constructor() { + } +} + +export enum PetStatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' +} + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ReadOnlyFirst.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ReadOnlyFirst.ts new file mode 100644 index 000000000000..8b09cae0d231 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/ReadOnlyFirst.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class ReadOnlyFirst { + 'bar'?: string; + 'baz'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "bar", + "baseName": "bar", + "type": "string", + "format": "" + }, + { + "name": "baz", + "baseName": "baz", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return ReadOnlyFirst.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Return.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Return.ts new file mode 100644 index 000000000000..77981b6800ee --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Return.ts @@ -0,0 +1,39 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +/** +* Model for testing reserved words +*/ +export class Return { + '_return'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "_return", + "baseName": "return", + "type": "number", + "format": "int32" + } ]; + + static getAttributeTypeMap() { + return Return.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/SingleRefType.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/SingleRefType.ts new file mode 100644 index 000000000000..0771fd11fcd9 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/SingleRefType.ts @@ -0,0 +1,18 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export enum SingleRefType { + Admin = 'admin', + User = 'user' +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/SpecialModelName.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/SpecialModelName.ts new file mode 100644 index 000000000000..eb610dddccbe --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/SpecialModelName.ts @@ -0,0 +1,36 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class SpecialModelName { + 'specialPropertyName'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "specialPropertyName", + "baseName": "$special[property.name]", + "type": "number", + "format": "int64" + } ]; + + static getAttributeTypeMap() { + return SpecialModelName.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Tag.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Tag.ts new file mode 100644 index 000000000000..ec4cfe6c2247 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/Tag.ts @@ -0,0 +1,43 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class Tag { + 'id'?: number; + 'name'?: string; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "name", + "baseName": "name", + "type": "string", + "format": "" + } ]; + + static getAttributeTypeMap() { + return Tag.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/User.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/User.ts new file mode 100644 index 000000000000..627b15b8fd6d --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/User.ts @@ -0,0 +1,88 @@ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { HttpFile } from '../http/http'; + +export class User { + 'id'?: number; + 'username'?: string; + 'firstName'?: string; + 'lastName'?: string; + 'email'?: string; + 'password'?: string; + 'phone'?: string; + /** + * User Status + */ + 'userStatus'?: number; + + static readonly discriminator: string | undefined = undefined; + + static readonly mapping: {[index: string]: string} | undefined = undefined; + + static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "number", + "format": "int64" + }, + { + "name": "username", + "baseName": "username", + "type": "string", + "format": "" + }, + { + "name": "firstName", + "baseName": "firstName", + "type": "string", + "format": "" + }, + { + "name": "lastName", + "baseName": "lastName", + "type": "string", + "format": "" + }, + { + "name": "email", + "baseName": "email", + "type": "string", + "format": "" + }, + { + "name": "password", + "baseName": "password", + "type": "string", + "format": "" + }, + { + "name": "phone", + "baseName": "phone", + "type": "string", + "format": "" + }, + { + "name": "userStatus", + "baseName": "userStatus", + "type": "number", + "format": "int32" + } ]; + + static getAttributeTypeMap() { + return User.attributeTypeMap; + } + + public constructor() { + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/models/all.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/all.ts new file mode 100644 index 000000000000..0b1516d3ebcb --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/models/all.ts @@ -0,0 +1,47 @@ +export * from '../models/AdditionalPropertiesClass' +export * from '../models/AllOfWithSingleRef' +export * from '../models/Animal' +export * from '../models/ApiResponse' +export * from '../models/ArrayOfArrayOfNumberOnly' +export * from '../models/ArrayOfNumberOnly' +export * from '../models/ArrayTest' +export * from '../models/Capitalization' +export * from '../models/Cat' +export * from '../models/Category' +export * from '../models/ClassModel' +export * from '../models/Client' +export * from '../models/DeprecatedObject' +export * from '../models/Dog' +export * from '../models/EnumArrays' +export * from '../models/EnumClass' +export * from '../models/EnumTest' +export * from '../models/FakeBigDecimalMap200Response' +export * from '../models/FileSchemaTestClass' +export * from '../models/Foo' +export * from '../models/FooGetDefaultResponse' +export * from '../models/FormatTest' +export * from '../models/HasOnlyReadOnly' +export * from '../models/HealthCheckResult' +export * from '../models/List' +export * from '../models/MapTest' +export * from '../models/MixedPropertiesAndAdditionalPropertiesClass' +export * from '../models/Model200Response' +export * from '../models/ModelFile' +export * from '../models/Name' +export * from '../models/NullableClass' +export * from '../models/NumberOnly' +export * from '../models/ObjectWithDeprecatedFields' +export * from '../models/Order' +export * from '../models/OuterComposite' +export * from '../models/OuterEnum' +export * from '../models/OuterEnumDefaultValue' +export * from '../models/OuterEnumInteger' +export * from '../models/OuterEnumIntegerDefaultValue' +export * from '../models/OuterObjectWithEnumProperty' +export * from '../models/Pet' +export * from '../models/ReadOnlyFirst' +export * from '../models/Return' +export * from '../models/SingleRefType' +export * from '../models/SpecialModelName' +export * from '../models/Tag' +export * from '../models/User' diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json new file mode 100644 index 000000000000..a18e68426adc --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json @@ -0,0 +1,45 @@ +{ + "name": "ts-petstore-client", + "version": "1.0.0", + "description": "OpenAPI client for ts-petstore-client", + "author": "OpenAPI-Generator Contributors", + "repository": { + "type": "git", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + }, + "keywords": [ + "fetch", + "typescript", + "openapi-client", + "openapi-generator" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "type": "commonjs", + "exports": { + ".": { + "require": "./dist/index.js", + "types": "./dist/index.d.js" + } + }, + "files": [ + "dist" + ], + "typings": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "prepare": "npm run build" + }, + "dependencies": { + "node-fetch": "^2.6.0", + "@types/node-fetch": "^2.5.7", + "@types/node": "*", + "form-data": "^2.5.0", + "es6-promise": "^4.2.4", + "url-parse": "^1.4.3" + }, + "devDependencies": { + "typescript": "^4.0", + "@types/url-parse": "1.4.4" + } +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/rxjsStub.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/rxjsStub.ts new file mode 100644 index 000000000000..4c73715a2486 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/rxjsStub.ts @@ -0,0 +1,27 @@ +export class Observable { + constructor(private promise: Promise) {} + + toPromise() { + return this.promise; + } + + pipe(callback: (value: T) => S | Promise): Observable { + return new Observable(this.promise.then(callback)); + } +} + +export function from(promise: Promise) { + return new Observable(promise); +} + +export function of(value: T) { + return new Observable(Promise.resolve(value)); +} + +export function mergeMap(callback: (value: T) => Observable) { + return (value: T) => callback(value).toPromise(); +} + +export function map(callback: any) { + return callback; +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/servers.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/servers.ts new file mode 100644 index 000000000000..7c6d030a5f15 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/servers.ts @@ -0,0 +1,57 @@ +import { RequestContext, HttpMethod } from "./http/http"; + +export interface BaseServerConfiguration { + makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; +} + +/** + * + * Represents the configuration of a server including its + * url template and variable configuration based on the url. + * + */ +export class ServerConfiguration implements BaseServerConfiguration { + public constructor(private url: string, private variableConfiguration: T) {} + + /** + * Sets the value of the variables of this server. Variables are included in + * the `url` of this ServerConfiguration in the form `{variableName}` + * + * @param variableConfiguration a partial variable configuration for the + * variables contained in the url + */ + public setVariables(variableConfiguration: Partial) { + Object.assign(this.variableConfiguration, variableConfiguration); + } + + public getConfiguration(): T { + return this.variableConfiguration + } + + private getUrl() { + let replacedUrl = this.url; + for (const key in this.variableConfiguration) { + var re = new RegExp("{" + key + "}","g"); + replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); + } + return replacedUrl + } + + /** + * Creates a new request context for this server using the url with variables + * replaced with their respective values and the endpoint of the request appended. + * + * @param endpoint the endpoint to be queried on the server + * @param httpMethod httpMethod to be used + * + */ + public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { + return new RequestContext(this.getUrl() + endpoint, httpMethod); + } +} + +export const server1 = new ServerConfiguration<{ "server": "petstore" | "qa-petstore" | "dev-petstore", "port": "80" | "8080" }>("http://{server}.swagger.io:{port}/v2", { "server": "petstore" , "port": "80" }) +export const server2 = new ServerConfiguration<{ "version": "v1" | "v2" }>("https://localhost:8080/{version}", { "version": "v2" }) +export const server3 = new ServerConfiguration<{ }>("https://127.0.0.1/no_varaible", { }) + +export const servers = [server1, server2, server3]; diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json new file mode 100644 index 000000000000..4a8d5cb2f334 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es5", + "moduleResolution": "node", + "declaration": true, + + /* Additional Checks */ + "noUnusedLocals": false, /* Report errors on unused locals. */ // TODO: reenable (unused imports!) + "noUnusedParameters": false, /* Report errors on unused parameters. */ // TODO: set to true again + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + "removeComments": true, + "sourceMap": true, + "outDir": "./dist", + "noLib": false, + "lib": [ "es6" ], + }, + "exclude": [ + "dist", + "node_modules" + ], + "filesGlob": [ + "./**/*.ts", + ] +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObjectParamAPI.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObjectParamAPI.ts new file mode 100644 index 000000000000..b37567661020 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObjectParamAPI.ts @@ -0,0 +1,1478 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration} from '../configuration' + +import { AdditionalPropertiesClass } from '../models/AdditionalPropertiesClass'; +import { AllOfWithSingleRef } from '../models/AllOfWithSingleRef'; +import { Animal } from '../models/Animal'; +import { ApiResponse } from '../models/ApiResponse'; +import { ArrayOfArrayOfNumberOnly } from '../models/ArrayOfArrayOfNumberOnly'; +import { ArrayOfNumberOnly } from '../models/ArrayOfNumberOnly'; +import { ArrayTest } from '../models/ArrayTest'; +import { Capitalization } from '../models/Capitalization'; +import { Cat } from '../models/Cat'; +import { Category } from '../models/Category'; +import { ClassModel } from '../models/ClassModel'; +import { Client } from '../models/Client'; +import { DeprecatedObject } from '../models/DeprecatedObject'; +import { Dog } from '../models/Dog'; +import { EnumArrays } from '../models/EnumArrays'; +import { EnumClass } from '../models/EnumClass'; +import { EnumTest } from '../models/EnumTest'; +import { FakeBigDecimalMap200Response } from '../models/FakeBigDecimalMap200Response'; +import { FileSchemaTestClass } from '../models/FileSchemaTestClass'; +import { Foo } from '../models/Foo'; +import { FooGetDefaultResponse } from '../models/FooGetDefaultResponse'; +import { FormatTest } from '../models/FormatTest'; +import { HasOnlyReadOnly } from '../models/HasOnlyReadOnly'; +import { HealthCheckResult } from '../models/HealthCheckResult'; +import { List } from '../models/List'; +import { MapTest } from '../models/MapTest'; +import { MixedPropertiesAndAdditionalPropertiesClass } from '../models/MixedPropertiesAndAdditionalPropertiesClass'; +import { Model200Response } from '../models/Model200Response'; +import { ModelFile } from '../models/ModelFile'; +import { Name } from '../models/Name'; +import { NullableClass } from '../models/NullableClass'; +import { NumberOnly } from '../models/NumberOnly'; +import { ObjectWithDeprecatedFields } from '../models/ObjectWithDeprecatedFields'; +import { Order } from '../models/Order'; +import { OuterComposite } from '../models/OuterComposite'; +import { OuterEnum } from '../models/OuterEnum'; +import { OuterEnumDefaultValue } from '../models/OuterEnumDefaultValue'; +import { OuterEnumInteger } from '../models/OuterEnumInteger'; +import { OuterEnumIntegerDefaultValue } from '../models/OuterEnumIntegerDefaultValue'; +import { OuterObjectWithEnumProperty } from '../models/OuterObjectWithEnumProperty'; +import { Pet } from '../models/Pet'; +import { ReadOnlyFirst } from '../models/ReadOnlyFirst'; +import { Return } from '../models/Return'; +import { SingleRefType } from '../models/SingleRefType'; +import { SpecialModelName } from '../models/SpecialModelName'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; + +import { ObservableAnotherFakeApi } from "./ObservableAPI"; +import { AnotherFakeApiRequestFactory, AnotherFakeApiResponseProcessor} from "../apis/AnotherFakeApi"; + +export interface AnotherFakeApi123testSpecialTagsRequest { + /** + * client model + * @type Client + * @memberof AnotherFakeApi_123testSpecialTags + */ + client: Client +} + +export class ObjectAnotherFakeApi { + private api: ObservableAnotherFakeApi + + public constructor(configuration: Configuration, requestFactory?: AnotherFakeApiRequestFactory, responseProcessor?: AnotherFakeApiResponseProcessor) { + this.api = new ObservableAnotherFakeApi(configuration, requestFactory, responseProcessor); + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param param the request object + */ + public _123testSpecialTagsWithHttpInfo(param: AnotherFakeApi123testSpecialTagsRequest, options?: Configuration): Promise> { + return this.api._123testSpecialTagsWithHttpInfo(param.client, options).toPromise(); + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param param the request object + */ + public _123testSpecialTags(param: AnotherFakeApi123testSpecialTagsRequest, options?: Configuration): Promise { + return this.api._123testSpecialTags(param.client, options).toPromise(); + } + +} + +import { ObservableDefaultApi } from "./ObservableAPI"; +import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/DefaultApi"; + +export interface DefaultApiFooGetRequest { +} + +export class ObjectDefaultApi { + private api: ObservableDefaultApi + + public constructor(configuration: Configuration, requestFactory?: DefaultApiRequestFactory, responseProcessor?: DefaultApiResponseProcessor) { + this.api = new ObservableDefaultApi(configuration, requestFactory, responseProcessor); + } + + /** + * @param param the request object + */ + public fooGetWithHttpInfo(param: DefaultApiFooGetRequest = {}, options?: Configuration): Promise> { + return this.api.fooGetWithHttpInfo( options).toPromise(); + } + + /** + * @param param the request object + */ + public fooGet(param: DefaultApiFooGetRequest = {}, options?: Configuration): Promise { + return this.api.fooGet( options).toPromise(); + } + +} + +import { ObservableFakeApi } from "./ObservableAPI"; +import { FakeApiRequestFactory, FakeApiResponseProcessor} from "../apis/FakeApi"; + +export interface FakeApiFakeBigDecimalMapRequest { +} + +export interface FakeApiFakeHealthGetRequest { +} + +export interface FakeApiFakeHttpSignatureTestRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof FakeApifakeHttpSignatureTest + */ + pet: Pet + /** + * query parameter + * @type string + * @memberof FakeApifakeHttpSignatureTest + */ + query1?: string + /** + * header parameter + * @type string + * @memberof FakeApifakeHttpSignatureTest + */ + header1?: string +} + +export interface FakeApiFakeOuterBooleanSerializeRequest { + /** + * Input boolean as post body + * @type boolean + * @memberof FakeApifakeOuterBooleanSerialize + */ + body?: boolean +} + +export interface FakeApiFakeOuterCompositeSerializeRequest { + /** + * Input composite as post body + * @type OuterComposite + * @memberof FakeApifakeOuterCompositeSerialize + */ + outerComposite?: OuterComposite +} + +export interface FakeApiFakeOuterNumberSerializeRequest { + /** + * Input number as post body + * @type number + * @memberof FakeApifakeOuterNumberSerialize + */ + body?: number +} + +export interface FakeApiFakeOuterStringSerializeRequest { + /** + * Input string as post body + * @type string + * @memberof FakeApifakeOuterStringSerialize + */ + body?: string +} + +export interface FakeApiFakePropertyEnumIntegerSerializeRequest { + /** + * Input enum (int) as post body + * @type OuterObjectWithEnumProperty + * @memberof FakeApifakePropertyEnumIntegerSerialize + */ + outerObjectWithEnumProperty: OuterObjectWithEnumProperty +} + +export interface FakeApiTestBodyWithBinaryRequest { + /** + * image to upload + * @type HttpFile + * @memberof FakeApitestBodyWithBinary + */ + body: HttpFile +} + +export interface FakeApiTestBodyWithFileSchemaRequest { + /** + * + * @type FileSchemaTestClass + * @memberof FakeApitestBodyWithFileSchema + */ + fileSchemaTestClass: FileSchemaTestClass +} + +export interface FakeApiTestBodyWithQueryParamsRequest { + /** + * + * @type string + * @memberof FakeApitestBodyWithQueryParams + */ + query: string + /** + * + * @type User + * @memberof FakeApitestBodyWithQueryParams + */ + user: User +} + +export interface FakeApiTestClientModelRequest { + /** + * client model + * @type Client + * @memberof FakeApitestClientModel + */ + client: Client +} + +export interface FakeApiTestEndpointParametersRequest { + /** + * None + * @type number + * @memberof FakeApitestEndpointParameters + */ + number: number + /** + * None + * @type number + * @memberof FakeApitestEndpointParameters + */ + _double: number + /** + * None + * @type string + * @memberof FakeApitestEndpointParameters + */ + patternWithoutDelimiter: string + /** + * None + * @type string + * @memberof FakeApitestEndpointParameters + */ + _byte: string + /** + * None + * @type number + * @memberof FakeApitestEndpointParameters + */ + integer?: number + /** + * None + * @type number + * @memberof FakeApitestEndpointParameters + */ + int32?: number + /** + * None + * @type number + * @memberof FakeApitestEndpointParameters + */ + int64?: number + /** + * None + * @type number + * @memberof FakeApitestEndpointParameters + */ + _float?: number + /** + * None + * @type string + * @memberof FakeApitestEndpointParameters + */ + string?: string + /** + * None + * @type HttpFile + * @memberof FakeApitestEndpointParameters + */ + binary?: HttpFile + /** + * None + * @type string + * @memberof FakeApitestEndpointParameters + */ + date?: string + /** + * None + * @type Date + * @memberof FakeApitestEndpointParameters + */ + dateTime?: Date + /** + * None + * @type string + * @memberof FakeApitestEndpointParameters + */ + password?: string + /** + * None + * @type string + * @memberof FakeApitestEndpointParameters + */ + callback?: string +} + +export interface FakeApiTestEnumParametersRequest { + /** + * Header parameter enum test (string array) + * @type Array<'>' | '$'> + * @memberof FakeApitestEnumParameters + */ + enumHeaderStringArray?: Array<'>' | '$'> + /** + * Header parameter enum test (string) + * @type '_abc' | '-efg' | '(xyz)' + * @memberof FakeApitestEnumParameters + */ + enumHeaderString?: '_abc' | '-efg' | '(xyz)' + /** + * Query parameter enum test (string array) + * @type Array<'>' | '$'> + * @memberof FakeApitestEnumParameters + */ + enumQueryStringArray?: Array<'>' | '$'> + /** + * Query parameter enum test (string) + * @type '_abc' | '-efg' | '(xyz)' + * @memberof FakeApitestEnumParameters + */ + enumQueryString?: '_abc' | '-efg' | '(xyz)' + /** + * Query parameter enum test (double) + * @type 1 | -2 + * @memberof FakeApitestEnumParameters + */ + enumQueryInteger?: 1 | -2 + /** + * Query parameter enum test (double) + * @type 1.1 | -1.2 + * @memberof FakeApitestEnumParameters + */ + enumQueryDouble?: 1.1 | -1.2 + /** + * + * @type Array<EnumClass> + * @memberof FakeApitestEnumParameters + */ + enumQueryModelArray?: Array + /** + * Form parameter enum test (string array) + * @type Array<string> + * @memberof FakeApitestEnumParameters + */ + enumFormStringArray?: Array + /** + * Form parameter enum test (string) + * @type string + * @memberof FakeApitestEnumParameters + */ + enumFormString?: string +} + +export interface FakeApiTestGroupParametersRequest { + /** + * Required String in group parameters + * @type number + * @memberof FakeApitestGroupParameters + */ + requiredStringGroup: number + /** + * Required Boolean in group parameters + * @type boolean + * @memberof FakeApitestGroupParameters + */ + requiredBooleanGroup: boolean + /** + * Required Integer in group parameters + * @type number + * @memberof FakeApitestGroupParameters + */ + requiredInt64Group: number + /** + * String in group parameters + * @type number + * @memberof FakeApitestGroupParameters + */ + stringGroup?: number + /** + * Boolean in group parameters + * @type boolean + * @memberof FakeApitestGroupParameters + */ + booleanGroup?: boolean + /** + * Integer in group parameters + * @type number + * @memberof FakeApitestGroupParameters + */ + int64Group?: number +} + +export interface FakeApiTestInlineAdditionalPropertiesRequest { + /** + * request body + * @type { [key: string]: string; } + * @memberof FakeApitestInlineAdditionalProperties + */ + requestBody: { [key: string]: string; } +} + +export interface FakeApiTestJsonFormDataRequest { + /** + * field1 + * @type string + * @memberof FakeApitestJsonFormData + */ + param: string + /** + * field2 + * @type string + * @memberof FakeApitestJsonFormData + */ + param2: string +} + +export interface FakeApiTestQueryParameterCollectionFormatRequest { + /** + * + * @type Array<string> + * @memberof FakeApitestQueryParameterCollectionFormat + */ + pipe: Array + /** + * + * @type Array<string> + * @memberof FakeApitestQueryParameterCollectionFormat + */ + ioutil: Array + /** + * + * @type Array<string> + * @memberof FakeApitestQueryParameterCollectionFormat + */ + http: Array + /** + * + * @type Array<string> + * @memberof FakeApitestQueryParameterCollectionFormat + */ + url: Array + /** + * + * @type Array<string> + * @memberof FakeApitestQueryParameterCollectionFormat + */ + context: Array + /** + * + * @type string + * @memberof FakeApitestQueryParameterCollectionFormat + */ + allowEmpty: string + /** + * + * @type { [key: string]: string; } + * @memberof FakeApitestQueryParameterCollectionFormat + */ + language?: { [key: string]: string; } +} + +export class ObjectFakeApi { + private api: ObservableFakeApi + + public constructor(configuration: Configuration, requestFactory?: FakeApiRequestFactory, responseProcessor?: FakeApiResponseProcessor) { + this.api = new ObservableFakeApi(configuration, requestFactory, responseProcessor); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param param the request object + */ + public fakeBigDecimalMapWithHttpInfo(param: FakeApiFakeBigDecimalMapRequest = {}, options?: Configuration): Promise> { + return this.api.fakeBigDecimalMapWithHttpInfo( options).toPromise(); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param param the request object + */ + public fakeBigDecimalMap(param: FakeApiFakeBigDecimalMapRequest = {}, options?: Configuration): Promise { + return this.api.fakeBigDecimalMap( options).toPromise(); + } + + /** + * Health check endpoint + * @param param the request object + */ + public fakeHealthGetWithHttpInfo(param: FakeApiFakeHealthGetRequest = {}, options?: Configuration): Promise> { + return this.api.fakeHealthGetWithHttpInfo( options).toPromise(); + } + + /** + * Health check endpoint + * @param param the request object + */ + public fakeHealthGet(param: FakeApiFakeHealthGetRequest = {}, options?: Configuration): Promise { + return this.api.fakeHealthGet( options).toPromise(); + } + + /** + * test http signature authentication + * @param param the request object + */ + public fakeHttpSignatureTestWithHttpInfo(param: FakeApiFakeHttpSignatureTestRequest, options?: Configuration): Promise> { + return this.api.fakeHttpSignatureTestWithHttpInfo(param.pet, param.query1, param.header1, options).toPromise(); + } + + /** + * test http signature authentication + * @param param the request object + */ + public fakeHttpSignatureTest(param: FakeApiFakeHttpSignatureTestRequest, options?: Configuration): Promise { + return this.api.fakeHttpSignatureTest(param.pet, param.query1, param.header1, options).toPromise(); + } + + /** + * Test serialization of outer boolean types + * @param param the request object + */ + public fakeOuterBooleanSerializeWithHttpInfo(param: FakeApiFakeOuterBooleanSerializeRequest = {}, options?: Configuration): Promise> { + return this.api.fakeOuterBooleanSerializeWithHttpInfo(param.body, options).toPromise(); + } + + /** + * Test serialization of outer boolean types + * @param param the request object + */ + public fakeOuterBooleanSerialize(param: FakeApiFakeOuterBooleanSerializeRequest = {}, options?: Configuration): Promise { + return this.api.fakeOuterBooleanSerialize(param.body, options).toPromise(); + } + + /** + * Test serialization of object with outer number type + * @param param the request object + */ + public fakeOuterCompositeSerializeWithHttpInfo(param: FakeApiFakeOuterCompositeSerializeRequest = {}, options?: Configuration): Promise> { + return this.api.fakeOuterCompositeSerializeWithHttpInfo(param.outerComposite, options).toPromise(); + } + + /** + * Test serialization of object with outer number type + * @param param the request object + */ + public fakeOuterCompositeSerialize(param: FakeApiFakeOuterCompositeSerializeRequest = {}, options?: Configuration): Promise { + return this.api.fakeOuterCompositeSerialize(param.outerComposite, options).toPromise(); + } + + /** + * Test serialization of outer number types + * @param param the request object + */ + public fakeOuterNumberSerializeWithHttpInfo(param: FakeApiFakeOuterNumberSerializeRequest = {}, options?: Configuration): Promise> { + return this.api.fakeOuterNumberSerializeWithHttpInfo(param.body, options).toPromise(); + } + + /** + * Test serialization of outer number types + * @param param the request object + */ + public fakeOuterNumberSerialize(param: FakeApiFakeOuterNumberSerializeRequest = {}, options?: Configuration): Promise { + return this.api.fakeOuterNumberSerialize(param.body, options).toPromise(); + } + + /** + * Test serialization of outer string types + * @param param the request object + */ + public fakeOuterStringSerializeWithHttpInfo(param: FakeApiFakeOuterStringSerializeRequest = {}, options?: Configuration): Promise> { + return this.api.fakeOuterStringSerializeWithHttpInfo(param.body, options).toPromise(); + } + + /** + * Test serialization of outer string types + * @param param the request object + */ + public fakeOuterStringSerialize(param: FakeApiFakeOuterStringSerializeRequest = {}, options?: Configuration): Promise { + return this.api.fakeOuterStringSerialize(param.body, options).toPromise(); + } + + /** + * Test serialization of enum (int) properties with examples + * @param param the request object + */ + public fakePropertyEnumIntegerSerializeWithHttpInfo(param: FakeApiFakePropertyEnumIntegerSerializeRequest, options?: Configuration): Promise> { + return this.api.fakePropertyEnumIntegerSerializeWithHttpInfo(param.outerObjectWithEnumProperty, options).toPromise(); + } + + /** + * Test serialization of enum (int) properties with examples + * @param param the request object + */ + public fakePropertyEnumIntegerSerialize(param: FakeApiFakePropertyEnumIntegerSerializeRequest, options?: Configuration): Promise { + return this.api.fakePropertyEnumIntegerSerialize(param.outerObjectWithEnumProperty, options).toPromise(); + } + + /** + * For this test, the body has to be a binary file. + * @param param the request object + */ + public testBodyWithBinaryWithHttpInfo(param: FakeApiTestBodyWithBinaryRequest, options?: Configuration): Promise> { + return this.api.testBodyWithBinaryWithHttpInfo(param.body, options).toPromise(); + } + + /** + * For this test, the body has to be a binary file. + * @param param the request object + */ + public testBodyWithBinary(param: FakeApiTestBodyWithBinaryRequest, options?: Configuration): Promise { + return this.api.testBodyWithBinary(param.body, options).toPromise(); + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param param the request object + */ + public testBodyWithFileSchemaWithHttpInfo(param: FakeApiTestBodyWithFileSchemaRequest, options?: Configuration): Promise> { + return this.api.testBodyWithFileSchemaWithHttpInfo(param.fileSchemaTestClass, options).toPromise(); + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param param the request object + */ + public testBodyWithFileSchema(param: FakeApiTestBodyWithFileSchemaRequest, options?: Configuration): Promise { + return this.api.testBodyWithFileSchema(param.fileSchemaTestClass, options).toPromise(); + } + + /** + * @param param the request object + */ + public testBodyWithQueryParamsWithHttpInfo(param: FakeApiTestBodyWithQueryParamsRequest, options?: Configuration): Promise> { + return this.api.testBodyWithQueryParamsWithHttpInfo(param.query, param.user, options).toPromise(); + } + + /** + * @param param the request object + */ + public testBodyWithQueryParams(param: FakeApiTestBodyWithQueryParamsRequest, options?: Configuration): Promise { + return this.api.testBodyWithQueryParams(param.query, param.user, options).toPromise(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param param the request object + */ + public testClientModelWithHttpInfo(param: FakeApiTestClientModelRequest, options?: Configuration): Promise> { + return this.api.testClientModelWithHttpInfo(param.client, options).toPromise(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param param the request object + */ + public testClientModel(param: FakeApiTestClientModelRequest, options?: Configuration): Promise { + return this.api.testClientModel(param.client, options).toPromise(); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param param the request object + */ + public testEndpointParametersWithHttpInfo(param: FakeApiTestEndpointParametersRequest, options?: Configuration): Promise> { + return this.api.testEndpointParametersWithHttpInfo(param.number, param._double, param.patternWithoutDelimiter, param._byte, param.integer, param.int32, param.int64, param._float, param.string, param.binary, param.date, param.dateTime, param.password, param.callback, options).toPromise(); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param param the request object + */ + public testEndpointParameters(param: FakeApiTestEndpointParametersRequest, options?: Configuration): Promise { + return this.api.testEndpointParameters(param.number, param._double, param.patternWithoutDelimiter, param._byte, param.integer, param.int32, param.int64, param._float, param.string, param.binary, param.date, param.dateTime, param.password, param.callback, options).toPromise(); + } + + /** + * To test enum parameters + * To test enum parameters + * @param param the request object + */ + public testEnumParametersWithHttpInfo(param: FakeApiTestEnumParametersRequest = {}, options?: Configuration): Promise> { + return this.api.testEnumParametersWithHttpInfo(param.enumHeaderStringArray, param.enumHeaderString, param.enumQueryStringArray, param.enumQueryString, param.enumQueryInteger, param.enumQueryDouble, param.enumQueryModelArray, param.enumFormStringArray, param.enumFormString, options).toPromise(); + } + + /** + * To test enum parameters + * To test enum parameters + * @param param the request object + */ + public testEnumParameters(param: FakeApiTestEnumParametersRequest = {}, options?: Configuration): Promise { + return this.api.testEnumParameters(param.enumHeaderStringArray, param.enumHeaderString, param.enumQueryStringArray, param.enumQueryString, param.enumQueryInteger, param.enumQueryDouble, param.enumQueryModelArray, param.enumFormStringArray, param.enumFormString, options).toPromise(); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param param the request object + */ + public testGroupParametersWithHttpInfo(param: FakeApiTestGroupParametersRequest, options?: Configuration): Promise> { + return this.api.testGroupParametersWithHttpInfo(param.requiredStringGroup, param.requiredBooleanGroup, param.requiredInt64Group, param.stringGroup, param.booleanGroup, param.int64Group, options).toPromise(); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param param the request object + */ + public testGroupParameters(param: FakeApiTestGroupParametersRequest, options?: Configuration): Promise { + return this.api.testGroupParameters(param.requiredStringGroup, param.requiredBooleanGroup, param.requiredInt64Group, param.stringGroup, param.booleanGroup, param.int64Group, options).toPromise(); + } + + /** + * + * test inline additionalProperties + * @param param the request object + */ + public testInlineAdditionalPropertiesWithHttpInfo(param: FakeApiTestInlineAdditionalPropertiesRequest, options?: Configuration): Promise> { + return this.api.testInlineAdditionalPropertiesWithHttpInfo(param.requestBody, options).toPromise(); + } + + /** + * + * test inline additionalProperties + * @param param the request object + */ + public testInlineAdditionalProperties(param: FakeApiTestInlineAdditionalPropertiesRequest, options?: Configuration): Promise { + return this.api.testInlineAdditionalProperties(param.requestBody, options).toPromise(); + } + + /** + * + * test json serialization of form data + * @param param the request object + */ + public testJsonFormDataWithHttpInfo(param: FakeApiTestJsonFormDataRequest, options?: Configuration): Promise> { + return this.api.testJsonFormDataWithHttpInfo(param.param, param.param2, options).toPromise(); + } + + /** + * + * test json serialization of form data + * @param param the request object + */ + public testJsonFormData(param: FakeApiTestJsonFormDataRequest, options?: Configuration): Promise { + return this.api.testJsonFormData(param.param, param.param2, options).toPromise(); + } + + /** + * To test the collection format in query parameters + * @param param the request object + */ + public testQueryParameterCollectionFormatWithHttpInfo(param: FakeApiTestQueryParameterCollectionFormatRequest, options?: Configuration): Promise> { + return this.api.testQueryParameterCollectionFormatWithHttpInfo(param.pipe, param.ioutil, param.http, param.url, param.context, param.allowEmpty, param.language, options).toPromise(); + } + + /** + * To test the collection format in query parameters + * @param param the request object + */ + public testQueryParameterCollectionFormat(param: FakeApiTestQueryParameterCollectionFormatRequest, options?: Configuration): Promise { + return this.api.testQueryParameterCollectionFormat(param.pipe, param.ioutil, param.http, param.url, param.context, param.allowEmpty, param.language, options).toPromise(); + } + +} + +import { ObservableFakeClassnameTags123Api } from "./ObservableAPI"; +import { FakeClassnameTags123ApiRequestFactory, FakeClassnameTags123ApiResponseProcessor} from "../apis/FakeClassnameTags123Api"; + +export interface FakeClassnameTags123ApiTestClassnameRequest { + /** + * client model + * @type Client + * @memberof FakeClassnameTags123ApitestClassname + */ + client: Client +} + +export class ObjectFakeClassnameTags123Api { + private api: ObservableFakeClassnameTags123Api + + public constructor(configuration: Configuration, requestFactory?: FakeClassnameTags123ApiRequestFactory, responseProcessor?: FakeClassnameTags123ApiResponseProcessor) { + this.api = new ObservableFakeClassnameTags123Api(configuration, requestFactory, responseProcessor); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param param the request object + */ + public testClassnameWithHttpInfo(param: FakeClassnameTags123ApiTestClassnameRequest, options?: Configuration): Promise> { + return this.api.testClassnameWithHttpInfo(param.client, options).toPromise(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param param the request object + */ + public testClassname(param: FakeClassnameTags123ApiTestClassnameRequest, options?: Configuration): Promise { + return this.api.testClassname(param.client, options).toPromise(); + } + +} + +import { ObservablePetApi } from "./ObservableAPI"; +import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; + +export interface PetApiAddPetRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof PetApiaddPet + */ + pet: Pet +} + +export interface PetApiDeletePetRequest { + /** + * Pet id to delete + * @type number + * @memberof PetApideletePet + */ + petId: number + /** + * + * @type string + * @memberof PetApideletePet + */ + apiKey?: string +} + +export interface PetApiFindPetsByStatusRequest { + /** + * Status values that need to be considered for filter + * @type Array<'available' | 'pending' | 'sold'> + * @memberof PetApifindPetsByStatus + */ + status: Array<'available' | 'pending' | 'sold'> +} + +export interface PetApiFindPetsByTagsRequest { + /** + * Tags to filter by + * @type Set<string> + * @memberof PetApifindPetsByTags + */ + tags: Set +} + +export interface PetApiGetPetByIdRequest { + /** + * ID of pet to return + * @type number + * @memberof PetApigetPetById + */ + petId: number +} + +export interface PetApiUpdatePetRequest { + /** + * Pet object that needs to be added to the store + * @type Pet + * @memberof PetApiupdatePet + */ + pet: Pet +} + +export interface PetApiUpdatePetWithFormRequest { + /** + * ID of pet that needs to be updated + * @type number + * @memberof PetApiupdatePetWithForm + */ + petId: number + /** + * Updated name of the pet + * @type string + * @memberof PetApiupdatePetWithForm + */ + name?: string + /** + * Updated status of the pet + * @type string + * @memberof PetApiupdatePetWithForm + */ + status?: string +} + +export interface PetApiUploadFileRequest { + /** + * ID of pet to update + * @type number + * @memberof PetApiuploadFile + */ + petId: number + /** + * Additional data to pass to server + * @type string + * @memberof PetApiuploadFile + */ + additionalMetadata?: string + /** + * file to upload + * @type HttpFile + * @memberof PetApiuploadFile + */ + file?: HttpFile +} + +export interface PetApiUploadFileWithRequiredFileRequest { + /** + * ID of pet to update + * @type number + * @memberof PetApiuploadFileWithRequiredFile + */ + petId: number + /** + * file to upload + * @type HttpFile + * @memberof PetApiuploadFileWithRequiredFile + */ + requiredFile: HttpFile + /** + * Additional data to pass to server + * @type string + * @memberof PetApiuploadFileWithRequiredFile + */ + additionalMetadata?: string +} + +export class ObjectPetApi { + private api: ObservablePetApi + + public constructor(configuration: Configuration, requestFactory?: PetApiRequestFactory, responseProcessor?: PetApiResponseProcessor) { + this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); + } + + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPetWithHttpInfo(param: PetApiAddPetRequest, options?: Configuration): Promise> { + return this.api.addPetWithHttpInfo(param.pet, options).toPromise(); + } + + /** + * + * Add a new pet to the store + * @param param the request object + */ + public addPet(param: PetApiAddPetRequest, options?: Configuration): Promise { + return this.api.addPet(param.pet, options).toPromise(); + } + + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePetWithHttpInfo(param: PetApiDeletePetRequest, options?: Configuration): Promise> { + return this.api.deletePetWithHttpInfo(param.petId, param.apiKey, options).toPromise(); + } + + /** + * + * Deletes a pet + * @param param the request object + */ + public deletePet(param: PetApiDeletePetRequest, options?: Configuration): Promise { + return this.api.deletePet(param.petId, param.apiKey, options).toPromise(); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatusWithHttpInfo(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise>> { + return this.api.findPetsByStatusWithHttpInfo(param.status, options).toPromise(); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param param the request object + */ + public findPetsByStatus(param: PetApiFindPetsByStatusRequest, options?: Configuration): Promise> { + return this.api.findPetsByStatus(param.status, options).toPromise(); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTagsWithHttpInfo(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise>> { + return this.api.findPetsByTagsWithHttpInfo(param.tags, options).toPromise(); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param param the request object + */ + public findPetsByTags(param: PetApiFindPetsByTagsRequest, options?: Configuration): Promise> { + return this.api.findPetsByTags(param.tags, options).toPromise(); + } + + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetByIdWithHttpInfo(param: PetApiGetPetByIdRequest, options?: Configuration): Promise> { + return this.api.getPetByIdWithHttpInfo(param.petId, options).toPromise(); + } + + /** + * Returns a single pet + * Find pet by ID + * @param param the request object + */ + public getPetById(param: PetApiGetPetByIdRequest, options?: Configuration): Promise { + return this.api.getPetById(param.petId, options).toPromise(); + } + + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePetWithHttpInfo(param: PetApiUpdatePetRequest, options?: Configuration): Promise> { + return this.api.updatePetWithHttpInfo(param.pet, options).toPromise(); + } + + /** + * + * Update an existing pet + * @param param the request object + */ + public updatePet(param: PetApiUpdatePetRequest, options?: Configuration): Promise { + return this.api.updatePet(param.pet, options).toPromise(); + } + + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithFormWithHttpInfo(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise> { + return this.api.updatePetWithFormWithHttpInfo(param.petId, param.name, param.status, options).toPromise(); + } + + /** + * + * Updates a pet in the store with form data + * @param param the request object + */ + public updatePetWithForm(param: PetApiUpdatePetWithFormRequest, options?: Configuration): Promise { + return this.api.updatePetWithForm(param.petId, param.name, param.status, options).toPromise(); + } + + /** + * + * uploads an image + * @param param the request object + */ + public uploadFileWithHttpInfo(param: PetApiUploadFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithHttpInfo(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + + /** + * + * uploads an image + * @param param the request object + */ + public uploadFile(param: PetApiUploadFileRequest, options?: Configuration): Promise { + return this.api.uploadFile(param.petId, param.additionalMetadata, param.file, options).toPromise(); + } + + /** + * + * uploads an image (required) + * @param param the request object + */ + public uploadFileWithRequiredFileWithHttpInfo(param: PetApiUploadFileWithRequiredFileRequest, options?: Configuration): Promise> { + return this.api.uploadFileWithRequiredFileWithHttpInfo(param.petId, param.requiredFile, param.additionalMetadata, options).toPromise(); + } + + /** + * + * uploads an image (required) + * @param param the request object + */ + public uploadFileWithRequiredFile(param: PetApiUploadFileWithRequiredFileRequest, options?: Configuration): Promise { + return this.api.uploadFileWithRequiredFile(param.petId, param.requiredFile, param.additionalMetadata, options).toPromise(); + } + +} + +import { ObservableStoreApi } from "./ObservableAPI"; +import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; + +export interface StoreApiDeleteOrderRequest { + /** + * ID of the order that needs to be deleted + * @type string + * @memberof StoreApideleteOrder + */ + orderId: string +} + +export interface StoreApiGetInventoryRequest { +} + +export interface StoreApiGetOrderByIdRequest { + /** + * ID of pet that needs to be fetched + * @type number + * @memberof StoreApigetOrderById + */ + orderId: number +} + +export interface StoreApiPlaceOrderRequest { + /** + * order placed for purchasing the pet + * @type Order + * @memberof StoreApiplaceOrder + */ + order: Order +} + +export class ObjectStoreApi { + private api: ObservableStoreApi + + public constructor(configuration: Configuration, requestFactory?: StoreApiRequestFactory, responseProcessor?: StoreApiResponseProcessor) { + this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrderWithHttpInfo(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise> { + return this.api.deleteOrderWithHttpInfo(param.orderId, options).toPromise(); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param param the request object + */ + public deleteOrder(param: StoreApiDeleteOrderRequest, options?: Configuration): Promise { + return this.api.deleteOrder(param.orderId, options).toPromise(); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventoryWithHttpInfo(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise> { + return this.api.getInventoryWithHttpInfo( options).toPromise(); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + * @param param the request object + */ + public getInventory(param: StoreApiGetInventoryRequest = {}, options?: Configuration): Promise<{ [key: string]: number; }> { + return this.api.getInventory( options).toPromise(); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderByIdWithHttpInfo(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise> { + return this.api.getOrderByIdWithHttpInfo(param.orderId, options).toPromise(); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param param the request object + */ + public getOrderById(param: StoreApiGetOrderByIdRequest, options?: Configuration): Promise { + return this.api.getOrderById(param.orderId, options).toPromise(); + } + + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrderWithHttpInfo(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise> { + return this.api.placeOrderWithHttpInfo(param.order, options).toPromise(); + } + + /** + * + * Place an order for a pet + * @param param the request object + */ + public placeOrder(param: StoreApiPlaceOrderRequest, options?: Configuration): Promise { + return this.api.placeOrder(param.order, options).toPromise(); + } + +} + +import { ObservableUserApi } from "./ObservableAPI"; +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; + +export interface UserApiCreateUserRequest { + /** + * Created user object + * @type User + * @memberof UserApicreateUser + */ + user: User +} + +export interface UserApiCreateUsersWithArrayInputRequest { + /** + * List of user object + * @type Array<User> + * @memberof UserApicreateUsersWithArrayInput + */ + user: Array +} + +export interface UserApiCreateUsersWithListInputRequest { + /** + * List of user object + * @type Array<User> + * @memberof UserApicreateUsersWithListInput + */ + user: Array +} + +export interface UserApiDeleteUserRequest { + /** + * The name that needs to be deleted + * @type string + * @memberof UserApideleteUser + */ + username: string +} + +export interface UserApiGetUserByNameRequest { + /** + * The name that needs to be fetched. Use user1 for testing. + * @type string + * @memberof UserApigetUserByName + */ + username: string +} + +export interface UserApiLoginUserRequest { + /** + * The user name for login + * @type string + * @memberof UserApiloginUser + */ + username: string + /** + * The password for login in clear text + * @type string + * @memberof UserApiloginUser + */ + password: string +} + +export interface UserApiLogoutUserRequest { +} + +export interface UserApiUpdateUserRequest { + /** + * name that need to be deleted + * @type string + * @memberof UserApiupdateUser + */ + username: string + /** + * Updated user object + * @type User + * @memberof UserApiupdateUser + */ + user: User +} + +export class ObjectUserApi { + private api: ObservableUserApi + + public constructor(configuration: Configuration, requestFactory?: UserApiRequestFactory, responseProcessor?: UserApiResponseProcessor) { + this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUserWithHttpInfo(param: UserApiCreateUserRequest, options?: Configuration): Promise> { + return this.api.createUserWithHttpInfo(param.user, options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param param the request object + */ + public createUser(param: UserApiCreateUserRequest, options?: Configuration): Promise { + return this.api.createUser(param.user, options).toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInputWithHttpInfo(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithArrayInputWithHttpInfo(param.user, options).toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithArrayInput(param: UserApiCreateUsersWithArrayInputRequest, options?: Configuration): Promise { + return this.api.createUsersWithArrayInput(param.user, options).toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInputWithHttpInfo(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise> { + return this.api.createUsersWithListInputWithHttpInfo(param.user, options).toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param param the request object + */ + public createUsersWithListInput(param: UserApiCreateUsersWithListInputRequest, options?: Configuration): Promise { + return this.api.createUsersWithListInput(param.user, options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUserWithHttpInfo(param: UserApiDeleteUserRequest, options?: Configuration): Promise> { + return this.api.deleteUserWithHttpInfo(param.username, options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param param the request object + */ + public deleteUser(param: UserApiDeleteUserRequest, options?: Configuration): Promise { + return this.api.deleteUser(param.username, options).toPromise(); + } + + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByNameWithHttpInfo(param: UserApiGetUserByNameRequest, options?: Configuration): Promise> { + return this.api.getUserByNameWithHttpInfo(param.username, options).toPromise(); + } + + /** + * + * Get user by user name + * @param param the request object + */ + public getUserByName(param: UserApiGetUserByNameRequest, options?: Configuration): Promise { + return this.api.getUserByName(param.username, options).toPromise(); + } + + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUserWithHttpInfo(param: UserApiLoginUserRequest, options?: Configuration): Promise> { + return this.api.loginUserWithHttpInfo(param.username, param.password, options).toPromise(); + } + + /** + * + * Logs user into the system + * @param param the request object + */ + public loginUser(param: UserApiLoginUserRequest, options?: Configuration): Promise { + return this.api.loginUser(param.username, param.password, options).toPromise(); + } + + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUserWithHttpInfo(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise> { + return this.api.logoutUserWithHttpInfo( options).toPromise(); + } + + /** + * + * Logs out current logged in user session + * @param param the request object + */ + public logoutUser(param: UserApiLogoutUserRequest = {}, options?: Configuration): Promise { + return this.api.logoutUser( options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUserWithHttpInfo(param: UserApiUpdateUserRequest, options?: Configuration): Promise> { + return this.api.updateUserWithHttpInfo(param.username, param.user, options).toPromise(); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param param the request object + */ + public updateUser(param: UserApiUpdateUserRequest, options?: Configuration): Promise { + return this.api.updateUser(param.username, param.user, options).toPromise(); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObservableAPI.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObservableAPI.ts new file mode 100644 index 000000000000..ad503a478a0b --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/types/ObservableAPI.ts @@ -0,0 +1,1613 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration} from '../configuration' +import { Observable, of, from } from '../rxjsStub'; +import {mergeMap, map} from '../rxjsStub'; +import { AdditionalPropertiesClass } from '../models/AdditionalPropertiesClass'; +import { AllOfWithSingleRef } from '../models/AllOfWithSingleRef'; +import { Animal } from '../models/Animal'; +import { ApiResponse } from '../models/ApiResponse'; +import { ArrayOfArrayOfNumberOnly } from '../models/ArrayOfArrayOfNumberOnly'; +import { ArrayOfNumberOnly } from '../models/ArrayOfNumberOnly'; +import { ArrayTest } from '../models/ArrayTest'; +import { Capitalization } from '../models/Capitalization'; +import { Cat } from '../models/Cat'; +import { Category } from '../models/Category'; +import { ClassModel } from '../models/ClassModel'; +import { Client } from '../models/Client'; +import { DeprecatedObject } from '../models/DeprecatedObject'; +import { Dog } from '../models/Dog'; +import { EnumArrays } from '../models/EnumArrays'; +import { EnumClass } from '../models/EnumClass'; +import { EnumTest } from '../models/EnumTest'; +import { FakeBigDecimalMap200Response } from '../models/FakeBigDecimalMap200Response'; +import { FileSchemaTestClass } from '../models/FileSchemaTestClass'; +import { Foo } from '../models/Foo'; +import { FooGetDefaultResponse } from '../models/FooGetDefaultResponse'; +import { FormatTest } from '../models/FormatTest'; +import { HasOnlyReadOnly } from '../models/HasOnlyReadOnly'; +import { HealthCheckResult } from '../models/HealthCheckResult'; +import { List } from '../models/List'; +import { MapTest } from '../models/MapTest'; +import { MixedPropertiesAndAdditionalPropertiesClass } from '../models/MixedPropertiesAndAdditionalPropertiesClass'; +import { Model200Response } from '../models/Model200Response'; +import { ModelFile } from '../models/ModelFile'; +import { Name } from '../models/Name'; +import { NullableClass } from '../models/NullableClass'; +import { NumberOnly } from '../models/NumberOnly'; +import { ObjectWithDeprecatedFields } from '../models/ObjectWithDeprecatedFields'; +import { Order } from '../models/Order'; +import { OuterComposite } from '../models/OuterComposite'; +import { OuterEnum } from '../models/OuterEnum'; +import { OuterEnumDefaultValue } from '../models/OuterEnumDefaultValue'; +import { OuterEnumInteger } from '../models/OuterEnumInteger'; +import { OuterEnumIntegerDefaultValue } from '../models/OuterEnumIntegerDefaultValue'; +import { OuterObjectWithEnumProperty } from '../models/OuterObjectWithEnumProperty'; +import { Pet } from '../models/Pet'; +import { ReadOnlyFirst } from '../models/ReadOnlyFirst'; +import { Return } from '../models/Return'; +import { SingleRefType } from '../models/SingleRefType'; +import { SpecialModelName } from '../models/SpecialModelName'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; + +import { AnotherFakeApiRequestFactory, AnotherFakeApiResponseProcessor} from "../apis/AnotherFakeApi"; +export class ObservableAnotherFakeApi { + private requestFactory: AnotherFakeApiRequestFactory; + private responseProcessor: AnotherFakeApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: AnotherFakeApiRequestFactory, + responseProcessor?: AnotherFakeApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new AnotherFakeApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new AnotherFakeApiResponseProcessor(); + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param client client model + */ + public _123testSpecialTagsWithHttpInfo(client: Client, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory._123testSpecialTags(client, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor._123testSpecialTagsWithHttpInfo(rsp))); + })); + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param client client model + */ + public _123testSpecialTags(client: Client, _options?: Configuration): Observable { + return this._123testSpecialTagsWithHttpInfo(client, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/DefaultApi"; +export class ObservableDefaultApi { + private requestFactory: DefaultApiRequestFactory; + private responseProcessor: DefaultApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: DefaultApiRequestFactory, + responseProcessor?: DefaultApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new DefaultApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new DefaultApiResponseProcessor(); + } + + /** + */ + public fooGetWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fooGet(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fooGetWithHttpInfo(rsp))); + })); + } + + /** + */ + public fooGet(_options?: Configuration): Observable { + return this.fooGetWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { FakeApiRequestFactory, FakeApiResponseProcessor} from "../apis/FakeApi"; +export class ObservableFakeApi { + private requestFactory: FakeApiRequestFactory; + private responseProcessor: FakeApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: FakeApiRequestFactory, + responseProcessor?: FakeApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new FakeApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new FakeApiResponseProcessor(); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + public fakeBigDecimalMapWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeBigDecimalMap(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeBigDecimalMapWithHttpInfo(rsp))); + })); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + public fakeBigDecimalMap(_options?: Configuration): Observable { + return this.fakeBigDecimalMapWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Health check endpoint + */ + public fakeHealthGetWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeHealthGet(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeHealthGetWithHttpInfo(rsp))); + })); + } + + /** + * Health check endpoint + */ + public fakeHealthGet(_options?: Configuration): Observable { + return this.fakeHealthGetWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * test http signature authentication + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter + * @param header1 header parameter + */ + public fakeHttpSignatureTestWithHttpInfo(pet: Pet, query1?: string, header1?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeHttpSignatureTest(pet, query1, header1, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeHttpSignatureTestWithHttpInfo(rsp))); + })); + } + + /** + * test http signature authentication + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter + * @param header1 header parameter + */ + public fakeHttpSignatureTest(pet: Pet, query1?: string, header1?: string, _options?: Configuration): Observable { + return this.fakeHttpSignatureTestWithHttpInfo(pet, query1, header1, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test serialization of outer boolean types + * @param body Input boolean as post body + */ + public fakeOuterBooleanSerializeWithHttpInfo(body?: boolean, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeOuterBooleanSerialize(body, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeOuterBooleanSerializeWithHttpInfo(rsp))); + })); + } + + /** + * Test serialization of outer boolean types + * @param body Input boolean as post body + */ + public fakeOuterBooleanSerialize(body?: boolean, _options?: Configuration): Observable { + return this.fakeOuterBooleanSerializeWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body + */ + public fakeOuterCompositeSerializeWithHttpInfo(outerComposite?: OuterComposite, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeOuterCompositeSerialize(outerComposite, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeOuterCompositeSerializeWithHttpInfo(rsp))); + })); + } + + /** + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body + */ + public fakeOuterCompositeSerialize(outerComposite?: OuterComposite, _options?: Configuration): Observable { + return this.fakeOuterCompositeSerializeWithHttpInfo(outerComposite, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test serialization of outer number types + * @param body Input number as post body + */ + public fakeOuterNumberSerializeWithHttpInfo(body?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeOuterNumberSerialize(body, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeOuterNumberSerializeWithHttpInfo(rsp))); + })); + } + + /** + * Test serialization of outer number types + * @param body Input number as post body + */ + public fakeOuterNumberSerialize(body?: number, _options?: Configuration): Observable { + return this.fakeOuterNumberSerializeWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test serialization of outer string types + * @param body Input string as post body + */ + public fakeOuterStringSerializeWithHttpInfo(body?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakeOuterStringSerialize(body, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakeOuterStringSerializeWithHttpInfo(rsp))); + })); + } + + /** + * Test serialization of outer string types + * @param body Input string as post body + */ + public fakeOuterStringSerialize(body?: string, _options?: Configuration): Observable { + return this.fakeOuterStringSerializeWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + */ + public fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty: OuterObjectWithEnumProperty, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.fakePropertyEnumIntegerSerializeWithHttpInfo(rsp))); + })); + } + + /** + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + */ + public fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty: OuterObjectWithEnumProperty, _options?: Configuration): Observable { + return this.fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * For this test, the body has to be a binary file. + * @param body image to upload + */ + public testBodyWithBinaryWithHttpInfo(body: HttpFile, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBodyWithBinary(body, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBodyWithBinaryWithHttpInfo(rsp))); + })); + } + + /** + * For this test, the body has to be a binary file. + * @param body image to upload + */ + public testBodyWithBinary(body: HttpFile, _options?: Configuration): Observable { + return this.testBodyWithBinaryWithHttpInfo(body, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + */ + public testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass: FileSchemaTestClass, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBodyWithFileSchema(fileSchemaTestClass, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBodyWithFileSchemaWithHttpInfo(rsp))); + })); + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + */ + public testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, _options?: Configuration): Observable { + return this.testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * @param query + * @param user + */ + public testBodyWithQueryParamsWithHttpInfo(query: string, user: User, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testBodyWithQueryParams(query, user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testBodyWithQueryParamsWithHttpInfo(rsp))); + })); + } + + /** + * @param query + * @param user + */ + public testBodyWithQueryParams(query: string, user: User, _options?: Configuration): Observable { + return this.testBodyWithQueryParamsWithHttpInfo(query, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model + */ + public testClientModelWithHttpInfo(client: Client, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testClientModel(client, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testClientModelWithHttpInfo(rsp))); + })); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model + */ + public testClientModel(client: Client, _options?: Configuration): Observable { + return this.testClientModelWithHttpInfo(client, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param _double None + * @param patternWithoutDelimiter None + * @param _byte None + * @param integer None + * @param int32 None + * @param int64 None + * @param _float None + * @param string None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @param callback None + */ + public testEndpointParametersWithHttpInfo(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: HttpFile, date?: string, dateTime?: Date, password?: string, callback?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEndpointParametersWithHttpInfo(rsp))); + })); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param _double None + * @param patternWithoutDelimiter None + * @param _byte None + * @param integer None + * @param int32 None + * @param int64 None + * @param _float None + * @param string None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @param callback None + */ + public testEndpointParameters(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: HttpFile, date?: string, dateTime?: Date, password?: string, callback?: string, _options?: Configuration): Observable { + return this.testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @param enumQueryModelArray + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + */ + public testEnumParametersWithHttpInfo(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumQueryModelArray?: Array, enumFormStringArray?: Array, enumFormString?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testEnumParametersWithHttpInfo(rsp))); + })); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @param enumQueryModelArray + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + */ + public testEnumParameters(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumQueryModelArray?: Array, enumFormStringArray?: Array, enumFormString?: string, _options?: Configuration): Observable { + return this.testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters + * @param booleanGroup Boolean in group parameters + * @param int64Group Integer in group parameters + */ + public testGroupParametersWithHttpInfo(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testGroupParametersWithHttpInfo(rsp))); + })); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters + * @param booleanGroup Boolean in group parameters + * @param int64Group Integer in group parameters + */ + public testGroupParameters(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, _options?: Configuration): Observable { + return this.testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * test inline additionalProperties + * @param requestBody request body + */ + public testInlineAdditionalPropertiesWithHttpInfo(requestBody: { [key: string]: string; }, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testInlineAdditionalProperties(requestBody, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testInlineAdditionalPropertiesWithHttpInfo(rsp))); + })); + } + + /** + * + * test inline additionalProperties + * @param requestBody request body + */ + public testInlineAdditionalProperties(requestBody: { [key: string]: string; }, _options?: Configuration): Observable { + return this.testInlineAdditionalPropertiesWithHttpInfo(requestBody, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * test json serialization of form data + * @param param field1 + * @param param2 field2 + */ + public testJsonFormDataWithHttpInfo(param: string, param2: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testJsonFormData(param, param2, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testJsonFormDataWithHttpInfo(rsp))); + })); + } + + /** + * + * test json serialization of form data + * @param param field1 + * @param param2 field2 + */ + public testJsonFormData(param: string, param2: string, _options?: Configuration): Observable { + return this.testJsonFormDataWithHttpInfo(param, param2, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language + */ + public testQueryParameterCollectionFormatWithHttpInfo(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, allowEmpty: string, language?: { [key: string]: string; }, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testQueryParameterCollectionFormatWithHttpInfo(rsp))); + })); + } + + /** + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language + */ + public testQueryParameterCollectionFormat(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, allowEmpty: string, language?: { [key: string]: string; }, _options?: Configuration): Observable { + return this.testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { FakeClassnameTags123ApiRequestFactory, FakeClassnameTags123ApiResponseProcessor} from "../apis/FakeClassnameTags123Api"; +export class ObservableFakeClassnameTags123Api { + private requestFactory: FakeClassnameTags123ApiRequestFactory; + private responseProcessor: FakeClassnameTags123ApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: FakeClassnameTags123ApiRequestFactory, + responseProcessor?: FakeClassnameTags123ApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new FakeClassnameTags123ApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new FakeClassnameTags123ApiResponseProcessor(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model + */ + public testClassnameWithHttpInfo(client: Client, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.testClassname(client, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.testClassnameWithHttpInfo(rsp))); + })); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model + */ + public testClassname(client: Client, _options?: Configuration): Observable { + return this.testClassnameWithHttpInfo(client, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; +export class ObservablePetApi { + private requestFactory: PetApiRequestFactory; + private responseProcessor: PetApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: PetApiRequestFactory, + responseProcessor?: PetApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new PetApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new PetApiResponseProcessor(); + } + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.addPet(pet, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.addPetWithHttpInfo(rsp))); + })); + } + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Observable { + return this.addPetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.deletePet(petId, apiKey, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deletePetWithHttpInfo(rsp))); + })); + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Observable { + return this.deletePetWithHttpInfo(petId, apiKey, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable>> { + const requestContextPromise = this.requestFactory.findPetsByStatus(status, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByStatusWithHttpInfo(rsp))); + })); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Observable> { + return this.findPetsByStatusWithHttpInfo(status, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Set, _options?: Configuration): Observable>> { + const requestContextPromise = this.requestFactory.findPetsByTags(tags, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.findPetsByTagsWithHttpInfo(rsp))); + })); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Set, _options?: Configuration): Observable> { + return this.findPetsByTagsWithHttpInfo(tags, _options).pipe(map((apiResponse: HttpInfo>) => apiResponse.data)); + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getPetById(petId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getPetByIdWithHttpInfo(rsp))); + })); + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Observable { + return this.getPetByIdWithHttpInfo(petId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.updatePet(pet, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithHttpInfo(rsp))); + })); + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Observable { + return this.updatePetWithHttpInfo(pet, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.updatePetWithForm(petId, name, status, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updatePetWithFormWithHttpInfo(rsp))); + })); + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Observable { + return this.updatePetWithFormWithHttpInfo(petId, name, status, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.uploadFile(petId, additionalMetadata, file, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithHttpInfo(rsp))); + })); + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Observable { + return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * uploads an image (required) + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server + */ + public uploadFileWithRequiredFileWithHttpInfo(petId: number, requiredFile: HttpFile, additionalMetadata?: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.uploadFileWithRequiredFileWithHttpInfo(rsp))); + })); + } + + /** + * + * uploads an image (required) + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server + */ + public uploadFileWithRequiredFile(petId: number, requiredFile: HttpFile, additionalMetadata?: string, _options?: Configuration): Observable { + return this.uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; +export class ObservableStoreApi { + private requestFactory: StoreApiRequestFactory; + private responseProcessor: StoreApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: StoreApiRequestFactory, + responseProcessor?: StoreApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new StoreApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new StoreApiResponseProcessor(); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.deleteOrder(orderId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteOrderWithHttpInfo(rsp))); + })); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Observable { + return this.deleteOrderWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getInventory(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getInventoryWithHttpInfo(rsp))); + })); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Observable<{ [key: string]: number; }> { + return this.getInventoryWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo<{ [key: string]: number; }>) => apiResponse.data)); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getOrderById(orderId, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getOrderByIdWithHttpInfo(rsp))); + })); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Observable { + return this.getOrderByIdWithHttpInfo(orderId, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.placeOrder(order, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.placeOrderWithHttpInfo(rsp))); + })); + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Observable { + return this.placeOrderWithHttpInfo(order, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} + +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +export class ObservableUserApi { + private requestFactory: UserApiRequestFactory; + private responseProcessor: UserApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: UserApiRequestFactory, + responseProcessor?: UserApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = requestFactory || new UserApiRequestFactory(configuration); + this.responseProcessor = responseProcessor || new UserApiResponseProcessor(); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.createUser(user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUserWithHttpInfo(rsp))); + })); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Observable { + return this.createUserWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.createUsersWithArrayInput(user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithArrayInputWithHttpInfo(rsp))); + })); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithArrayInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.createUsersWithListInput(user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.createUsersWithListInputWithHttpInfo(rsp))); + })); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Observable { + return this.createUsersWithListInputWithHttpInfo(user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.deleteUser(username, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.deleteUserWithHttpInfo(rsp))); + })); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Observable { + return this.deleteUserWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.getUserByName(username, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.getUserByNameWithHttpInfo(rsp))); + })); + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Observable { + return this.getUserByNameWithHttpInfo(username, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.loginUser(username, password, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.loginUserWithHttpInfo(rsp))); + })); + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Observable { + return this.loginUserWithHttpInfo(username, password, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.logoutUser(_options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.logoutUserWithHttpInfo(rsp))); + })); + } + + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Observable { + return this.logoutUserWithHttpInfo(_options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Observable> { + const requestContextPromise = this.requestFactory.updateUser(username, user, _options); + + // build promise chain + let middlewarePreObservable = from(requestContextPromise); + for (const middleware of this.configuration.middleware) { + middlewarePreObservable = middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => middleware.pre(ctx))); + } + + return middlewarePreObservable.pipe(mergeMap((ctx: RequestContext) => this.configuration.httpApi.send(ctx))). + pipe(mergeMap((response: ResponseContext) => { + let middlewarePostObservable = of(response); + for (const middleware of this.configuration.middleware) { + middlewarePostObservable = middlewarePostObservable.pipe(mergeMap((rsp: ResponseContext) => middleware.post(rsp))); + } + return middlewarePostObservable.pipe(map((rsp: ResponseContext) => this.responseProcessor.updateUserWithHttpInfo(rsp))); + })); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Observable { + return this.updateUserWithHttpInfo(username, user, _options).pipe(map((apiResponse: HttpInfo) => apiResponse.data)); + } + +} diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/types/PromiseAPI.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/types/PromiseAPI.ts new file mode 100644 index 000000000000..657d0b600d22 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/types/PromiseAPI.ts @@ -0,0 +1,1073 @@ +import { ResponseContext, RequestContext, HttpFile, HttpInfo } from '../http/http'; +import { Configuration} from '../configuration' + +import { AdditionalPropertiesClass } from '../models/AdditionalPropertiesClass'; +import { AllOfWithSingleRef } from '../models/AllOfWithSingleRef'; +import { Animal } from '../models/Animal'; +import { ApiResponse } from '../models/ApiResponse'; +import { ArrayOfArrayOfNumberOnly } from '../models/ArrayOfArrayOfNumberOnly'; +import { ArrayOfNumberOnly } from '../models/ArrayOfNumberOnly'; +import { ArrayTest } from '../models/ArrayTest'; +import { Capitalization } from '../models/Capitalization'; +import { Cat } from '../models/Cat'; +import { Category } from '../models/Category'; +import { ClassModel } from '../models/ClassModel'; +import { Client } from '../models/Client'; +import { DeprecatedObject } from '../models/DeprecatedObject'; +import { Dog } from '../models/Dog'; +import { EnumArrays } from '../models/EnumArrays'; +import { EnumClass } from '../models/EnumClass'; +import { EnumTest } from '../models/EnumTest'; +import { FakeBigDecimalMap200Response } from '../models/FakeBigDecimalMap200Response'; +import { FileSchemaTestClass } from '../models/FileSchemaTestClass'; +import { Foo } from '../models/Foo'; +import { FooGetDefaultResponse } from '../models/FooGetDefaultResponse'; +import { FormatTest } from '../models/FormatTest'; +import { HasOnlyReadOnly } from '../models/HasOnlyReadOnly'; +import { HealthCheckResult } from '../models/HealthCheckResult'; +import { List } from '../models/List'; +import { MapTest } from '../models/MapTest'; +import { MixedPropertiesAndAdditionalPropertiesClass } from '../models/MixedPropertiesAndAdditionalPropertiesClass'; +import { Model200Response } from '../models/Model200Response'; +import { ModelFile } from '../models/ModelFile'; +import { Name } from '../models/Name'; +import { NullableClass } from '../models/NullableClass'; +import { NumberOnly } from '../models/NumberOnly'; +import { ObjectWithDeprecatedFields } from '../models/ObjectWithDeprecatedFields'; +import { Order } from '../models/Order'; +import { OuterComposite } from '../models/OuterComposite'; +import { OuterEnum } from '../models/OuterEnum'; +import { OuterEnumDefaultValue } from '../models/OuterEnumDefaultValue'; +import { OuterEnumInteger } from '../models/OuterEnumInteger'; +import { OuterEnumIntegerDefaultValue } from '../models/OuterEnumIntegerDefaultValue'; +import { OuterObjectWithEnumProperty } from '../models/OuterObjectWithEnumProperty'; +import { Pet } from '../models/Pet'; +import { ReadOnlyFirst } from '../models/ReadOnlyFirst'; +import { Return } from '../models/Return'; +import { SingleRefType } from '../models/SingleRefType'; +import { SpecialModelName } from '../models/SpecialModelName'; +import { Tag } from '../models/Tag'; +import { User } from '../models/User'; +import { ObservableAnotherFakeApi } from './ObservableAPI'; + +import { AnotherFakeApiRequestFactory, AnotherFakeApiResponseProcessor} from "../apis/AnotherFakeApi"; +export class PromiseAnotherFakeApi { + private api: ObservableAnotherFakeApi + + public constructor( + configuration: Configuration, + requestFactory?: AnotherFakeApiRequestFactory, + responseProcessor?: AnotherFakeApiResponseProcessor + ) { + this.api = new ObservableAnotherFakeApi(configuration, requestFactory, responseProcessor); + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param client client model + */ + public _123testSpecialTagsWithHttpInfo(client: Client, _options?: Configuration): Promise> { + const result = this.api._123testSpecialTagsWithHttpInfo(client, _options); + return result.toPromise(); + } + + /** + * To test special tags and operation ID starting with number + * To test special tags + * @param client client model + */ + public _123testSpecialTags(client: Client, _options?: Configuration): Promise { + const result = this.api._123testSpecialTags(client, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableDefaultApi } from './ObservableAPI'; + +import { DefaultApiRequestFactory, DefaultApiResponseProcessor} from "../apis/DefaultApi"; +export class PromiseDefaultApi { + private api: ObservableDefaultApi + + public constructor( + configuration: Configuration, + requestFactory?: DefaultApiRequestFactory, + responseProcessor?: DefaultApiResponseProcessor + ) { + this.api = new ObservableDefaultApi(configuration, requestFactory, responseProcessor); + } + + /** + */ + public fooGetWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.fooGetWithHttpInfo(_options); + return result.toPromise(); + } + + /** + */ + public fooGet(_options?: Configuration): Promise { + const result = this.api.fooGet(_options); + return result.toPromise(); + } + + +} + + + +import { ObservableFakeApi } from './ObservableAPI'; + +import { FakeApiRequestFactory, FakeApiResponseProcessor} from "../apis/FakeApi"; +export class PromiseFakeApi { + private api: ObservableFakeApi + + public constructor( + configuration: Configuration, + requestFactory?: FakeApiRequestFactory, + responseProcessor?: FakeApiResponseProcessor + ) { + this.api = new ObservableFakeApi(configuration, requestFactory, responseProcessor); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + public fakeBigDecimalMapWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.fakeBigDecimalMapWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + public fakeBigDecimalMap(_options?: Configuration): Promise { + const result = this.api.fakeBigDecimalMap(_options); + return result.toPromise(); + } + + /** + * Health check endpoint + */ + public fakeHealthGetWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.fakeHealthGetWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * Health check endpoint + */ + public fakeHealthGet(_options?: Configuration): Promise { + const result = this.api.fakeHealthGet(_options); + return result.toPromise(); + } + + /** + * test http signature authentication + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter + * @param header1 header parameter + */ + public fakeHttpSignatureTestWithHttpInfo(pet: Pet, query1?: string, header1?: string, _options?: Configuration): Promise> { + const result = this.api.fakeHttpSignatureTestWithHttpInfo(pet, query1, header1, _options); + return result.toPromise(); + } + + /** + * test http signature authentication + * @param pet Pet object that needs to be added to the store + * @param query1 query parameter + * @param header1 header parameter + */ + public fakeHttpSignatureTest(pet: Pet, query1?: string, header1?: string, _options?: Configuration): Promise { + const result = this.api.fakeHttpSignatureTest(pet, query1, header1, _options); + return result.toPromise(); + } + + /** + * Test serialization of outer boolean types + * @param body Input boolean as post body + */ + public fakeOuterBooleanSerializeWithHttpInfo(body?: boolean, _options?: Configuration): Promise> { + const result = this.api.fakeOuterBooleanSerializeWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * Test serialization of outer boolean types + * @param body Input boolean as post body + */ + public fakeOuterBooleanSerialize(body?: boolean, _options?: Configuration): Promise { + const result = this.api.fakeOuterBooleanSerialize(body, _options); + return result.toPromise(); + } + + /** + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body + */ + public fakeOuterCompositeSerializeWithHttpInfo(outerComposite?: OuterComposite, _options?: Configuration): Promise> { + const result = this.api.fakeOuterCompositeSerializeWithHttpInfo(outerComposite, _options); + return result.toPromise(); + } + + /** + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body + */ + public fakeOuterCompositeSerialize(outerComposite?: OuterComposite, _options?: Configuration): Promise { + const result = this.api.fakeOuterCompositeSerialize(outerComposite, _options); + return result.toPromise(); + } + + /** + * Test serialization of outer number types + * @param body Input number as post body + */ + public fakeOuterNumberSerializeWithHttpInfo(body?: number, _options?: Configuration): Promise> { + const result = this.api.fakeOuterNumberSerializeWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * Test serialization of outer number types + * @param body Input number as post body + */ + public fakeOuterNumberSerialize(body?: number, _options?: Configuration): Promise { + const result = this.api.fakeOuterNumberSerialize(body, _options); + return result.toPromise(); + } + + /** + * Test serialization of outer string types + * @param body Input string as post body + */ + public fakeOuterStringSerializeWithHttpInfo(body?: string, _options?: Configuration): Promise> { + const result = this.api.fakeOuterStringSerializeWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * Test serialization of outer string types + * @param body Input string as post body + */ + public fakeOuterStringSerialize(body?: string, _options?: Configuration): Promise { + const result = this.api.fakeOuterStringSerialize(body, _options); + return result.toPromise(); + } + + /** + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + */ + public fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty: OuterObjectWithEnumProperty, _options?: Configuration): Promise> { + const result = this.api.fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty, _options); + return result.toPromise(); + } + + /** + * Test serialization of enum (int) properties with examples + * @param outerObjectWithEnumProperty Input enum (int) as post body + */ + public fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty: OuterObjectWithEnumProperty, _options?: Configuration): Promise { + const result = this.api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, _options); + return result.toPromise(); + } + + /** + * For this test, the body has to be a binary file. + * @param body image to upload + */ + public testBodyWithBinaryWithHttpInfo(body: HttpFile, _options?: Configuration): Promise> { + const result = this.api.testBodyWithBinaryWithHttpInfo(body, _options); + return result.toPromise(); + } + + /** + * For this test, the body has to be a binary file. + * @param body image to upload + */ + public testBodyWithBinary(body: HttpFile, _options?: Configuration): Promise { + const result = this.api.testBodyWithBinary(body, _options); + return result.toPromise(); + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + */ + public testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass: FileSchemaTestClass, _options?: Configuration): Promise> { + const result = this.api.testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass, _options); + return result.toPromise(); + } + + /** + * For this test, the body for this request must reference a schema named `File`. + * @param fileSchemaTestClass + */ + public testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, _options?: Configuration): Promise { + const result = this.api.testBodyWithFileSchema(fileSchemaTestClass, _options); + return result.toPromise(); + } + + /** + * @param query + * @param user + */ + public testBodyWithQueryParamsWithHttpInfo(query: string, user: User, _options?: Configuration): Promise> { + const result = this.api.testBodyWithQueryParamsWithHttpInfo(query, user, _options); + return result.toPromise(); + } + + /** + * @param query + * @param user + */ + public testBodyWithQueryParams(query: string, user: User, _options?: Configuration): Promise { + const result = this.api.testBodyWithQueryParams(query, user, _options); + return result.toPromise(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model + */ + public testClientModelWithHttpInfo(client: Client, _options?: Configuration): Promise> { + const result = this.api.testClientModelWithHttpInfo(client, _options); + return result.toPromise(); + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model + */ + public testClientModel(client: Client, _options?: Configuration): Promise { + const result = this.api.testClientModel(client, _options); + return result.toPromise(); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param _double None + * @param patternWithoutDelimiter None + * @param _byte None + * @param integer None + * @param int32 None + * @param int64 None + * @param _float None + * @param string None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @param callback None + */ + public testEndpointParametersWithHttpInfo(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: HttpFile, date?: string, dateTime?: Date, password?: string, callback?: string, _options?: Configuration): Promise> { + const result = this.api.testEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, _options); + return result.toPromise(); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param number None + * @param _double None + * @param patternWithoutDelimiter None + * @param _byte None + * @param integer None + * @param int32 None + * @param int64 None + * @param _float None + * @param string None + * @param binary None + * @param date None + * @param dateTime None + * @param password None + * @param callback None + */ + public testEndpointParameters(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: HttpFile, date?: string, dateTime?: Date, password?: string, callback?: string, _options?: Configuration): Promise { + const result = this.api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, _options); + return result.toPromise(); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @param enumQueryModelArray + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + */ + public testEnumParametersWithHttpInfo(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumQueryModelArray?: Array, enumFormStringArray?: Array, enumFormString?: string, _options?: Configuration): Promise> { + const result = this.api.testEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, _options); + return result.toPromise(); + } + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) + * @param enumHeaderString Header parameter enum test (string) + * @param enumQueryStringArray Query parameter enum test (string array) + * @param enumQueryString Query parameter enum test (string) + * @param enumQueryInteger Query parameter enum test (double) + * @param enumQueryDouble Query parameter enum test (double) + * @param enumQueryModelArray + * @param enumFormStringArray Form parameter enum test (string array) + * @param enumFormString Form parameter enum test (string) + */ + public testEnumParameters(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumQueryModelArray?: Array, enumFormStringArray?: Array, enumFormString?: string, _options?: Configuration): Promise { + const result = this.api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString, _options); + return result.toPromise(); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters + * @param booleanGroup Boolean in group parameters + * @param int64Group Integer in group parameters + */ + public testGroupParametersWithHttpInfo(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, _options?: Configuration): Promise> { + const result = this.api.testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _options); + return result.toPromise(); + } + + /** + * Fake endpoint to test group parameters (optional) + * Fake endpoint to test group parameters (optional) + * @param requiredStringGroup Required String in group parameters + * @param requiredBooleanGroup Required Boolean in group parameters + * @param requiredInt64Group Required Integer in group parameters + * @param stringGroup String in group parameters + * @param booleanGroup Boolean in group parameters + * @param int64Group Integer in group parameters + */ + public testGroupParameters(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, _options?: Configuration): Promise { + const result = this.api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, _options); + return result.toPromise(); + } + + /** + * + * test inline additionalProperties + * @param requestBody request body + */ + public testInlineAdditionalPropertiesWithHttpInfo(requestBody: { [key: string]: string; }, _options?: Configuration): Promise> { + const result = this.api.testInlineAdditionalPropertiesWithHttpInfo(requestBody, _options); + return result.toPromise(); + } + + /** + * + * test inline additionalProperties + * @param requestBody request body + */ + public testInlineAdditionalProperties(requestBody: { [key: string]: string; }, _options?: Configuration): Promise { + const result = this.api.testInlineAdditionalProperties(requestBody, _options); + return result.toPromise(); + } + + /** + * + * test json serialization of form data + * @param param field1 + * @param param2 field2 + */ + public testJsonFormDataWithHttpInfo(param: string, param2: string, _options?: Configuration): Promise> { + const result = this.api.testJsonFormDataWithHttpInfo(param, param2, _options); + return result.toPromise(); + } + + /** + * + * test json serialization of form data + * @param param field1 + * @param param2 field2 + */ + public testJsonFormData(param: string, param2: string, _options?: Configuration): Promise { + const result = this.api.testJsonFormData(param, param2, _options); + return result.toPromise(); + } + + /** + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language + */ + public testQueryParameterCollectionFormatWithHttpInfo(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, allowEmpty: string, language?: { [key: string]: string; }, _options?: Configuration): Promise> { + const result = this.api.testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language, _options); + return result.toPromise(); + } + + /** + * To test the collection format in query parameters + * @param pipe + * @param ioutil + * @param http + * @param url + * @param context + * @param allowEmpty + * @param language + */ + public testQueryParameterCollectionFormat(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, allowEmpty: string, language?: { [key: string]: string; }, _options?: Configuration): Promise { + const result = this.api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableFakeClassnameTags123Api } from './ObservableAPI'; + +import { FakeClassnameTags123ApiRequestFactory, FakeClassnameTags123ApiResponseProcessor} from "../apis/FakeClassnameTags123Api"; +export class PromiseFakeClassnameTags123Api { + private api: ObservableFakeClassnameTags123Api + + public constructor( + configuration: Configuration, + requestFactory?: FakeClassnameTags123ApiRequestFactory, + responseProcessor?: FakeClassnameTags123ApiResponseProcessor + ) { + this.api = new ObservableFakeClassnameTags123Api(configuration, requestFactory, responseProcessor); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model + */ + public testClassnameWithHttpInfo(client: Client, _options?: Configuration): Promise> { + const result = this.api.testClassnameWithHttpInfo(client, _options); + return result.toPromise(); + } + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model + */ + public testClassname(client: Client, _options?: Configuration): Promise { + const result = this.api.testClassname(client, _options); + return result.toPromise(); + } + + +} + + + +import { ObservablePetApi } from './ObservableAPI'; + +import { PetApiRequestFactory, PetApiResponseProcessor} from "../apis/PetApi"; +export class PromisePetApi { + private api: ObservablePetApi + + public constructor( + configuration: Configuration, + requestFactory?: PetApiRequestFactory, + responseProcessor?: PetApiResponseProcessor + ) { + this.api = new ObservablePetApi(configuration, requestFactory, responseProcessor); + } + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.addPetWithHttpInfo(pet, _options); + return result.toPromise(); + } + + /** + * + * Add a new pet to the store + * @param pet Pet object that needs to be added to the store + */ + public addPet(pet: Pet, _options?: Configuration): Promise { + const result = this.api.addPet(pet, _options); + return result.toPromise(); + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePetWithHttpInfo(petId: number, apiKey?: string, _options?: Configuration): Promise> { + const result = this.api.deletePetWithHttpInfo(petId, apiKey, _options); + return result.toPromise(); + } + + /** + * + * Deletes a pet + * @param petId Pet id to delete + * @param apiKey + */ + public deletePet(petId: number, apiKey?: string, _options?: Configuration): Promise { + const result = this.api.deletePet(petId, apiKey, _options); + return result.toPromise(); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatusWithHttpInfo(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise>> { + const result = this.api.findPetsByStatusWithHttpInfo(status, _options); + return result.toPromise(); + } + + /** + * Multiple status values can be provided with comma separated strings + * Finds Pets by status + * @param status Status values that need to be considered for filter + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, _options?: Configuration): Promise> { + const result = this.api.findPetsByStatus(status, _options); + return result.toPromise(); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTagsWithHttpInfo(tags: Set, _options?: Configuration): Promise>> { + const result = this.api.findPetsByTagsWithHttpInfo(tags, _options); + return result.toPromise(); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Finds Pets by tags + * @param tags Tags to filter by + */ + public findPetsByTags(tags: Set, _options?: Configuration): Promise> { + const result = this.api.findPetsByTags(tags, _options); + return result.toPromise(); + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetByIdWithHttpInfo(petId: number, _options?: Configuration): Promise> { + const result = this.api.getPetByIdWithHttpInfo(petId, _options); + return result.toPromise(); + } + + /** + * Returns a single pet + * Find pet by ID + * @param petId ID of pet to return + */ + public getPetById(petId: number, _options?: Configuration): Promise { + const result = this.api.getPetById(petId, _options); + return result.toPromise(); + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePetWithHttpInfo(pet: Pet, _options?: Configuration): Promise> { + const result = this.api.updatePetWithHttpInfo(pet, _options); + return result.toPromise(); + } + + /** + * + * Update an existing pet + * @param pet Pet object that needs to be added to the store + */ + public updatePet(pet: Pet, _options?: Configuration): Promise { + const result = this.api.updatePet(pet, _options); + return result.toPromise(); + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, _options?: Configuration): Promise> { + const result = this.api.updatePetWithFormWithHttpInfo(petId, name, status, _options); + return result.toPromise(); + } + + /** + * + * Updates a pet in the store with form data + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet + * @param status Updated status of the pet + */ + public updatePetWithForm(petId: number, name?: string, status?: string, _options?: Configuration): Promise { + const result = this.api.updatePetWithForm(petId, name, status, _options); + return result.toPromise(); + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithHttpInfo(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + + /** + * + * uploads an image + * @param petId ID of pet to update + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: HttpFile, _options?: Configuration): Promise { + const result = this.api.uploadFile(petId, additionalMetadata, file, _options); + return result.toPromise(); + } + + /** + * + * uploads an image (required) + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server + */ + public uploadFileWithRequiredFileWithHttpInfo(petId: number, requiredFile: HttpFile, additionalMetadata?: string, _options?: Configuration): Promise> { + const result = this.api.uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata, _options); + return result.toPromise(); + } + + /** + * + * uploads an image (required) + * @param petId ID of pet to update + * @param requiredFile file to upload + * @param additionalMetadata Additional data to pass to server + */ + public uploadFileWithRequiredFile(petId: number, requiredFile: HttpFile, additionalMetadata?: string, _options?: Configuration): Promise { + const result = this.api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableStoreApi } from './ObservableAPI'; + +import { StoreApiRequestFactory, StoreApiResponseProcessor} from "../apis/StoreApi"; +export class PromiseStoreApi { + private api: ObservableStoreApi + + public constructor( + configuration: Configuration, + requestFactory?: StoreApiRequestFactory, + responseProcessor?: StoreApiResponseProcessor + ) { + this.api = new ObservableStoreApi(configuration, requestFactory, responseProcessor); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrderWithHttpInfo(orderId: string, _options?: Configuration): Promise> { + const result = this.api.deleteOrderWithHttpInfo(orderId, _options); + return result.toPromise(); + } + + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * Delete purchase order by ID + * @param orderId ID of the order that needs to be deleted + */ + public deleteOrder(orderId: string, _options?: Configuration): Promise { + const result = this.api.deleteOrder(orderId, _options); + return result.toPromise(); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventoryWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.getInventoryWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * Returns a map of status codes to quantities + * Returns pet inventories by status + */ + public getInventory(_options?: Configuration): Promise<{ [key: string]: number; }> { + const result = this.api.getInventory(_options); + return result.toPromise(); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderByIdWithHttpInfo(orderId: number, _options?: Configuration): Promise> { + const result = this.api.getOrderByIdWithHttpInfo(orderId, _options); + return result.toPromise(); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + * Find purchase order by ID + * @param orderId ID of pet that needs to be fetched + */ + public getOrderById(orderId: number, _options?: Configuration): Promise { + const result = this.api.getOrderById(orderId, _options); + return result.toPromise(); + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrderWithHttpInfo(order: Order, _options?: Configuration): Promise> { + const result = this.api.placeOrderWithHttpInfo(order, _options); + return result.toPromise(); + } + + /** + * + * Place an order for a pet + * @param order order placed for purchasing the pet + */ + public placeOrder(order: Order, _options?: Configuration): Promise { + const result = this.api.placeOrder(order, _options); + return result.toPromise(); + } + + +} + + + +import { ObservableUserApi } from './ObservableAPI'; + +import { UserApiRequestFactory, UserApiResponseProcessor} from "../apis/UserApi"; +export class PromiseUserApi { + private api: ObservableUserApi + + public constructor( + configuration: Configuration, + requestFactory?: UserApiRequestFactory, + responseProcessor?: UserApiResponseProcessor + ) { + this.api = new ObservableUserApi(configuration, requestFactory, responseProcessor); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUserWithHttpInfo(user: User, _options?: Configuration): Promise> { + const result = this.api.createUserWithHttpInfo(user, _options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Create user + * @param user Created user object + */ + public createUser(user: User, _options?: Configuration): Promise { + const result = this.api.createUser(user, _options); + return result.toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithArrayInputWithHttpInfo(user, _options); + return result.toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithArrayInput(user: Array, _options?: Configuration): Promise { + const result = this.api.createUsersWithArrayInput(user, _options); + return result.toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInputWithHttpInfo(user: Array, _options?: Configuration): Promise> { + const result = this.api.createUsersWithListInputWithHttpInfo(user, _options); + return result.toPromise(); + } + + /** + * + * Creates list of users with given input array + * @param user List of user object + */ + public createUsersWithListInput(user: Array, _options?: Configuration): Promise { + const result = this.api.createUsersWithListInput(user, _options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUserWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.deleteUserWithHttpInfo(username, _options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Delete user + * @param username The name that needs to be deleted + */ + public deleteUser(username: string, _options?: Configuration): Promise { + const result = this.api.deleteUser(username, _options); + return result.toPromise(); + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByNameWithHttpInfo(username: string, _options?: Configuration): Promise> { + const result = this.api.getUserByNameWithHttpInfo(username, _options); + return result.toPromise(); + } + + /** + * + * Get user by user name + * @param username The name that needs to be fetched. Use user1 for testing. + */ + public getUserByName(username: string, _options?: Configuration): Promise { + const result = this.api.getUserByName(username, _options); + return result.toPromise(); + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUserWithHttpInfo(username: string, password: string, _options?: Configuration): Promise> { + const result = this.api.loginUserWithHttpInfo(username, password, _options); + return result.toPromise(); + } + + /** + * + * Logs user into the system + * @param username The user name for login + * @param password The password for login in clear text + */ + public loginUser(username: string, password: string, _options?: Configuration): Promise { + const result = this.api.loginUser(username, password, _options); + return result.toPromise(); + } + + /** + * + * Logs out current logged in user session + */ + public logoutUserWithHttpInfo(_options?: Configuration): Promise> { + const result = this.api.logoutUserWithHttpInfo(_options); + return result.toPromise(); + } + + /** + * + * Logs out current logged in user session + */ + public logoutUser(_options?: Configuration): Promise { + const result = this.api.logoutUser(_options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUserWithHttpInfo(username: string, user: User, _options?: Configuration): Promise> { + const result = this.api.updateUserWithHttpInfo(username, user, _options); + return result.toPromise(); + } + + /** + * This can only be done by the logged in user. + * Updated user + * @param username name that need to be deleted + * @param user Updated user object + */ + public updateUser(username: string, user: User, _options?: Configuration): Promise { + const result = this.api.updateUser(username, user, _options); + return result.toPromise(); + } + + +} + + + diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/util.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/util.ts new file mode 100644 index 000000000000..96ea3dfdc770 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/util.ts @@ -0,0 +1,37 @@ +/** + * Returns if a specific http code is in a given code range + * where the code range is defined as a combination of digits + * and "X" (the letter X) with a length of 3 + * + * @param codeRange string with length 3 consisting of digits and "X" (the letter X) + * @param code the http status code to be checked against the code range + */ +export function isCodeInRange(codeRange: string, code: number): boolean { + // This is how the default value is encoded in OAG + if (codeRange === "0") { + return true; + } + if (codeRange == code.toString()) { + return true; + } else { + const codeString = code.toString(); + if (codeString.length != codeRange.length) { + return false; + } + for (let i = 0; i < codeString.length; i++) { + if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { + return false; + } + } + return true; + } +} + +/** +* Returns if it can consume form +* +* @param consumes array +*/ +export function canConsumeForm(contentTypes: string[]): boolean { + return contentTypes.indexOf('multipart/form-data') !== -1 +} diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index 77fb4a789dbb..38fad4135e05 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -114,6 +114,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index a433d76ffa2a..1c79f26f9307 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -105,6 +105,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed * diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 77fb4a789dbb..38fad4135e05 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -114,6 +114,10 @@ export class RequestContext { this.url.searchParams.set(name, value); } + public appendQueryParam(name: string, value: string) { + this.url.searchParams.append(name, value); + } + /** * Sets a cookie with the name and value. NO check for duplicate cookies is performed *